diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-04-30 13:40:27 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-04-30 13:40:27 -0700 |
commit | 9dd3a7059749d4051202687817bf6b68ab2ce54c (patch) | |
tree | 6f98400f4bb90aedd7ea419163febb1d70c488fd | |
parent | 63f913cc533e20cea584d2407de78c933d063b67 (diff) | |
parent | 7da733906454466f4ae22d1a1541ea152f5025db (diff) |
Merge pull request #2327 from chadaustin/embind-asmjs-precise-f32
Fix embind/asm.js in PRECISE_F32 mode
-rw-r--r-- | src/embind/embind.js | 11 | ||||
-rw-r--r-- | system/include/emscripten/bind.h | 2 | ||||
-rw-r--r-- | tests/test_core.py | 1 |
3 files changed, 10 insertions, 4 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js index bb979365..3eadb85f 100644 --- a/src/embind/embind.js +++ b/src/embind/embind.js @@ -723,9 +723,16 @@ function requireFunction(signature, rawFunction) { // possibly allocate. var dc = asm['dynCall_' + signature]; if (dc === undefined) { - throwBindingError("No dynCall invoker for signature: " + signature); + // We will always enter this branch if the signature + // contains 'f' and PRECISE_F32 is not enabled. + // + // Try again, replacing 'f' with 'd'. + dc = asm['dynCall_' + signature.replace(/f/g, 'd')]; + if (dc === undefined) { + throwBindingError("No dynCall invoker for signature: " + signature); + } } - fp = asm['dynCall_' + signature].bind(undefined, rawFunction); + fp = dc.bind(undefined, rawFunction); } else { fp = FUNCTION_TABLE[rawFunction]; } diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h index 699e834b..eede0755 100644 --- a/system/include/emscripten/bind.h +++ b/system/include/emscripten/bind.h @@ -330,7 +330,7 @@ namespace emscripten { template<> struct SignatureCode<float> { static constexpr char get() { - return 'd'; + return 'f'; } }; diff --git a/tests/test_core.py b/tests/test_core.py index 4c19afda..379559e7 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -5659,7 +5659,6 @@ def process(filename): def test_embind_2(self): if self.emcc_args is None: return self.skip('requires emcc') - if self.run_name == 'asm2f': return self.skip('embind/asm.js not compatible with PRECISE_F32 because it changes signature strings') if self.run_name == 'slow2asm': return self.skip('embind/asm.js requires fastcomp') Building.COMPILER_TEST_OPTS += ['--bind', '--post-js', 'post.js'] open('post.js', 'w').write(''' |