Last Comment Bug 653551 - Jaegermonkey Sparc back-end broken on sparc64
: Jaegermonkey Sparc back-end broken on sparc64
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: Sun OpenBSD
-- normal (vote)
: mozilla13
Assigned To: Landry Breuil (:gaston)
: Jason Orendorff [:jorendorff]
Depends on:
Blocks: openbsdmeta
  Show dependency treegraph
Reported: 2011-04-28 13:40 PDT by Landry Breuil (:gaston)
Modified: 2012-02-04 02:28 PST (History)
4 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

dont enable yarr/jit on sparc64 (1.18 KB, patch)
2011-04-28 13:40 PDT, Landry Breuil (:gaston)
no flags Details | Diff | Splinter Review
Fix build on sparc64 (2.14 KB, patch)
2011-06-18 10:24 PDT, Landry Breuil (:gaston)
no flags Details | Diff | Splinter Review
Fix sparc64 (1.61 KB, patch)
2011-08-07 00:31 PDT, Landry Breuil (:gaston)
no flags Details | Diff | Splinter Review
Don't enable jits on sparc64 (893 bytes, patch)
2011-08-24 14:22 PDT, Landry Breuil (:gaston)
no flags Details | Diff | Splinter Review
Don't enable JITs on sparc64 (858 bytes, patch)
2012-01-19 13:09 PST, Landry Breuil (:gaston)
leon.sha: review+
Details | Diff | Splinter Review

Description User image Landry Breuil (:gaston) 2011-04-28 13:40:03 PDT
Created attachment 528948 [details] [diff] [review]
dont enable yarr/jit on sparc64

The last tm->m-c merge broke OpenBSD/sparc64 builds, due to the landing of Now by default ENABLE_TRACEJIT is set on sparc64, and the build fails later on with pain and prejudice, see

Previously i only needed to set --disable-tracejit in .mozconfig, now i also need a hack in wtf/Platform.h (see attached) to avoid ENABLE_JIT & ENABLE_YARR_JIT being set to 1.

I'm all willing to test diffs/patches to fix that issue, and if finally the switch to 128-bits jsval is done we might finally have firefox working on sparc64.

