Closed Bug 1173447 Opened 11 years ago Closed 10 years ago

Test incremental pre-barriers

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: sfink, Assigned: sfink)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Terrence - I implemented a test for the roots and pre-barriers that we were discussing yesterday.
jonco - I gave the review to you so you can tell me how to rewrite this comment: // marked. Note that the root->leaf2 edge will *not* be marked through, // since the root is already marked, but that only matters if doing a // compacting GC and... er... the compacting GC is smart so it knows how to // handle this.
Attachment #8620438 - Flags: review?(jcoppeard)
Comment on attachment 8620438 [details] [diff] [review] Add test for incremental pre-barriers when storing things under roots Review of attachment 8620438 [details] [diff] [review]: ----------------------------------------------------------------- Good idea to add tests for this. ::: js/src/jsapi-tests/testGCMarking.cpp @@ +77,5 @@ > END_TEST(testTracingIncomingCCWs) > + > +#define CHECK_GC \ > + if (rt->gc.gcNumber() != currentGCNumber) { \ > + printf("Unexpected GC, probably due to zeal setting. Truncating test.\n"); \ Rather than do this, let's turn off any zeal mode for the duration of the test and assert things work as we expect. @@ +104,5 @@ > + return false; > + leafOwner = obj; > + obj = subobj; > + leaf = subobj; > + } I think I know what this object graph is going to look like, but could you add a diagram in a comment? @@ +108,5 @@ > + } > + > + // Give the leaf owner a second leaf. The first leaf will be moved out of > + // its place in the graph; the second leaf will be copied without removing > + // it from its origin. This comment confused me until I realised that the second sentence was describing what was going to happen later in the test, not what the next code block did. @@ +138,5 @@ > + JSObject* unrootedLeafOwner = leafOwner; > + JS::HandleObject leafHandle = JS::HandleObject::fromMarkedLocation(&unrootedLeaf); > + JS::HandleValue leafValueHandle = JS::HandleValue::fromMarkedLocation(&unrootedLeafValue); > + JS::HandleObject leafOwnerHandle = JS::HandleObject::fromMarkedLocation(&unrootedLeafOwner); > +#endif Heh, this is kind of nasty but I guess we need to hide this from the analysis. @@ +164,5 @@ > + if (!JS_SetProperty(cx, leafOwnerHandle, "obj", JS::UndefinedHandleValue)) > + return false; > + CHECK_GC; > + if (!JS_SetProperty(cx, vec[0], "newobj", leafValueHandle)) > + return false; Can we check the mark bits before and afterwards to assert that the pre-barrier does in fact cause this to be marked? @@ +172,5 @@ > + // additional edge from the root to it. This will not be marked by any > + // pre-barrier, but it is still in the live graph so it will eventually get > + // marked. Note that the root->leaf2 edge will *not* be marked through, > + // since the root is already marked, but that only matters if doing a > + // compacting GC and... er... the compacting GC is smart so it knows how to Compacting GC marks all the roots again after it compacts a zone, so it gets updated at that point. @@ +181,5 @@ > + return false; > + CHECK_GC; > + if (!JS_SetProperty(cx, vec[0], "leafcopy", leaf2)) > + return false; > + CHECK_GC; Ditto comment about checking mark bits. @@ +190,5 @@ > + rt->gc.debugGCSlice(unlimited); > + > + // Access the leaf object to try to trigger a crash if it is dead. > + if (!JS_SetProperty(cx, leafHandle, "toes", JS::UndefinedHandleValue)) > + return false; Can check it's marked here. Also, we could walk the graph and count objects, or walk the graph to retrieve the object at this point and check it's the same one.
Attachment #8620438 - Flags: review?(jcoppeard) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: