Last Comment Bug 380998 - StackGrowthDirection is not reliable with Sun Studio 11
: StackGrowthDirection is not reliable with Sun Studio 11
Status: RESOLVED FIXED
: fixed1.8.0.13, fixed1.8.1.5
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: x86 OpenSolaris
: -- major (vote)
: ---
Assigned To: Brian Crowder
:
:
Mentors:
: 377909 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-05-17 01:16 PDT by Ginn Chen
Modified: 2007-08-20 02:05 PDT (History)
6 users (show)
dveditz: blocking1.8.1.5+
dveditz: blocking1.8.0.13+
bob: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Add "-g" to prevent StackGrowthDirection from being inlined (456 bytes, patch)
2007-05-18 02:09 PDT, Boying Lu
no flags Details | Diff | Splinter Review
Use more general "MOZ_DEBUG_FLAGS" instead of "-g" (472 bytes, patch)
2007-05-18 02:54 PDT, Boying Lu
no flags Details | Diff | Splinter Review
patch that uses #pragma for Sun Studio (498 bytes, patch)
2007-05-20 21:07 PDT, Ginn Chen
brendan: review+
dveditz: approval1.8.1.5+
dveditz: approval1.8.0.13+
Details | Diff | Splinter Review

Description Ginn Chen 2007-05-17 01:16:31 PDT
StackGrowthDirection in jscpucfg.c is not reliable with Sun Studio 11 on Solaris x86.

Sun Studio doesn't support "__attribute__((noinline))"
Compile it with optimization will get JS_STACK_GROWTH_DIRECTION (1)
should be JS_STACK_GROWTH_DIRECTION (-1)

It may cause problems with some javascripts.
Comment 1 Ginn Chen 2007-05-17 01:21:38 PDT
some options we may use,

1) don't call StackGrowthDirection(), hardcode JS_STACK_GROWTH_DIRECTION for Solaris
2) use "-g" to compile jscpucfg.c, it will avoid inline for Sun Studio.
3) put StackGrowthDirection() into another C file, maybe we can avoid it be inlined for all/most compilers
4) use a function pointer for StackGrowthDirection(), maybe we can avoid it be inlined for all/most compilers
Comment 2 Boying Lu 2007-05-18 02:09:23 PDT
Created attachment 265231 [details] [diff] [review]
Add "-g" to prevent  StackGrowthDirection from being inlined
Comment 3 Ginn Chen 2007-05-18 02:41:36 PDT
at least we should use MOZ_DEBUG_FLAGS instead of "-g"
Comment 4 Boying Lu 2007-05-18 02:54:57 PDT
Created attachment 265237 [details] [diff] [review]
Use more general "MOZ_DEBUG_FLAGS" instead of "-g"
Comment 5 Brendan Eich [:brendan] 2007-05-18 13:46:29 PDT
It would be better to define NS_NEVER_INLINE to something that your compiler respects -- is there such a pragma?

$ grep NS_NEVER_INLINE *.[ch]
jscpucfg.c:#define NS_NEVER_INLINE __attribute__((noinline))
jscpucfg.c:#define NS_NEVER_INLINE
jscpucfg.c:static int NS_NEVER_INLINE StackGrowthDirection(int *dummy1addr)

/be
Comment 6 Ginn Chen 2007-05-20 21:07:28 PDT
Created attachment 265477 [details] [diff] [review]
patch that uses #pragma for Sun Studio

I forgot Sun Studio C does have no_inline pragma.
But it's not as same as gcc.
I've to declare the function first.

Sun Studio 12 will have same attributes ability as gcc.
Comment 7 Brendan Eich [:brendan] 2007-05-20 22:21:08 PDT
Comment on attachment 265477 [details] [diff] [review]
patch that uses #pragma for Sun Studio

r=me, thanks.

/be
Comment 8 Ginn Chen 2007-05-20 22:38:13 PDT
Comment on attachment 265477 [details] [diff] [review]
patch that uses #pragma for Sun Studio

brendan, can you commit this for me?

Also, I think it's important for 1.5.x and 2.0.x.

BTW:
#pragma no_inline only works for Sun Studio C compiler not C++.
"-g" option only disables inlining for Sun Studio C++ compiler.
So this approach is the correct one.
Comment 9 Brian Crowder 2007-05-21 15:56:18 PDT
jscpucfg.c: 3.26
Comment 10 Brian Crowder 2007-06-05 23:07:21 PDT
This should certainly not block a branch release, in my opinion.
Comment 11 Daniel Veditz [:dveditz] 2007-06-14 10:59:59 PDT
Not blocking _us_, but Sun (and other vendors) are committed to longer branch support than Mozilla.
Comment 12 Daniel Veditz [:dveditz] 2007-06-14 11:00:13 PDT
Comment on attachment 265477 [details] [diff] [review]
patch that uses #pragma for Sun Studio

Approved for 1.8.1.5 and 1.8.0.13, a=dveditz for release-drivers
Comment 13 Brendan Eich [:brendan] 2007-06-28 17:29:52 PDT
Probably this should be assigned to crowder, who did the checkin, rather than to ginn.chen.

/be
Comment 14 Brian Crowder 2007-06-29 13:33:58 PDT
MOZILLA_1_8_BRANCH: jscpucfg.c: 3.25.2.1
MOZILLA_1_8_0_BRANCH: jscpucfg.c: 3.25.10.1
Comment 15 Alfred Peng 2007-08-20 02:05:42 PDT
*** Bug 377909 has been marked as a duplicate of this bug. ***

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