Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ addToLibrary({
#if PTHREADS
'$exitOnMainThread',
#endif
#if PTHREADS_DEBUG
#if PTHREADS_DEBUG || ASSERTIONS
'$runtimeKeepaliveCounter',
#endif
],
Expand Down Expand Up @@ -2016,6 +2016,9 @@ addToLibrary({
throw 'unwind';
},

#if !MINIMAL_RUNTIME
_emscripten_runtime_keepalive_clear__deps: ['$runtimeKeepaliveCounter'],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things:

  • Perhaps $runtimeKeepaliveCounter should be removed below from the direct deps of emscripten_force_exit, since it will already get it implicitly from depending on this function.
  • I'm not 100% sure about this, but could we instead have an alternative version of _emscripten_runtime_keepalive_clear that just doesn't do anything and doesn't depend on runtimeKeepaliveCounter at all, since in that case the variable isn't otherwise used? It doesn't seem to be incremented/decremented or checked in the case I was building. Not a huge deal either way, but if the other code paths avoid using the variable when in this mode, perhaps this one could avoid using the variable as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First part done, good idea.

Second part is harder. Its something I've done for noExitRuntime but this stuff is pretty tricky to get right so I'll leave that for a followup.

#endif
_emscripten_runtime_keepalive_clear: () => {
#if isSymbolNeeded('$noExitRuntime')
noExitRuntime = false;
Expand All @@ -2028,9 +2031,6 @@ addToLibrary({
emscripten_force_exit__deps: ['exit', '_emscripten_runtime_keepalive_clear',
#if !EXIT_RUNTIME && ASSERTIONS
'$warnOnce',
#endif
#if !MINIMAL_RUNTIME
'$runtimeKeepaliveCounter',
#endif
],
emscripten_force_exit__proxy: 'sync',
Expand Down
3 changes: 3 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -14903,6 +14903,9 @@ def test_noExitRuntime_deps(self):
def test_hello_world_argv(self):
self.do_runf('hello_world_argv.c', 'hello, world! (1)')

def test_strict_closure(self):
self.emcc(test_file('hello_world.c'), ['-sSTRICT', '--closure=1'])

def test_arguments_global(self):
self.emcc(test_file('hello_world_argv.c'), ['-sENVIRONMENT=web', '-sSTRICT', '--closure=1', '-O2'])

Expand Down
Loading