btw you might want to recheck the ifeq entering in assembler/ in js/src/, the merge has reset it to ifeq (,$(filter arm% %86 x86_64,$(TARGET_CPU))) while tm only had ifeq (,$(filter-out powerpc,$(TARGET_CPU))) if i'm not mistaked. Dunno if that was the intent.
Comment 1 User image Leon Sha 2011-04-28 19:33:19 PDT
The patch look OK for me.
I noticed that for yarr in, the list has been changed from black list to white list. I'll try to fix this.
Comment 2 User image Landry Breuil (:gaston) 2011-04-29 00:51:00 PDT
(In reply to comment #1)
> The patch look OK for me.

Well rather than just disabling it for sparc64, i'd prefer making it work, but i'm not the one able to write such code. I can only test diffs :)
Comment 3 User image Landry Breuil (:gaston) 2011-06-15 13:30:53 PDT
The last commits to wtf/Platform.h (likely renders the patch useless, as it seems now JIT is now only enabled by default on x86 and 86_64/mips/arm and not sparc. I'll just need to recheck things in my builds on sparc64.
Comment 4 User image Landry Breuil (:gaston) 2011-06-15 22:44:03 PDT
Hm no, this still blows, as can be seen on I'll need to find how to enable the sparc backend only on sparc32....
Comment 5 User image Landry Breuil (:gaston) 2011-06-17 10:01:54 PDT
Rechecking, but it seems enables assembler for sparc64 too, whereas it shouldn't match.. testing that now.
Or i should find another way to disable jit.
Comment 6 User image Wesley W. Garland 2011-06-17 10:11:47 PDT

AFAIK Sparc64 support isn't being actively developed by anybody (other than Andrew P.), and the JITs only support the V8+ arch  (32-bit words but sparc v9 instructions).  

So - "Sparc" in SpiderMonkey seems to pretty much mean "sparc v8+". Once upon a time there was differentiation between sparc and ultrasparc, but this only allowed support for v8 instructions for jslock.c, and did not work with the JITs.  v8 is pretty much dead, Sun hasn't shipped any sun4c/sun4m machines in like 20 years.

So - this lack of 32/64-bit differentiation means that you're likely to bump into these issues until differentiation is made in the autoconf code and pushed forward.  If you have the wherewithal to write such a patch, I would be happy to test it on Solaris with GCC for you.
Comment 7 User image Landry Breuil (:gaston) 2011-06-17 10:18:14 PDT
Ugh. I think js/src/ line 1055 bites me hard. Unconditionally adding -DENABLE_ASSEMBLER=1 -DENABLE_JIT=1 .... testing yet another fix.
Comment 8 User image Landry Breuil (:gaston) 2011-06-17 15:28:15 PDT
making -DENABLE_ASSEMBLER=1 -DENABLE_JIT=1 conditional fails later on with the following :

js/src/yarr/wtfbridge.h:268: error: ISO C++ forbids declaration of 'ExecutableAllocator' with no type

introduced by

ExecutableAllocator is defined within ENABLE_ASSEMBLER.... that stuff is too intermixed. Seems noone tried building with jit disabled since a while.
Comment 9 User image Landry Breuil (:gaston) 2011-06-18 10:24:19 PDT
Created attachment 540254 [details] [diff] [review]
Fix build on sparc64

Here's a patch that at least fixes the build for me on OpenBSD/sparc64 (make package still fails because it tries to run some js code in GENERATE_CACHE iirc, which sigbuses, but that's another story)
it does three things :
- enable tracejit/methodjit only on sparc (v8+?) in js/src/ and not sparc64
- fix js/src/jsregexpinlines.h to use codeblock only if ENABLE_YARR_JIT is defined, as it's declared as is in the class
- and finally, to be discussed, add -DENABLE_JIT=1 to CPPFLAGS only if ENABLE_TRACEJIT is set.

For the latter, i'd like first to understand why that ugly CPPFLAGS hacky tweak is done.. and then, if the 'fix' has to be applied for sparc64 only, for !ENABLE_TRACEJIT only, or if ENABLE_METHODJIT has to be there too.

Thanks for feedback/comment on the logic...
Comment 10 User image Leon Sha 2011-06-21 23:09:32 PDT
$target in comes from config.guess. For some 64 bit OS on Sparc, the $target is not sparc64-* for sure. Something like "if test ! "$HAVE_64BIT_OS"; then" would be better.
Comment 11 User image Landry Breuil (:gaston) 2011-08-07 00:31:45 PDT
Created attachment 551303 [details] [diff] [review]
Fix sparc64

Not sure about that, you know probably better than me... but here's another patch using that HAVE_64BIT_OS test, and removes the ENABLE_YARR_JIT #ifdef since it's already fixed in m-c (but not in aurora)

I'd love to get that tested on solaris to see if it doesnt change the behaviour there...
Comment 12 User image Landry Breuil (:gaston) 2011-08-24 14:22:14 PDT
Created attachment 555540 [details] [diff] [review]
Don't enable jits on sparc64

Now that bug 670719 has landed, js/src/ part of the patch can go away. Still left is the HAVE_64BIT_OS chunk... doing builds this night, will confirm later if this is now enough to let m-c build on sparc64 (even if it's still broken at cache generation/runtime/js...)
Comment 13 User image Landry Breuil (:gaston) 2012-01-19 13:09:01 PST
Created attachment 589964 [details] [diff] [review]
Don't enable JITs on sparc64

And here's the patch i'm using now to build m-c on sparc64, even if it's useless... any chance this can be considered ?
Comment 15 User image Ed Morley [:emorley] 2012-02-03 11:51:31 PST
Comment 16 User image Landry Breuil (:gaston) 2012-02-04 02:28:12 PST
I wouldnt mark the bug as 'fixed' since jm is still broken at runtime on sparc64, but oh well :)

Note You need to log in before you can comment on or make changes to this bug.