Bug 149100

Summary: Implement indirect calls in WebAssembly
Product: WebKit Reporter: Sukolsak Sakshuwong <sukolsak>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, fpizlo, ggaren, mark.lam, sbarati, sukolsak, ysuzuki
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 146064    
Attachments:
Description Flags
Patch
none
Patch
none
Update to ToT and use Math.imul for multiplication none

Description Sukolsak Sakshuwong 2015-09-12 21:48:21 PDT
Implement indirect calls in WebAssembly
Comment 1 Sukolsak Sakshuwong 2015-09-12 21:50:38 PDT
Created attachment 261073 [details]
Patch
Comment 2 Sukolsak Sakshuwong 2015-09-12 23:12:26 PDT
Created attachment 261077 [details]
Patch
Comment 3 Geoffrey Garen 2015-09-16 11:18:38 PDT
Comment on attachment 261077 [details]
Patch

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

r=me

> Source/JavaScriptCore/wasm/WASMFunctionCompiler.h:610
> +
> +        const Vector<JSFunction*>& functions = m_module->functionPointerTables()[functionPointerTableIndex].functions;
> +        move(TrustedImmPtr(functions.data()), GPRInfo::regT0);
> +        load32(temporaryAddress(m_tempStackTop - 1), GPRInfo::regT1);
> +        m_tempStackTop--;

Can you guarantee that the vector will never resize (and thus never change its data pointer)?
Comment 4 Sukolsak Sakshuwong 2015-09-16 14:28:34 PDT
Thanks for the review.

(In reply to comment #3)
> Comment on attachment 261077 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=261077&action=review
> 
> r=me
> 
> > Source/JavaScriptCore/wasm/WASMFunctionCompiler.h:610
> > +
> > +        const Vector<JSFunction*>& functions = m_module->functionPointerTables()[functionPointerTableIndex].functions;
> > +        move(TrustedImmPtr(functions.data()), GPRInfo::regT0);
> > +        load32(temporaryAddress(m_tempStackTop - 1), GPRInfo::regT1);
> > +        m_tempStackTop--;
> 
> Can you guarantee that the vector will never resize (and thus never change
> its data pointer)?

WASM source is parsed in two passes. The first pass is for syntax checking and initializing some data. The second pass is for code generation. The vector only resizes in the first pass. It will never resize after that.

The vector only resizes when we load the WASM module and parse the function pointer tables. It will never resize after that.
Comment 5 Sukolsak Sakshuwong 2015-09-16 14:30:57 PDT
Oops, please ignore the second paragraph. I rephrased it and forgot to remove it.
Comment 6 Sukolsak Sakshuwong 2015-09-16 16:45:14 PDT
Created attachment 261337 [details]
Update to ToT and use Math.imul for multiplication
Comment 7 Geoffrey Garen 2015-09-16 17:35:05 PDT
Comment on attachment 261337 [details]
Update to ToT and use Math.imul for multiplication

r=me
Comment 8 WebKit Commit Bot 2015-09-16 18:23:36 PDT
Comment on attachment 261337 [details]
Update to ToT and use Math.imul for multiplication

Clearing flags on attachment: 261337

Committed r189892: <http://trac.webkit.org/changeset/189892>
Comment 9 WebKit Commit Bot 2015-09-16 18:23:40 PDT
All reviewed patches have been landed.  Closing bug.