Closed Bug 600310 Opened 14 years ago Closed 14 years ago

TM: don't perform GC outside of stack quota

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- beta8+

People

(Reporter: gwagner, Assigned: gwagner)

References

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 3 obsolete files)

from Bug 600139
blocking2.0: --- → ?
Assignee: general → anygregor
Attached patch patch (obsolete) — Splinter Review
Attached patch patch (obsolete) — Splinter Review
Assert in js_GC
Attachment #480313 - Attachment is obsolete: true
Attachment #480326 - Flags: review?(igor)
Comment on attachment 480326 [details] [diff] [review]
patch

No it's not that easy...
Attachment #480326 - Flags: review?(igor)
Attached patch patch (obsolete) — Splinter Review
Attachment #480326 - Attachment is obsolete: true
Comment on attachment 480359 [details] [diff] [review]
patch

>diff -r eb83de9d08da js/src/jsgc.cpp
>--- a/js/src/jsgc.cpp	Fri Oct 01 17:53:08 2010 -0700
>+++ b/js/src/jsgc.cpp	Fri Oct 01 20:59:55 2010 -0700
>@@ -2671,16 +2671,21 @@ js_GC(JSContext *cx, JSGCInvocationKind 
>      * should suppress that final collection or there may be shutdown leaks,
>      * or runtime bloat until the next context is created.
>      */
>     if (rt->state != JSRTS_UP && gckind != GC_LAST_CONTEXT)
>         return;
> 
>     RecordNativeStackTopForGC(cx);
> 
>+#ifdef DEBUG
>+    ConservativeGCThreadData *ctd = &JS_THREAD_DATA(cx)->conservativeGC;
>+    JS_ASSERT(JS_CHECK_STACK_SIZE(cx->stackLimit, ctd->nativeStackTop));
>+#endif

nativeStackTop can be the stack at the moment of SuspendRequest with js_GC called outside a request with much deeper stack. So the check above is not suitable for proper stack space detection. A solution could be to add to jscntxt.h an inline like (any better name is welcomed here):

inline void 
AssertNativeStackSpace(JSContext *cx) 
{
#ifdef DEBUG
    int stackDummy;
    JS_ASSERT(JS_CHECK_STACK_SIZE(cx->stackLimit, &stackDummy));
#endif
}
Attachment #480359 - Flags: review-
blocking2.0: ? → beta8+
Attached patch patchSplinter Review
Attachment #480359 - Attachment is obsolete: true
this passes now tryserver and I hit this assertion for the testcase in bug 600139.
Attachment #480829 - Flags: review+
Blocks: 600139
http://hg.mozilla.org/tracemonkey/rev/fd4510c77054
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/fd4510c77054
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: