Bug 128226 - The stack limit computation does not work for Windows
Summary: The stack limit computation does not work for Windows
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords:
Depends on:
Blocks: 127940
  Show dependency treegraph
 
Reported: 2014-02-04 18:16 PST by Mark Lam
Modified: 2014-02-04 21:27 PST (History)
10 users (show)

See Also:


Attachments
fixed StackBound::recursionLimit() to handle underflows. (5.76 KB, patch)
2014-02-04 18:48 PST, Mark Lam
no flags Details | Formatted Diff | Diff
I fixed the patch, but apparently uploaded the wrong one. Round 2. (5.76 KB, patch)
2014-02-04 19:28 PST, Mark Lam
no flags Details | Formatted Diff | Diff
Trying again. (5.77 KB, patch)
2014-02-04 19:33 PST, Mark Lam
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2014-02-04 18:16:14 PST
The current stack limit computation assumes that the stack is allocated in high memory.  On Windows, the stack seems to be allocated very near address 0, and is smaller in size than our Options::maxPerThreadStackUsage().  This combination triggers a bug where StackBounds::recursionLimit() underflows and computes a limit address that is ridiculously high in memory.  The net effect is that the Windows port thinks its out of stack space all the time.

Fix coming.
Comment 1 Mark Lam 2014-02-04 18:48:55 PST
Created attachment 223195 [details]
fixed StackBound::recursionLimit() to handle underflows.
Comment 2 Oliver Hunt 2014-02-04 18:51:39 PST
Comment on attachment 223195 [details]
fixed StackBound::recursionLimit() to handle underflows.

View in context: https://bugs.webkit.org/attachment.cgi?id=223195&action=review

> Source/JavaScriptCore/llint/LowLevelInterpreter.cpp:156
> +    CLoopRegister() { i = static_cast<intptr_t>(0xbadbeef0baddbeef); }

tasty, but won't this break in 32bit builds?
Comment 3 Mark Lam 2014-02-04 18:52:46 PST
Comment on attachment 223195 [details]
fixed StackBound::recursionLimit() to handle underflows.

View in context: https://bugs.webkit.org/attachment.cgi?id=223195&action=review

>> Source/JavaScriptCore/llint/LowLevelInterpreter.cpp:156
>> +    CLoopRegister() { i = static_cast<intptr_t>(0xbadbeef0baddbeef); }
> 
> tasty, but won't this break in 32bit builds?

Nope.  That's what the static_cast<intptr_t> takes care of for me.  I verified that the 32-bit build is happy.
Comment 4 Mark Lam 2014-02-04 19:28:50 PST
Created attachment 223198 [details]
I fixed the patch, but apparently uploaded the wrong one.  Round 2.
Comment 5 Mark Lam 2014-02-04 19:30:05 PST
Comment on attachment 223198 [details]
I fixed the patch, but apparently uploaded the wrong one.  Round 2.

A bad patch again.  Redoing.
Comment 6 Mark Lam 2014-02-04 19:33:21 PST
Created attachment 223200 [details]
Trying again.
Comment 7 Mark Lam 2014-02-04 19:35:05 PST
Patch 3 has passed the layout tests with a debug build.
Comment 8 Geoffrey Garen 2014-02-04 20:59:33 PST
Comment on attachment 223200 [details]
Trying again.

r=me
Comment 9 WebKit Commit Bot 2014-02-04 21:27:32 PST
Comment on attachment 223200 [details]
Trying again.

Clearing flags on attachment: 223200

Committed r163428: <http://trac.webkit.org/changeset/163428>
Comment 10 WebKit Commit Bot 2014-02-04 21:27:34 PST
All reviewed patches have been landed.  Closing bug.