Hi Dean,

We should port embind to asm.js!  It's certainly a bit of work, but
probably not too hard.  It's really just that nobody's done the work yet.
Since IMVU, my employer, can't use asm.js until it supports a growable heap
(and perhaps closure compiler), we aren't terribly motivated to do the work.

That said, part of me just wants to bite the bullet and do the conversion
myself if I can find the time.  :)

In case someone else wants to take a crack at it, here is what I know:

There are a couple places where embind uses reinterpret_cast on function
pointers in order to pass more arguments than their prototypes specify.
For example, see
https://github.com/kripken/emscripten/blob/master/system/include/emscripten/val.h#L67

Those functions need to be converted to varargs.  (At the time, I think we
were blocked on a varargs issue with the old LLVM, but that may not be an
issue anymore.)

The other issue is that embind relies on JavaScript being able to look up
functions by indexing into FUNCTION_TABLE[x].  asm.js doesn't have a single
function table: it has a whole bunch of function tables, one for each
possible type signature.

Thus, on the C++ side, we need a way to take a C++ signature (like
float(const void*, int&)) and turn that into a string ("fii") that we can
use to select one of the function tables on the embind side.  Embind would
also need the compiler to output a table from signature to the appropriate
function table.  The compiler-generated glue would look something like:

var FUNCTION_TABLES = {
  vi: FUNCTION_TABLE_vv,
  fii: FUNCTION_TABLE_fii,
  ...
};

I *think* that if we had those two things, we could make embind work with
asm.js.

*waves hands a bit* :)

Hope that's helpful,
Chad

On Tue, Mar 4, 2014 at 2:28 PM, Dean Elhard <[email protected]> wrote:

> Since 1.13.0 is moving to the fastcomp compiler, which only supports
> asm.js, and embind doesn't work with asm.js, it seems that anyone relying
> on embind is being left behind.
>
> The issues I see on github regarding embind and asm.js are old and
> inactive, and indicate no plans to make embind work with asm.js any time
> soon.
>
> Any comment on the future of embind (if any), or what will replace it?
>
>
>  --
> 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/groups/opt_out.
>



-- 
Chad Austin
Technical Director, IMVU
http://engineering.imvu.com <http://www.imvu.com/members/Chad/>
http://chadaustin.me

-- 
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/groups/opt_out.

Reply via email to