[Webkit-unassigned] [Bug 170390] WebAssembly: several tests added in r214504 crash when building with GCC

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 3 11:42:36 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=170390

--- Comment #14 from Saam Barati <sbarati at apple.com> ---
(In reply to Carlos Garcia Campos from comment #12)
> (In reply to Saam Barati from comment #9)
> > Comment on attachment 306063 [details]
> > Updated patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=306063&action=review
> > 
> > >>>> Source/JavaScriptCore/wasm/js/WebAssemblyPrototype.cpp:94
> > >>>> +        p.vm().promiseDeferredTimer->scheduleWorkSoon(promise, [source, promise, globalObject, plan = makeRefPtr(p)] () mutable {
> > >>> 
> > >>> Why not plan=WTFMove(plan)?
> > >> 
> > >> Because I've removed the line that created the plan to simplify it. 
> > >> 
> > >> RefPtr<Plan> plan = makeRef(p);
> > >> [plan = WTFMove(plan)]
> > >> 
> > >> is equivalent to 
> > >> 
> > >> [plan = makeRefPtr(p)]
> > >> 
> > >> I think this way is simpler, since we were only creating the plan to transfer it to the lambda capture (and to get the vm, but that is what caused the crash).
> > > 
> > > Gotcha. I see what's going on.
> > > I still think you need a local variable for the plan, otherwise, won't the lambda capture the outermost plan? I think that'll lead to a reference cycle.
> > > Even if that assignment doesn't cause this to happen, I think it's harder to reason about than just having a local variable.
> > 
> > Seems like you could also keep the code as is, and just use p.vm() instead
> > of plan->vm().
> 
> Yes, that's my first patch see comment #1
I like your first patch. I'm not sure what the semantics are here of your capture of plan, since you don't define another variable named "plan". Anyways, I'm worried about a reference cycle, which is why I like an explicit local variable. See the comment in WasmPlan.h.
> 
> > Also, I'm not sure why we make a RefPtr instead of a Ref here.
> 
> I think it's because then we end up doing Ref<> foo = Ref(); and Ref(const
> Ref& other) is deleted.
Why not just do:
Ref<Plan> plan(p);
?

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20170403/2cbd0462/attachment.html>


More information about the webkit-unassigned mailing list