Bug 251111

Summary: StrongInlines.h methods should be marked as "inline" in Strong.h
Product: WebKit Reporter: Jer Noble <jer.noble>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: Hironori.Fujii, mark.lam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Jer Noble 2023-01-24 13:37:06 PST
Because they're not marked as "inline", if you include Strong.h and use Strong::Strong() or Strong::set() and _don't_ include StrongInlines.h, you will end up with a linker error, as these methods are not exported.

However, adding "inline" to these methods expose a number of build errors. Someone should do the work to mark these as "inline" and clean up all the places where these methods are used without including StrongInlines.h.
Comment 1 Jer Noble 2023-01-24 13:37:41 PST
E.g.:

OpenSource/Source/JavaScriptCore/heap/Strong.h:97:17: error: inline function 'JSC::Strong<JSC::JSObject, JSC::ShouldStrongDestructorGrabLock::No>::set' is not defined [-Werror,-Wundefined-inline]
    inline void set(VM&, ExternalType);
                ^
In file included from OpenSource/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp:31:
In file included from OpenSource/WebKitBuild/Debug/DerivedSources/JavaScriptCore/BytecodeStructs.h:31:
In file included from OpenSource/Source/JavaScriptCore/bytecode/BytecodeDumper.h:31:
In file included from OpenSource/Source/JavaScriptCore/bytecode/CallLinkInfo.h:34:
In file included from OpenSource/Source/JavaScriptCore/jit/PolymorphicCallStubRoutine.h:30:
In file included from OpenSource/Source/JavaScriptCore/bytecode/CallEdge.h:28:
In file included from OpenSource/Source/JavaScriptCore/bytecode/CallVariant.h:28:
In file included from OpenSource/Source/JavaScriptCore/runtime/ExecutableBaseInlines.h:28:
In file included from OpenSource/Source/JavaScriptCore/runtime/ExecutableBase.h:33:
OpenSource/Source/JavaScriptCore/runtime/JSGlobalObject.h:1092:99: note: used here
    void setUnhandledRejectionCallback(VM& vm, JSObject* function) { m_unhandledRejectionCallback.set(vm, function); }
Comment 2 Radar WebKit Bug Importer 2023-01-31 13:38:24 PST
<rdar://problem/104882770>
Comment 3 Mark Lam 2023-02-20 21:35:36 PST
Some methods are deliberately not marked as `inline` to avoid this dance.  The user of these methods should know to inline the Inlines.h if they actually needed the implementation of the inline function.  The alternative is an expensive exercise to move a lot of code around for little benefit.
Comment 4 Mark Lam 2023-02-20 21:36:15 PST
(In reply to Mark Lam from comment #3)
> Some methods are deliberately not marked as `inline` to avoid this dance. 
> The user of these methods should know to inline the Inlines.h if they
> actually needed the implementation of the inline function.  The alternative
> is an expensive exercise to move a lot of code around for little benefit.

"should know to inline the Inlines.h" => "should know to #include the Inlines.h"