Closed Bug 1485615 Opened Last year Closed Last year

Move internal ZoneAllocPolicy to gc/Zone.h

Categories

(Core :: JavaScript: GC, defect)

61 Branch
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(2 files)

I keep hitting compilation errors about inline ZoneAllocPoicy methods not being defined in non-unified builds, e.g.:

[task 2018-08-21T15:44:16.721Z] In file included from /builds/worker/workspace/build/src/js/src/jsapi.h:27:0,
[task 2018-08-21T15:44:16.721Z]                  from /builds/worker/workspace/build/src/js/src/shell/jsshell.h:15,
[task 2018-08-21T15:44:16.721Z]                  from /builds/worker/workspace/build/src/js/src/shell/jsshell.cpp:9:
[task 2018-08-21T15:44:16.721Z] /builds/worker/workspace/build/src/obj-spider/dist/include/js/AllocPolicy.h:153:37: error: inline function 'T* js::ZoneAllocPolicy::pod_malloc(size_t) [with T = mozilla::detail::HashTableEntry<mozilla::HashMapEntry<js::HeapPtr<JSObject*>, js::HeapPtr<JS::Value> > >; size_t = long unsigned int]' used but never defined [-Werror]
[task 2018-08-21T15:44:16.721Z]      template <typename T> inline T* pod_malloc(size_t numElems);
[task 2018-08-21T15:44:16.721Z]                                      ^~~~~~~~~~
[task 2018-08-21T15:44:16.721Z] /builds/worker/workspace/build/src/obj-spider/dist/include/js/AllocPolicy.h:150:37: error: inline function 'T* js::ZoneAllocPolicy::maybe_pod_malloc(size_t) [with T = mozilla::detail::HashTableEntry<mozilla::HashMapEntry<js::HeapPtr<JSObject*>, js::HeapPtr<JS::Value> > >; size_t = long unsigned int]' used but never defined [-Werror]
[task 2018-08-21T15:44:16.721Z]      template <typename T> inline T* maybe_pod_malloc(size_t numElems);
[task 2018-08-21T15:44:16.721Z]                                      ^~~~~~~~~~~~~~~~

I think the problem is that ZoneAllocPolicy is defined in public/AllocPolicy.h (despite being internal) and it's too easy for clients of this to not include gc/Zone.h where its methods are defined.  The reason it's not defined in Zone.h already is that RegExpShared.h needs it to define RegExpZone, which Zone depends on.  So there's a cyclic dependency.

I'm going to try and break this by removing the Zone -> RegExpZone dependency by making RegExpZone a separate allocation.  Then we can move ZoneAllocPolicy to Zone.h where it belongs.
Make Zone::regExpZone a separate allocation and remove the Zone.h -> RegExpShared.h dependency.
Attachment #9003423 - Flags: review?(sphink)
Move definition of ZoneAllocPolicy to Zone.h.
Attachment #9003425 - Flags: review?(sphink)
Attachment #9003423 - Flags: review?(sphink) → review+
Attachment #9003425 - Flags: review?(sphink) → review+
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c70943a6b070
Make RegExpZone a separate allocation to Zone r=sfink
https://hg.mozilla.org/integration/mozilla-inbound/rev/40001671f508
Move internal ZoneAllocPolicy to gc/Zone.h r=sfink
https://hg.mozilla.org/mozilla-central/rev/c70943a6b070
https://hg.mozilla.org/mozilla-central/rev/40001671f508
Status: NEW → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Depends on: 1486197
You need to log in before you can comment on or make changes to this bug.