Summary: | Objective-C API external object graphs don't handle generational collection properly | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Mark Hahnenberg <mhahnenberg> | ||||||||||
Component: | JavaScriptCore | Assignee: | Mark Hahnenberg <mhahnenberg> | ||||||||||
Status: | RESOLVED FIXED | ||||||||||||
Severity: | Normal | CC: | commit-queue, webkit-bug-importer | ||||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||||
Version: | 528+ (Nightly build) | ||||||||||||
Hardware: | Unspecified | ||||||||||||
OS: | Unspecified | ||||||||||||
Bug Depends on: | |||||||||||||
Bug Blocks: | 121074 | ||||||||||||
Attachments: |
|
Description
Mark Hahnenberg
2014-04-14 14:47:27 PDT
The fix is to record new pointers from old owners to new owned objects and to rescan those "remembered" owners with scanExternalObject graph during EdenCollections. Created attachment 229380 [details]
Patch
Created attachment 229381 [details]
Patch
Created attachment 229383 [details]
Patch
Created attachment 229385 [details]
Patch
Comment on attachment 229385 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=229385&action=review r=me > Source/JavaScriptCore/API/JSVirtualMachine.mm:162 > + [m_externalRememberedSet setObject:[NSNumber numberWithBool:true] forKey:object]; You might be able to use NSSet here with something similar to weakIDOptions. > Source/JavaScriptCore/API/JSVirtualMachine.mm:293 > + JSVirtualMachine *virtualMachine = [JSVMWrapperCache wrapperForJSContextGroupRef:toRef(&vm)]; > + if (!virtualMachine) > + return; Is it possible that the JSVirtualMachine will go away, by virtue of a zero retain count? If so, we'll forget all the external object graph stuff. Probably worth a follow-up bug. (In reply to comment #7) > (From update of attachment 229385 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=229385&action=review > > r=me > > > Source/JavaScriptCore/API/JSVirtualMachine.mm:162 > > + [m_externalRememberedSet setObject:[NSNumber numberWithBool:true] forKey:object]; > > You might be able to use NSSet here with something similar to weakIDOptions. Looks like it's nontrivial to get NSSet to do weak references, so I guess I'll stick with NSMapTable for now. > > > Source/JavaScriptCore/API/JSVirtualMachine.mm:293 > > + JSVirtualMachine *virtualMachine = [JSVMWrapperCache wrapperForJSContextGroupRef:toRef(&vm)]; > > + if (!virtualMachine) > > + return; > > Is it possible that the JSVirtualMachine will go away, by virtue of a zero retain count? If so, we'll forget all the external object graph stuff. Probably worth a follow-up bug. I filed bug 131691 for this. Comment on attachment 229385 [details] Patch Clearing flags on attachment: 229385 Committed r167326: <http://trac.webkit.org/changeset/167326> All reviewed patches have been landed. Closing bug. |