From 7da733906454466f4ae22d1a1541ea152f5025db Mon Sep 17 00:00:00 2001 From: Chad Austin Date: Tue, 29 Apr 2014 22:09:13 -0700 Subject: fix embind/asm.js in PRECISE_F32 mode --- src/embind/embind.js | 11 +++++++++-- system/include/emscripten/bind.h | 2 +- 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 { static constexpr char get() { - return 'd'; + return 'f'; } }; diff --git a/tests/test_core.py b/tests/test_core.py index d25a61be..1f698687 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -5657,7 +5657,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(''' -- cgit v1.2.3-18-g5258