IDEBUGGER_GetStackRange returns the initial address of the stack array. Because the stack grows downward, we can retrieve the stack base address by adding the stack size retrieved from IDEBUGGER_GetStackSize to the result of IDEBUGGER_GetStackRange. For BREW simulator, use WIN_OS currentThreadStackBase implementation as BREW simulator is essentially a Win32 program.
Created attachment 46431 [details] Port currentThreadStackBase to BREW
Attachment 46431 [details] did not pass style-queue: Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1 JavaScriptCore/runtime/Collector.cpp:551: Extra space before ( in function call [whitespace/parens] [4] Total errors found: 1
Comment on attachment 46431 [details] Port currentThreadStackBase to BREW Wow, I would think creating/releasing some debugger object could be expensive. This function is called every time with garbage collect in JavaScriptCore. +#undef COMPILE_ASSERT problem, as mentioned in other bugs.
This is the place where the behavior differs between BREW and BREW MP. There is no IDebugger interface in BREW MP, so we can't use it to retrieve the stack base address. I am looking for a way to get it.
Created attachment 59617 [details] Patch There is no way to get the stack base address in Brew MP. Make it possible to set it externally.
Created attachment 59618 [details] Patch Better naming.
> +static void* s_stackBaseAddress; Avoid static data. JSC should be thread-safe.
(In reply to comment #7) > > +static void* s_stackBaseAddress; > > Avoid static data. JSC should be thread-safe. Yes, I know. However, Brew MP does support preemptive multi-threading. It does not have threads, mutexs and thread-specific variables. I turned on ENABLE(SINGLE_THREADED) for Brew MP.
It seems we have a better way to find the stack base in Brew MP 1.1.0. For example, we can set the stack size and base in IThread2Util_CreateThread. Unfortunately, Brew MP 1.1.0 is not yet publicly available.
Brew MP port is no longer maintained.