diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-06-30 09:52:44 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-07-03 15:31:04 -0700 |
commit | 650a1d7857ea0dc7a373a54f75d011d34f3103c3 (patch) | |
tree | 9bfeeb16079f9e534970cebe4c68d943f334b81c | |
parent | 2c44a12bc755e4b59619a18027ab5b1a0752e0f1 (diff) |
finalize floats during relocation in side modules
-rwxr-xr-x | emcc | 2 | ||||
-rw-r--r-- | emlink.py | 2 | ||||
-rwxr-xr-x | tests/runner.py | 12 | ||||
-rw-r--r-- | tools/js-optimizer.js | 2 |
4 files changed, 15 insertions, 3 deletions
@@ -1597,7 +1597,7 @@ try: if closure and shared.Settings.ASM_JS: js_optimizer_queue += ['closure'] - js_optimizer_queue += ['last'] + if not shared.Settings.SIDE_MODULE: js_optimizer_queue += ['last'] # side modules are not finalized until after relocation flush_js_optimizer_queue() @@ -144,7 +144,7 @@ class AsmModule(): main.combine_tables() # relocate - temp = shared.Building.js_optimizer(self.filename, ['asm', 'relocate'], extra_info={ + temp = shared.Building.js_optimizer(self.filename, ['asm', 'relocate', 'last'], extra_info={ 'replacements': replacements, 'fBases': f_bases, 'hBase': main.staticbump diff --git a/tests/runner.py b/tests/runner.py index 7f772d07..0db58f4e 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -10638,6 +10638,18 @@ f.close() int sidey() { return 11; } ''', 'other says 11.') + # finalization of float variables should pass asm.js validation + test('floats', '', ''' + #include <stdio.h> + extern float sidey(); + int main() { + printf("other says %.2f.", sidey()+1); + return 0; + } + ''', ''' + float sidey() { return 11.5; } + ''', 'other says 12.50') + # memory initialization in both test('multiple memory inits', '', r''' #include <stdio.h> diff --git a/tools/js-optimizer.js b/tools/js-optimizer.js index f382496f..0e3a21f3 100644 --- a/tools/js-optimizer.js +++ b/tools/js-optimizer.js @@ -2899,7 +2899,7 @@ arguments_.slice(1).forEach(function(arg) { passes[arg](ast); }); if (asm && last) { - asmLoopOptimizer(ast); + asmLoopOptimizer(ast); // TODO: move out of last, to make last faster when done later (as in side modules) prepDotZero(ast); } var js = astToSrc(ast, minifyWhitespace), old; |