Closed
Bug 462042
Opened 16 years ago
Closed 16 years ago
TM: Allow GC with traced machine code on stack
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jorendorff, Assigned: jorendorff)
References
Details
(Keywords: fixed1.9.1)
Attachments
(1 file, 5 obsolete files)
5.25 KB,
patch
|
jorendorff
:
review+
|
Details | Diff | Splinter Review |
If we allow reentering the VM as discussed in bug 462027, we need to cope with stacks like
js_Interpret -> js_ExecuteTree -> (traced code) -> Array_p_join -> js_ValueToString -> js_Invoke -> js_Interpret -> ... -> js_GC
Currently this will do js_GC -> js_FlushJITCache -> Fragmento::clearFrags, which would free the traced code. We will eventually return to that code, so we need to keep it around, or something.
Comment 1•16 years ago
|
||
Can you just suppress GC while on trace?
Comment 2•16 years ago
|
||
We do suppress GC on trace. Trick here is GC'ing after reconstructing stack frames and otherwise making sure everything created on trace is rooted, and unwinding carefully.
We also need to stop flushing the JIT cache from the GC. David recently added a generation number to the code cache, which paves the way for not flushing the JIT cache from the GC.
/be
Comment 3•16 years ago
|
||
Jason and I were talking, and I wondered if you could flush the JIT code during GC: then simply bypass it when walking back up the stack by returning/jumping back to js_ExecuteTree (using assembly) and skipping the native code entirely.
Comment 4•16 years ago
|
||
Bug 458288 fixed this in the simple case: we don't flush the trace cache at GC, we wait until it unwinds and starts tracing again. However, what will happen in the following case?:
js_Interpret -> js_ExecuteTree -> (traced code) -> Array_p_join ->
js_ValueToString -> js_Invoke -> js_Interpret -> ... -> js_GC
Continue in js_Interpret... will tracing (and perhaps JIT) resume immediately? if so, won't that destroy the outer traced code?
Comment 5•16 years ago
|
||
(In reply to comment #4)
> Bug 458288 fixed this in the simple case: we don't flush the trace cache at GC,
> we wait until it unwinds and starts tracing again. However, what will happen in
> the following case?:
>
> js_Interpret -> js_ExecuteTree -> (traced code) -> Array_p_join ->
> js_ValueToString -> js_Invoke -> js_Interpret -> ... -> js_GC
>
> Continue in js_Interpret...
You mean the second js_Interpret -> ... (I'm pretty sure).
> will tracing (and perhaps JIT) resume immediately?
Yes.
> if so, won't that destroy the outer traced code?
Yes, that's a hole in the current scheme (danderson says).
Nevertheless we probably want to avoid longjmp or equivalent just to get out of GC hell.
Also, js_GC does bails out early with JS_ON_TRACE(cx). Is there a problem here for sure? We might have memory-pressure-induced OOMs, at worst.
/be
Assignee | ||
Comment 6•16 years ago
|
||
(In reply to comment #5)
> Also, js_GC does bails out early with JS_ON_TRACE(cx). Is there a problem here
> for sure? We might have memory-pressure-induced OOMs, at worst.
Hmm. I filed this because I wanted to change that behavior: instead of refusing to GC and staying on trace, bail off trace and proceed with GC. I'll try it without and see how bad it is.
Comment 7•16 years ago
|
||
as long we have a reserve pool to guarantee that we can bail out we should be fine
Assignee | ||
Comment 8•16 years ago
|
||
This patch applies on top of the one in bug 462027. The problem is introduced in that patch.
The fix is yet another flag. We could instead go to a status enum.
Assignee: general → jorendorff
Attachment #353321 -
Flags: review?(brendan)
Comment 9•16 years ago
|
||
JSPackedBools all in a row if not an enum. What are the valid state combos?
/be
Assignee | ||
Comment 10•16 years ago
|
||
Valid state combos are listed in the bug; I'll switch to JSPackedBools. It seems like someone cleaned out JSTraceMonitor, so the words "yet another" no longer apply.
Assignee | ||
Comment 11•16 years ago
|
||
Sorry, "listed in a comment in the patch", not "in the bug".
Assignee | ||
Comment 12•16 years ago
|
||
Updated with JSPackedBool.
Attachment #353321 -
Attachment is obsolete: true
Attachment #356264 -
Flags: review?(brendan)
Attachment #353321 -
Flags: review?(brendan)
Comment 13•16 years ago
|
||
Comment on attachment 356264 [details] [diff] [review]
v2
Looks good, thanks.
/be
Attachment #356264 -
Flags: review?(brendan) → review+
Assignee | ||
Comment 14•16 years ago
|
||
The same as v2 but updated to apply cleanly over the much-revised patch in bug 462027. Carrying over brendan's review.
Attachment #356264 -
Attachment is obsolete: true
Attachment #357499 -
Flags: review+
Assignee | ||
Comment 15•16 years ago
|
||
Rebased, and fixed a silly bug introduced in v3 by my failure to review hg's handiwork when it says "hunk 32 succeeded at offset 1799 lines with fuzz 2".
Carrying forward r+ again.
Attachment #357840 -
Flags: review+
Assignee | ||
Comment 16•16 years ago
|
||
And rebased to tip once again.
Attachment #357499 -
Attachment is obsolete: true
Attachment #357840 -
Attachment is obsolete: true
Attachment #359130 -
Flags: review+
Assignee | ||
Comment 17•16 years ago
|
||
Attachment #359130 -
Attachment is obsolete: true
Attachment #360184 -
Flags: review+
Assignee | ||
Comment 18•16 years ago
|
||
Comment 19•16 years ago
|
||
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Comment 20•16 years ago
|
||
Keywords: fixed1.9.1
Updated•16 years ago
|
Flags: in-testsuite-
You need to log in
before you can comment on or make changes to this bug.
Description
•