diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-07 12:09:37 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-07 12:09:37 -0500 |
commit | cd0e759e7d44b4c5b12aace816a9bf7194ed1160 (patch) | |
tree | bfe54b891e439a8933886f30b96b38ed5e4a944d | |
parent | edd38757c87a9d6680c736b1f10664ceb2d467e3 (diff) |
get glue phase to emit i64 stuff for fastcomp
-rwxr-xr-x | emscripten.py | 21 | ||||
-rw-r--r-- | src/jsifier.js | 4 |
2 files changed, 11 insertions, 14 deletions
diff --git a/emscripten.py b/emscripten.py index 3866d14e..1211b566 100755 --- a/emscripten.py +++ b/emscripten.py @@ -804,6 +804,13 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None, if DEBUG: logging.debug('emscript: js compiler glue') + # Settings changes + assert settings['TARGET_LE32'] == 1 + settings['TARGET_LE32'] = 2 + if 'i64Add' in metadata['declares']: # TODO: others, once we split them up + settings['PRECISE_I64_MATH'] = 2 + metadata['declares'] = filter(lambda i64_func: i64_func not in ['getHigh32', 'setHigh32', '__muldsi3', '__divdi3', '__remdi3', '__udivdi3', '__uremdi3'], metadata['declares']) # FIXME: do these one by one as normal js lib funcs + # Integrate info from backend settings['DEFAULT_LIBRARY_FUNCS_TO_INCLUDE'] = list( set(settings['DEFAULT_LIBRARY_FUNCS_TO_INCLUDE'] + map(shared.JS.to_nice_ident, metadata['declares'])).difference( @@ -811,12 +818,6 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None, ) ) + map(lambda x: x[1:], metadata['externs']) - # Settings changes - assert settings['TARGET_LE32'] == 1 - settings['TARGET_LE32'] = 2 - if '_i64Add' in metadata['declares']: # TODO: others, once we split them up - settings['PRECISE_I64_MATH'] = 2 - # Save settings to a file to work around v8 issue 1579 settings_file = temp_files.get('.txt').name def save_settings(): @@ -887,18 +888,14 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None, #if DEBUG: outfile.write('// funcs\n') if settings.get('ASM_JS'): - #print >> sys.stderr, '<<<<<<', post, '>>>>>>' - post_funcs = '' #, post_rest = post.split('// EMSCRIPTEN_END_FUNCS\n') - #post = post_rest - # Move preAsms to their right place def move_preasm(m): contents = m.groups(0)[0] outfile.write(contents + '\n') return '' - post_funcs = re.sub(r'/\* PRE_ASM \*/(.*)\n', lambda m: move_preasm(m), post_funcs) + funcs_js[1] = re.sub(r'/\* PRE_ASM \*/(.*)\n', lambda m: move_preasm(m), funcs_js[1]) - funcs_js += ['\n' + post_funcs + '// EMSCRIPTEN_END_FUNCS\n'] + funcs_js += ['\n// EMSCRIPTEN_END_FUNCS\n'] simple = os.environ.get('EMCC_SIMPLE_ASM') class Counter: diff --git a/src/jsifier.js b/src/jsifier.js index 907855e7..304898f1 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1859,10 +1859,10 @@ function JSify(data, functionsOnly, givenFunctions) { // first row are utilities called from generated code, second are needed from fastLong ['i64Add', 'i64Subtract', 'bitshift64Shl', 'bitshift64Lshr', 'bitshift64Ashr', 'llvm_ctlz_i32', 'llvm_cttz_i32'].forEach(function(func) { - if (!Functions.libraryFunctions[func]) { + if (!Functions.libraryFunctions[func] || phase == 'glue') { // TODO: one-by-one in fastcomp glue mode print(processLibraryFunction(LibraryManager.library[func], func)); // must be first to be close to generated code Functions.implementedFunctions['_' + func] = LibraryManager.library[func + '__sig']; - Functions.libraryFunctions[func] = 1; + Functions.libraryFunctions[func] = phase == 'glue' ? 2 : 1; // XXX // limited dependency handling var deps = LibraryManager.library[func + '__deps']; if (deps) { |