Bug 227271 - Run lazy properties initializers under a DeferTerminationForAWhile scope
Summary: Run lazy properties initializers under a DeferTerminationForAWhile scope
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-06-22 14:49 PDT by Saam Barati
Modified: 2021-06-23 08:21 PDT (History)
7 users (show)

See Also:


Attachments
patch (2.76 KB, patch)
2021-06-22 15:07 PDT, Saam Barati
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2021-06-22 14:49:04 PDT
...
Comment 1 Saam Barati 2021-06-22 15:07:25 PDT
Created attachment 431999 [details]
patch
Comment 2 Mark Lam 2021-06-22 15:12:30 PDT
Comment on attachment 431999 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431999&action=review

r=me with fix.

> Source/JavaScriptCore/runtime/LazyPropertyInlines.h:52
> +    static const FuncType theFunc = &callFunc<Func>;
>      m_pointer = lazyTag | bitwise_cast<uintptr_t>(&theFunc);

This looks wrong.  Note use of `bitwise_cast<uintptr_t>(&theFunc)`.
Comment 3 Mark Lam 2021-06-22 15:32:37 PDT
(In reply to Mark Lam from comment #2)
> Comment on attachment 431999 [details]
> > Source/JavaScriptCore/runtime/LazyPropertyInlines.h:52
> > +    static const FuncType theFunc = &callFunc<Func>;
> >      m_pointer = lazyTag | bitwise_cast<uintptr_t>(&theFunc);
> 
> This looks wrong.  Note use of `bitwise_cast<uintptr_t>(&theFunc)`.

I was wrong.  The `&` in `bitwise_cast<uintptr_t>(&theFunc)` is deliberate and needed.  Saam's addition of `&` before `callFunc<Func>` doesn't matter (at least in C).  I'm not sure about C++.  If it builds, it is good.
Comment 4 Yusuke Suzuki 2021-06-22 16:49:00 PDT
Comment on attachment 431999 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=431999&action=review

>>> Source/JavaScriptCore/runtime/LazyPropertyInlines.h:52
>>>      m_pointer = lazyTag | bitwise_cast<uintptr_t>(&theFunc);
>> 
>> This looks wrong.  Note use of `bitwise_cast<uintptr_t>(&theFunc)`.
> 
> I was wrong.  The `&` in `bitwise_cast<uintptr_t>(&theFunc)` is deliberate and needed.  Saam's addition of `&` before `callFunc<Func>` doesn't matter (at least in C).  I'm not sure about C++.  If it builds, it is good.

Either adding & or not does not matter here. `callFunc<Func>` is function-type. But it is implicitly decayed to function-pointer-type when assigning it to theFunc. So, `&` in `static const FuncType theFunc = &callFunc<Func>;` does not matter. The same thing will happen.
Comment 5 EWS 2021-06-23 08:20:22 PDT
Committed r279167 (239064@main): <https://commits.webkit.org/239064@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 431999 [details].
Comment 6 Radar WebKit Bug Importer 2021-06-23 08:21:48 PDT
<rdar://problem/79666737>