aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-06-29 10:05:29 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-07-03 15:31:04 -0700
commit7596d284a0fd54be6ed9661d377dd7903a27f072 (patch)
tree813bca30f7f6358b0a7f2935c1f6c5499c8d93be /emscripten.py
parent7be8c34546c5c8db548f8b7a5864f7cbd7594ef4 (diff)
refactor invoke generation and add missing invokes when linking
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py16
1 files changed, 2 insertions, 14 deletions
diff --git a/emscripten.py b/emscripten.py
index 56f59273..26e9f44f 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -11,6 +11,7 @@ headers, for the libc implementation in JS).
import os, sys, json, optparse, subprocess, re, time, multiprocessing, functools
+from tools import shared
from tools import jsrun, cache as cache_module, tempfiles
from tools.response_file import read_response_file
@@ -25,7 +26,6 @@ def get_configuration():
if hasattr(get_configuration, 'configuration'):
return get_configuration.configuration
- from tools import shared
configuration = shared.Configuration(environ=os.environ)
get_configuration.configuration = configuration
return configuration
@@ -453,19 +453,7 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
}
''' % (sig, i, args, arg_coercions, jsret))
- args = ','.join(['a' + str(i) for i in range(1, len(sig))])
- args = 'index' + (',' if args else '') + args
- # C++ exceptions are numbers, and longjmp is a string 'longjmp'
- asm_setup += '''
-function invoke_%s(%s) {
- try {
- %sModule["dynCall_%s"](%s);
- } catch(e) {
- if (typeof e !== 'number' && e !== 'longjmp') throw e;
- asm["setThrew"](1, 0);
- }
-}
-''' % (sig, args, 'return ' if sig[0] != 'v' else '', sig, args)
+ asm_setup += '\n' + shared.JS.make_invoke(sig) + '\n'
basic_funcs.append('invoke_%s' % sig)
# calculate exports