Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGC zeal completely breaks Servo, it seems #25701
Comments
|
It doesn't explain anything in particular, but be aware that the zeal level is not actully a scale of least-zealous to most-zealous (0..14). It's actually a list of modes that all have different meanings: https://searchfox.org/mozilla-central/source/js/src/gc/GCEnum.h#61-83 Typically to have the most zealous GC behaviour we would use level 2 (GC after a certain number of allocations) and set the frequency to a number like 1 (GC after each allocation). |
|
rr shows that the value of the JSObject is changed between define_guarded_properties and define_guarded_methods in , indicating that a GC occurred in a way that did not end up updating the reflector pointer stored in the DOM window reflector slot. |
|
Fascinating. I'll try to fix this and maybe my smup issues will magically go away. |
|
AFAICT, we don't enter the newly created global's realm before we do stuff with it. https://searchfox.org/mozilla-central/source/dom/bindings/BindingUtils.h#2875 |
|
We do in , but maybe you're talking about instead? |
|
This is the stack showing a GC occurring that changes the new window reflector object pointer:
I'll ask the SM folks who sit next to me to tell me more about compaction GCs and how those are expected to interact with GC pointers reachable from the rooting stack via Heap objects (which is what the Window reflector reachable from the DOM object via a stack root is). |
|
For reference, once I realized that the pointer stored in the Window object was not the same as the pointer stored in the stack root at the end of Window::Wrap, all I needed to do was do |
|
I figured out what's going on. There are a few subtleties:
This means that any time we have a DOM object which is only reachable from JS roots, any GCs that occur will encounter its Reflector and silently ignore it, leading to GC hazards like this one. Any time that DOM object is reachable from a |
|
When I move the DomRoot to right after create_global_object, the unexpected behaviour goes away and we start hitting zeal hazards that #24069 fixes. |
|
Very nice, I’ll make a patch and see if it helps the smup.
|
I rebuilt Servo with the following diff:
When running Servo without GC zeal, things just work; but when setting
js.mem.gc.zeal.levelto 14, this happens:AFAIK, this is extremely wrong.