Yeah, the parameter coercions aren't necessary for correctness for asm.js->asm.js calls, and they add some space. They do serve two purposes, though, they ensure calls from js into asm.js don't introduce non-asm.js types, and they make it easy to compile each method at a time (since parameter types are declared).
On Thu, Aug 18, 2016 at 11:56 AM, Charles Vaughn <[email protected]> wrote: > I'll dig and see if I can come up with a test case. It's a bit weird since > jla and kla demangle to the same thing, but have different mangled names: > > _ZNK3trt4core10ValueArrayIyE10GetIndicesEv > _ZThn4_NK3trt4core10ValueArrayIyE10GetIndicesEv > _ZThn12_NK3trt4core10ValueArrayIyE10GetIndicesEv > _ZNK3trt4core17PackagedArrayViewIiE9GetVectorEv > > As for the second question, that's a bit unfortunate since we do have a > pretty big long tail of functions that are relatively small and simply pass > through most or all of their arguments. As far as I can tell, that would be > correct execution wise though. > > On Thursday, August 18, 2016 at 11:36:14 AM UTC-7, Alon Zakai wrote: >> >> Yes to both questions. >> >> This is probably a case of something in LLVM where the LLVM optimizer >> can't access it, and so it relies on optimizations at later stages, where >> the asm.js backend does its own thing. So this is something we should be >> optimizing in the asm.js optimizer, but somehow aren't. >> >> If you don't intend to take a look at this yourself, I'd like to, a small >> testcase showing the issue would be great. >> >> On Thu, Aug 18, 2016 at 11:31 AM, Charles Vaughn <[email protected]> >> wrote: >> >>> Interesting code generated I found while investigating some size >>> optimizations: >>> >>> function ila(a,b){a=a|0;b=b|0;mha(a,b+88|0);return} >>> function jla(a,b){a=a|0;b=b|0;mha(a,b+-4+88|0);return} >>> function kla(a,b){a=a|0;b=b|0;mha(a,b+-12+88|0);return} >>> >>> From the context, these are different levels of vtable indirection (the >>> last 2 are non virtual thunks). Is this: >>> >>> function ila(a,b){a=a|0;b=b|0;mha(a,b+88|0);return} >>> function jla(a,b){a=a|0;b=b|0;mha(a,b+84|0);return} >>> function kla(a,b){a=a|0;b=b|0;mha(a,b+76|0);return} >>> >>> equivalent? >>> >>> I also take that the a=a|0;b=b|0 is mandatory to validate as asm.js, and >>> >>> function ila(a,b){mha(a|0,b|0+88|0);return} >>> function jla(a,b){mha(a|0,b|0+84|0);return} >>> function kla(a,b){mha(a|0,b|0+76|0);return} >>> >>> would not validate? >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "emscripten-discuss" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
