Closed Bug 1853305 Opened 3 years ago Closed 3 years ago

Switch to allocating in the tenured heap if necessary while creating property iterators

Categories

(Core :: JavaScript: GC, task)

task

Tracking

()

RESOLVED FIXED
119 Branch
Tracking Status
firefox119 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Bug 1852233 is another example where a large data structure is initially allocated in the nursery but is always moved to the tenured heap because its size exceeds that of the nursery.

This case is exacerbated because the entire data structure is traced on every minor GC because it's a stack root.

We can solve this the same way as for JSON parsing and structured clone deserialization by switching to allocating in the tenured heap if we trigger nursery collection while allocating.

This class observes nursery collections and encasuplates the logic of switching
heap after a specified number of collections occur.

This replaces the current logic with use of the new class.

I had to change some of the JSONParser construction because I got warnings
about RAII classes being used as temporaries. This should construct the parser
directly in the Rooted now rather than copying it.

Depends on D188333

See Also: → 1848090, 1713022, 1708779
Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7d3f89343255 Part 1: Add AutoSelectGCHeap and use it when creating property iterators r=sfink https://hg.mozilla.org/integration/autoland/rev/c7d89c1800c0 Part 2: Use AutoSelectGCHeap in JSON parsing r=sfink https://hg.mozilla.org/integration/autoland/rev/1d1e7c3dd113 Part 3: Use AutoSelectGCHeap for structured clone deserialization r=sfink

Backed out for causing hazard build bustages.

