4 ms·
Unfortunately, they didn't follow up on the scanning part. How does that work? Ok, the allocator is obviously cooperating, but how do you get from scanning piec
by choeger 5y ago
Unfortunately, they didn't follow up on the scanning part. How does that work? Ok, the allocator is obviously cooperating, but how do you get from scanning piece of C++ memory to the class of the object?
- sanxiyn 5y agoAll GC objects have GC headers prepended, from which you can lookup the class and how to scan it. https://github.com/v8/v8/blob/master/src/heap/cppgc/heap-object-header.h https://github.com/v8/v8/blob/master/src/heap/cppgc/heap-obj...
- Leszek 5y agoWhen scanning the stack, you interpret every word as a potential pointer. Then, you ask your GCs allocator "is this pointer's address in one of your pages?". If it isn't, you're done. If it is, then you check if it's the pointer to the start of an object (there's a bitmap of "is object start" for each word on the page). If this passes too, then you effectively reinterpret cast it to a "GC object" base class which is shared for all GC objects, and call the virtual "trace" function from there.
- _old_dude_ 5y agoHere is the related research paper https://duckduckgo.com/?q=Cross-Component+Garbage+Collection https://duckduckgo.com/?q=Cross-Component+Garbage+Collection