Consider adding a const version of HeapPtr
Categories
(Core :: JavaScript: GC, enhancement, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox72 | --- | fixed |
People
(Reporter: jonco, Assigned: jonco, NeedInfo)
Details
Attachments
(3 files)
It would be nice to have a version of HeapPtr that can't be changed to point to a different target. This would allow developers to document and enforce immutability of class members where appropriate.
The internal pointer will still need to be mutable in case the GC needs to update it, but the wrapper class could disallow mutation but not providing operator=, set methods, etc.
| Assignee | ||
Comment 1•6 years ago
|
||
It occurred to me that we should make it possible to use | const HeapPtr<T> | for this.
| Assignee | ||
Comment 2•6 years ago
|
||
The main change is to make BarrieredBase::unsafeUnbarrieredForTracing() const and use const_cast to get return the non-const pointer. This makes sense because the GC is allowed to update the pointer used while preseving the logical value of the cell, e.g. when compacting.
| Assignee | ||
Comment 3•6 years ago
|
||
This replaces GCPtr members with const GCPtr where trival to do so.
Depends on D50618
| Assignee | ||
Comment 4•6 years ago
|
||
This makes HeapPtr members const where it was easy to do so. Flagging jimb for review since most of these were in the debugger.
Updated•6 years ago
|
Comment 7•6 years ago
|
||
Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=273872477&repo=autoland
Backout link: https://hg.mozilla.org/integration/autoland/rev/3851d4bcbd9d
[task 2019-10-31T11:23:18.613Z] + NUM_WRITE_HAZARDS=0
[task 2019-10-31T11:23:18.613Z] ++ grep -c '^Function.expected hazard.but none were found' /builds/worker/workspace/analysis/rootingHazards.txt
[task 2019-10-31T11:23:18.614Z] + NUM_MISSING=0
[task 2019-10-31T11:23:18.614Z] + set +x
[task 2019-10-31T11:23:18.614Z] TinderboxPrint: rooting hazards<br/>18
[task 2019-10-31T11:23:18.614Z] TinderboxPrint: (unsafe references to unrooted GC pointers)<br/>82
[task 2019-10-31T11:23:18.614Z] TinderboxPrint: (unnecessary roots)<br/>1022
[task 2019-10-31T11:23:18.614Z] TinderboxPrint: missing expected hazards<br/>0
[task 2019-10-31T11:23:18.614Z] TinderboxPrint: heap write hazards<br/>0
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<JS::Heap<JSObject>, JSObject>, JS::DeletePolicy<TestStruct<JS::Heap<JSObject*>, JSObject*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:131
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<const JS::Heap<JSObject*>, JSObject*>, JS::DeletePolicy<TestStruct<const JS::Heap<JSObject*>, JSObject*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:131
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<JS::Heap<JSObject*>, JSObject*>, JS::DeletePolicy<TestStruct<JS::Heap<JSObject*>, JSObject*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:163
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<js::GCPtr<JSObject*>, JSObject*>, JS::DeletePolicy<TestStruct<js::GCPtr<JSObject*>, JSObject*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:131
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<const js::GCPtr<JSObject*>, JSObject*>, JS::DeletePolicy<TestStruct<const js::GCPtr<JSObject*>, JSObject*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:131
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<js::GCPtr<JSObject*>, JSObject*>, JS::DeletePolicy<TestStruct<js::GCPtr<JSObject*>, JSObject*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:163
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<js::HeapPtr<JSObject*>, JSObject*>, JS::DeletePolicy<TestStruct<js::HeapPtr<JSObject*>, JSObject*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:131
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<const js::HeapPtr<JSObject*>, JSObject*>, JS::DeletePolicy<TestStruct<const js::HeapPtr<JSObject*>, JSObject*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:131
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<js::HeapPtr<JSObject*>, JSObject*>, JS::DeletePolicy<TestStruct<js::HeapPtr<JSObject*>, JSObject*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:163
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<JS::Heap<JSFunction*>, JSFunction*>, JS::DeletePolicy<TestStruct<JS::Heap<JSFunction*>, JSFunction*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:131
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<const JS::Heap<JSFunction*>, JSFunction*>, JS::DeletePolicy<TestStruct<const JS::Heap<JSFunction*>, JSFunction*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:131
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<JS::Heap<JSFunction*>, JSFunction*>, JS::DeletePolicy<TestStruct<JS::Heap<JSFunction*>, JSFunction*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:163
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<js::GCPtr<JSFunction*>, JSFunction*>, JS::DeletePolicy<TestStruct<js::GCPtr<JSFunction*>, JSFunction*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:131
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<const js::GCPtr<JSFunction*>, JSFunction*>, JS::DeletePolicy<TestStruct<const js::GCPtr<JSFunction*>, JSFunction*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:131
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<js::GCPtr<JSFunction*>, JSFunction*>, JS::DeletePolicy<TestStruct<js::GCPtr<JSFunction*>, JSFunction*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:163
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<js::HeapPtr<JSFunction*>, JSFunction*>, JS::DeletePolicy<TestStruct<js::HeapPtr<JSFunction*>, JSFunction*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:131
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<const js::HeapPtr<JSFunction*>, JSFunction*>, JS::DeletePolicy<TestStruct<const js::HeapPtr<JSFunction*>, JSFunction*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:131
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | unrooted 'testStruct' of type 'mozilla::UniquePtr<TestStruct<js::HeapPtr<JSFunction*>, JSFunction*>, JS::DeletePolicy<TestStruct<js::HeapPtr<JSFunction*>, JSFunction*> > >' live across GC call at js/src/jsapi-tests/testGCHeapPostBarriers.cpp:163
[task 2019-10-31T11:23:18.616Z] TEST-UNEXPECTED-FAIL | hazards | 18 rooting hazards detected
[task 2019-10-31T11:23:18.616Z] TinderboxPrint: documentation<br/><a href='https://wiki.mozilla.org/Javascript:Hazard_Builds#Diagnosing_a_rooting_hazards_failure'>static rooting hazard analysis failures</a>, visit "Inspect Task" link for hazard details
[task 2019-10-31T11:23:18.616Z] + onexit
[task 2019-10-31T11:23:18.616Z] + grab_artifacts /builds/worker/workspace/analysis /builds/worker/artifacts
[task 2019-10-31T11:23:18.616Z] + local analysis_dir
[task 2019-10-31T11:23:18.616Z] + analysis_dir=/builds/worker/workspace/analysis
[task 2019-10-31T11:23:18.616Z] + local artifacts
[task 2019-10-31T11:23:18.616Z] + artifacts=/builds/worker/artifacts
[task 2019-10-31T11:23:18.617Z] + cd /builds/worker/workspace/analysis
[task 2019-10-31T11:23:18.617Z] + ls -lah
| Assignee | ||
Comment 8•6 years ago
|
||
(In reply to Cosmin Sabou [:CosminS] from comment #7)
I'm not sure why the analysis now detects the hazard here; it's just as much of a hazard as it was before I think?
I'm going to suppress the analysis for these functions because we actually don't want our tests structure to be rooted here. I suppose a more correct approach would be to have it reachable only via a tenured GC thing but I think that's overkill for this test.
Comment 10•6 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/cfb65a5e10c0
https://hg.mozilla.org/mozilla-central/rev/789495222976
https://hg.mozilla.org/mozilla-central/rev/ea95af453bab
Updated•6 years ago
|
Description
•