[task 2023-09-18T09:00:37.466Z] gmake[4]: Entering directory '/builds/worker/checkouts/gecko/obj-analyzed-js/js/src/build'
[task 2023-09-18T09:00:37.466Z] /builds/worker/fetches/sixgill/usr/libexec/sixgill/scripts/wrap_gcc/basecc /builds/worker/fetches/gcc/bin/g++ --sysroot /builds/worker/fetches/sysroot-x86_64-linux-gnu -std=gnu++17 -isystem /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/include/c++/8 -isystem /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/include/x86_64-linux-gnu/c++/8 -isystem /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/include/x86_64-linux-gnu -isystem /builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -Wno-attributes -Wno-ignored-attributes -fno-sized-deallocation -fno-aligned-new -Wno-attributes -Wno-ignored-attributes -fPIC -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -gdwarf-4 -freorder-blocks -O3 -fno-omit-frame-pointer -funwind-tables -Werror -shared -Wl,-z,defs -Wl,--gc-sections -Wl,-h,libmozjs-119a1.so -o libmozjs-119a1.so /builds/worker/checkouts/gecko/obj-analyzed-js/js/src/build/libmozjs-119a1_so.list    -lpthread -Wl,-rpath-link,/builds/worker/fetches/sysroot-x86_64-linux-gnu/lib/x86_64-linux-gnu -L/builds/worker/fetches/sysroot-x86_64-linux-gnu/lib/x86_64-linux-gnu -Wl,-rpath-link,/builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/x86_64-linux-gnu -L/builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/x86_64-linux-gnu -L/builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/gcc/x86_64-linux-gnu/8 -Wl,-z,noexecstack -Wl,-z,text -Wl,-z,relro -Wl,-z,nocopyreloc -Wl,-Bsymbolic-functions -Wl,--build-id=sha1 -fstack-protector-strong -Wl,-rpath-link,/builds/worker/checkouts/gecko/obj-analyzed-js/dist/bin -Wl,-rpath-link,/usr/local/lib  ../../../build/pure_virtual/libpure_virtual.a /builds/worker/checkouts/gecko/obj-analyzed-js/x86_64-unknown-linux-gnu/debug/libjsrust.a ../../../config/external/nspr/pr/libnspr4.so ../../../config/external/nspr/libc/libplc4.so ../../../config/external/nspr/ds/libplds4.so -Wl,--version-script,symverscript  -lm -ldl  -L/builds/worker/fetches/sysroot-x86_64-linux-gnu/usr/lib/x86_64-linux-gnu -lz -lm -ldl
[task 2023-09-18T09:00:37.466Z] /usr/bin/ld: /builds/worker/checkouts/gecko/obj-analyzed-js/js/src/build/../Unified_cpp_js_src1.o: in function `js::IdToString(JSContext*, JS::PropertyKey, js::gc::Heap) [clone .constprop.0]':
[task 2023-09-18T09:00:37.466Z] /builds/worker/checkouts/gecko/js/src/vm/JSAtomUtils-inl.h:125: undefined reference to `JSLinearString* js::Int32ToStringWithHeap<(js::AllowGC)1>(JSContext*, int, js::gc::Heap)'
[task 2023-09-18T09:00:37.466Z] /usr/bin/ld: /builds/worker/checkouts/gecko/obj-analyzed-js/js/src/build/../Unified_cpp_js_src16.o: in function `js::IdToString(JSContext*, JS::PropertyKey, js::gc::Heap)':
[task 2023-09-18T09:00:37.466Z] /builds/worker/checkouts/gecko/js/src/vm/JSAtomUtils-inl.h:125: undefined reference to `JSLinearString* js::Int32ToStringWithHeap<(js::AllowGC)1>(JSContext*, int, js::gc::Heap)'
[task 2023-09-18T09:00:37.467Z] /usr/bin/ld: /builds/worker/checkouts/gecko/obj-analyzed-js/js/src/build/../Unified_cpp_js_src16.o: in function `js::NativeIterator::NativeIterator(JSContext*, JS::Handle<js::PropertyIteratorObject*>, JS::Handle<JSObject*>, JS::Handle<JS::StackGCVector<JS::PropertyKey, js::TempAllocPolicy> >, bool, mozilla::Vector<js::PropertyIndex, 8ul, js::TempAllocPolicy>*, unsigned int, bool*)':
[task 2023-09-18T09:00:37.467Z] /builds/worker/checkouts/gecko/js/src/vm/JSAtomUtils-inl.h:125: undefined reference to `JSLinearString* js::Int32ToStringWithHeap<(js::AllowGC)1>(JSContext*, int, js::gc::Heap)'
[task 2023-09-18T09:00:37.467Z] collect2: error: ld returned 1 exit status
[task 2023-09-18T09:00:37.467Z] gmake[4]: *** [/builds/worker/checkouts/gecko/config/rules.mk:526: libmozjs-119a1.so] Error 1
[task 2023-09-18T09:00:37.467Z] gmake[4]: Leaving directory '/builds/worker/checkouts/gecko/obj-analyzed-js/js/src/build'
[task 2023-09-18T09:00:37.467Z] gmake[4]: Target 'target' not remade because of errors.
[task 2023-09-18T09:00:37.467Z] gmake[4]: Target 'target' not remade because of errors.
[task 2023-09-18T09:00:37.467Z] gmake[3]: *** [/builds/worker/checkouts/gecko/config/recurse.mk:72: js/src/build/target] Error 2
[task 2023-09-18T09:00:37.467Z] gmake[3]: Target 'recurse_compile' not remade because of errors.
[task 2023-09-18T09:00:37.467Z] gmake[2]: *** [/builds/worker/checkouts/gecko/config/recurse.mk:34: compile] Error 2
[task 2023-09-18T09:00:37.467Z] gmake[1]: *** [/builds/worker/checkouts/gecko/config/rules.mk:361: default] Error 2
[task 2023-09-18T09:00:37.467Z] gmake: *** [client.mk:60: build] Error 2
[task 2023-09-18T09:00:37.468Z] 142 compiler warnings present.
[task 2023-09-18T09:00:37.576Z] Collected 1283 objects
<...>
Flags: needinfo?(jcoppeard)

Fixed missing template instantiations.

Flags: needinfo?(jcoppeard)
Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/24f18107c5e3 Part 1: Add AutoSelectGCHeap and use it when creating property iterators r=sfink https://hg.mozilla.org/integration/autoland/rev/fc85a9485499 Part 2: Use AutoSelectGCHeap in JSON parsing r=sfink https://hg.mozilla.org/integration/autoland/rev/a1a185be5df0 Part 3: Use AutoSelectGCHeap for structured clone deserialization r=sfink
Blocks: 1848595
See Also: → 1968172
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: