Bug 149100 - Implement indirect calls in WebAssembly
Summary: Implement indirect calls in WebAssembly
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 146064
  Show dependency treegraph
 
Reported: 2015-09-12 21:48 PDT by Sukolsak Sakshuwong
Modified: 2015-09-16 18:23 PDT (History)
7 users (show)

See Also:


Attachments
Patch (14.75 KB, patch)
2015-09-12 21:50 PDT, Sukolsak Sakshuwong
no flags Details | Formatted Diff | Diff
Patch (15.40 KB, patch)
2015-09-12 23:12 PDT, Sukolsak Sakshuwong
no flags Details | Formatted Diff | Diff
Update to ToT and use Math.imul for multiplication (15.37 KB, patch)
2015-09-16 16:45 PDT, Sukolsak Sakshuwong
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.