emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.62k stars 3.28k forks source link

Compilation loop with WASM=0 / EMTERPRETIFY / EMULATED_FUNCTION_POINTERS #7449

Closed Beuc closed 4 years ago

Beuc commented 5 years ago

I can compile my project with WASM, but since this week it fails after ~25mn in asmjs:

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [nodejs]
 2: 0x5575f1952f91 [nodejs]
 3: v8::Utils::ReportOOMFailure(char const*, bool) [nodejs]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [nodejs]
 5: v8::internal::Factory::NewUninitializedFixedArray(int) [nodejs]
 6: 0x5575f1dbf7ed [nodejs]
 7: v8::internal::Runtime_GrowArrayElements(int, v8::internal::Object**, v8::internal::Isolate*) [nodejs]
 8: 0x222f87a840bd
Traceback (most recent call last):
  File "/home/me/workdir/emsource/emscripten-incoming/emcc.py", line 3107, in <module>
    sys.exit(run())
  File "/home/me/workdir/emsource/emscripten-incoming/emcc.py", line 2068, in run
    emterpretify(js_target, optimizer, options)
  File "/home/me/workdir/emsource/emscripten-incoming/emcc.py", line 2450, in emterpretify
    optimizer.flush('finalizing-emterpreted-code')
  File "/home/me/workdir/emsource/emscripten-incoming/emcc.py", line 270, in flush
    self.run_passes(chunks[0], title, just_split=False, just_concat=False)
  File "/home/me/workdir/emsource/emscripten-incoming/emcc.py", line 305, in run_passes
    output_filename=self.in_temp(os.path.basename(final) + '.jsopted.js'))
  File "/home/me/workdir/emsource/emscripten-incoming/tools/shared.py", line 2363, in js_optimizer
    ret = js_optimizer.run(filename, passes, NODE_JS, debug, extra_info, just_split, just_concat)
  File "/home/me/workdir/emsource/emscripten-incoming/tools/js_optimizer.py", line 581, in run
    return temp_files.run_and_clean(lambda: run_on_js(filename, passes, js_engine, source_map, extra_info, just_split, just_concat))
  File "/home/me/workdir/emsource/emscripten-incoming/tools/tempfiles.py", line 98, in run_and_clean
    return func()
  File "/home/me/workdir/emsource/emscripten-incoming/tools/js_optimizer.py", line 581, in <lambda>
    return temp_files.run_and_clean(lambda: run_on_js(filename, passes, js_engine, source_map, extra_info, just_split, just_concat))
  File "/home/me/workdir/emsource/emscripten-incoming/tools/js_optimizer.py", line 516, in run_on_js
    assert proc.returncode == 0
AssertionError
make: *** [Makefile:83: asmjs] Error 1

I don't have much info yet.

FrancoisChastel commented 5 years ago

Hello ! Did you change the version of your EmScripten ? If it was compiling before, it may occur because you change the version of the EmScripten SDK.

Beuc commented 5 years ago

Hi, I'm working with the incoming branch. It seems the problem is related to me recently doing tests with var EMULATED_FUNCTION_POINTERS = 1; in src/settings.js (to debug 5436).

I'm not sure why this caused a compilation loop, but the issue disappeared after resetting src/settings.js (or so I believe - I've been recompiling emscripten/myfastcomp a few times to bissect the issue).

EDIT: confirmed, adding it back causes WASM=0 compilation to loop again.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.