diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-10-06 17:44:06 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-10-06 17:44:06 -0700 |
commit | 332325394c20bb4a3972344144803fcd93476b08 (patch) | |
tree | feddd1057f85282d2c60fd97d5a0529fa0b18048 /system/include | |
parent | c1dd12998fd862010c7c11e6fa9d003521923a3c (diff) |
make EM_ASM use strings on the heap, so it works in asm, and cache the generated functions
Diffstat (limited to 'system/include')
-rw-r--r-- | system/include/emscripten/emscripten.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/system/include/emscripten/emscripten.h b/system/include/emscripten/emscripten.h index 430fbc1c..d30620ec 100644 --- a/system/include/emscripten/emscripten.h +++ b/system/include/emscripten/emscripten.h @@ -23,10 +23,13 @@ extern "C" { * * EM_ASM(window.alert('hai')); * + * This also works with asm.js, as it outlines the code (it + * does a function call to reach it). + * * Note: double-quotes (") are not supported, but you can use * single-quotes (') in js anyhow. */ -#define EM_ASM(...) asm(#__VA_ARGS__) +#define EM_ASM(...) emscripten_asm_const(#__VA_ARGS__) /* * Forces LLVM to not dead-code-eliminate a function. Note that @@ -376,6 +379,8 @@ int emscripten_get_worker_queue_size(worker_handle worker); #define EMSCRIPTEN_NETWORK_WEBRTC 1 void emscripten_set_network_backend(int backend); +/* Internal APIs. Be careful with these. */ + /* * Profiling tools. * INIT must be called first, with the maximum identifier that @@ -413,6 +418,9 @@ void emscripten_jcache_printf(const char *format, ...); void emscripten_jcache_printf_(...); /* internal use */ #endif +/* Helper API for EM_ASM - do not call this yourself */ +void emscripten_asm_const(const char *code); + #ifdef __cplusplus } #endif |