Closed Bug 548215 Opened 14 years ago Closed 2 years ago

Don't support finalization by the embedding before JSGC_FINALIZE_END state

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: gal, Unassigned)

Details

Attachments

(4 obsolete files)

For API compatibility we supported this using a pretty sketchy hack in jsgc.cpp. This is in the way of weak pointer support (i.e. ephemeron tables). I will update mdc when this patch lands and notify the mailing list. I doubt anyone else really uses these hooks though.
Attached patch patch (obsolete) — Splinter Review
Assignee: general → gal
Attached patch patch (obsolete) — Splinter Review
Update comment.
Attachment #428658 - Attachment is obsolete: true
Attachment #428659 - Flags: review?(igor)
Blocks: WeakMap
The patch should also restrict the usage of JS_IsAboutToFinalized (the public API) to make sure that it is only called after the marking phase is completed. That would require to update the xpconnect code.
#3 is a good idea. I can add a debug assert for that.
Attachment #428659 - Flags: review?(igor)
Attachment #428659 - Attachment is obsolete: true
Attached patch patch (obsolete) — Splinter Review
Attachment #428784 - Attachment is obsolete: true
Attachment #428788 - Flags: review?(igor)
Comment on attachment 428788 [details] [diff] [review]
patch

>     /*
>+     * Allow the embedding to do some additional marking.
>+     */
>+    if (rt->gcCallback)
>+        (void) rt->gcCallback(cx, JSGC_MARK);
>+
>+    /*
>      * Mark children of things that caused too deep recursion during the above
>      * tracing.
>      */
>     MarkDelayedChildren(&trc);
> 

This still is not right. MarkDelayedChildren should be called before JSGC_MARK so the cycle collector callback can see all the marked objects. 

A solution for that could be to drop JSGC_MARK, make MarkDelayedChildren a friend function and call it before JSGC_MARK_END and explicitly in the cycle collector.
Attachment #428788 - Flags: review?(igor)
Attachment #428788 - Attachment is obsolete: true
I don't think this patch is needed any more for my work, so I will let go of this.

I still think the API should be cleaned up.
Assignee: gal → general
No longer blocks: WeakMap
Severity: normal → enhancement
OS: Mac OS X → All
Priority: -- → P2
Hardware: x86 → All
Assignee: general → nobody
Moving to p3 because no activity for at least 1 year(s).
See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Priority: P2 → P3
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: