Closed Bug 389713 Opened 18 years ago Closed 18 years ago

ActionMonkey: MMgc: Add per-object custom marking

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: jorendorff, Assigned: jorendorff)

References

Details

Attachments

(1 file)

To support the mark/trace hooks in JSAPI, JSObjects need a callback during MMgc's mark phase. My initial thought is to implement this by adding a method to MMgc::GCFinalizedObject, MarkReferents(). The method will be called for every object. Another way would be for MMgc to provide a way to enumerate all JSObjects (either all objects of that size; or by making a separate allocator which we use only for JSObjects). We can then use this to find objects that have custom mark methods during lastmark(). We are already considering doing an extra pass through all pages containing JSObject-sized allocations per collection, to call JSObject finalizer hooks (see bug 389420 comment 19).
(In reply to comment #0) > My initial thought is to implement this by adding a method to > MMgc::GCFinalizedObject, MarkReferents(). The method will be called for every > object. I mean "every object allocated with both kFinalize and kContainsPointers".
Attached patch v1Splinter Review
Attachment #274478 - Flags: review?(edilee)
Blocks: 390175
Comment on attachment 274478 [details] [diff] [review] v1 >+ if ((bits2 & (GCAlloc::kFinalize<<shift)) != 0 >+ GCAssert((*pbits & (GCAlloc::kMark<<shift)) != 0); Any reason for using bits2 and *pbits? Just use bits2 for both. >+ * From CustomMark(), the object may mark itself and/or any >+ * number of direct or indirect referents, using >+ * MMgc::GC::SetMark(). However, the usual caveat with >+ * SetMark() applies: if you mark any object, you must make >+ * sure that everything directly or indirectly reachable from >+ * that object is also marked, because the GC will not scan >+ * that object once you've marked it. >+ * >+ * An implementation of CustomMark() returns true to tell the >+ * GC that it and all descendants are marked; or false to tell >+ * the GC to do the usual conservative scan of the object's >+ * fields. How about.. If CustomMark() returns true, it replaces the conservative scan of the GC, so the object must mark itself and its descendants with MMgc::GC::SetMark() to prevent these objects from getting collected. Otherwise, it returns false to inform the GC to mark things as usual.
Attachment #274478 - Flags: review?(edilee) → review+
OK, I'll change the comment as suggested. The reason |bits2| isn't used for both is that once |CustomMark()| has been called, |bits2| is stale. Thanks for the speedy r+.
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Transfer Bug from Core->Tamarin to Tamarin Product.
Component: Tamarin → Virtual Machine
Product: Core → Tamarin
Closing bug out as GC has been rewritten since bug.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: