asm-js / validator

A reference validator for asm.js.
Apache License 2.0
1.78k stars 148 forks source link

function pointers #4

Closed dherman closed 10 years ago

dherman commented 11 years ago

Add support for function pointers.

chadaustin commented 11 years ago

There are several asm.js demos, so clearly function pointers work, but the spec doesn't mention them. So how do they work? :)

kripken commented 11 years ago

Just like function pointers in emscripten in general - function pointers are indexes into a table of functions. There is a separate table for each function type though, mandated by asm.

chadaustin commented 11 years ago

For each function type? Wow, why is that? That might make embind trickier.

Can you point me to where this is in the spec?

Sent from my iPhone

On Mar 25, 2013, at 3:29 PM, Alon Zakai notifications@github.com wrote:

Just like function pointers in emscripten in general - function pointers are indexes into a table of functions. There is a separate table for each function type though, mandated by asm.

— Reply to this email directly or view it on GitHub.

chadaustin commented 11 years ago

Hm, I think I understand why it's necessary to segregate function tables now. Indeed, this will make embind tricky, but I'll reach out directly when it's time to bring embind to asm.js.

Sent from my iPhone

On Mar 25, 2013, at 3:44 PM, Chad Austin chad@imvu.com wrote:

For each function type? Wow, why is that? That might make embind trickier.

Can you point me to where this is in the spec?

Sent from my iPhone

On Mar 25, 2013, at 3:29 PM, Alon Zakai notifications@github.com wrote:

Just like function pointers in emscripten in general - function pointers are indexes into a table of functions. There is a separate table for each function type though, mandated by asm.

— Reply to this email directly or view it on GitHub.

ghost commented 10 years ago

This is in the spec now.

rntz commented 9 years ago

I've just looked at the asm.js spec at http://asmjs.org/spec/latest/#value-types , and there is no provision for function pointers as values. Why was this closed?

sunfishcode commented 9 years ago

What was added was support for function tables:

http://asmjs.org/spec/latest/#function-table-types

Function tables and indices thereinto can provide function-pointer functionality.