diff --git a/emcc.py b/emcc.py index ea63da8f94e71..01a9ef2b0c1fa 100755 --- a/emcc.py +++ b/emcc.py @@ -1418,6 +1418,8 @@ def phase_linker_setup(options, state, newargs, settings_map): settings.MEMORYPROFILER = 1 if settings.PTHREADS_PROFILING: + if not settings.ASSERTIONS: + exit_with_error('PTHREADS_PROFILING only works with ASSERTIONS enabled') options.post_js.append(utils.path_from_root('src/threadprofiler.js')) options.pre_js = read_js_files(options.pre_js) diff --git a/src/library_pthread.js b/src/library_pthread.js index 038ebd52f577b..f6f2f59008a94 100644 --- a/src/library_pthread.js +++ b/src/library_pthread.js @@ -1036,8 +1036,7 @@ var LibraryPThread = { #endif }, - // The profiler setters are defined twice, here in asm.js so that they can be #if'ed out - // without having to pay the impact of a FFI transition for a no-op in non-profiling builds. +#if ASSERTIONS emscripten_conditional_set_current_thread_status__sig: 'vii', emscripten_conditional_set_current_thread_status: function(expectedStatus, newStatus) { #if PTHREADS_PROFILING @@ -1058,6 +1057,7 @@ var LibraryPThread = { PThread.setThreadName(threadId, UTF8ToString(name)); #endif }, +#endif // This function is call by a pthread to signal that exit() was called and // that the entire process should exit. diff --git a/system/include/emscripten/threading.h b/system/include/emscripten/threading.h index f03fd5788f409..4e537cce0ff33 100644 --- a/system/include/emscripten/threading.h +++ b/system/include/emscripten/threading.h @@ -312,6 +312,11 @@ void emscripten_thread_sleep(double msecs); #define EM_THREAD_STATUS_FINISHED 6 #define EM_THREAD_STATUS_NUMFIELDS 7 +#ifdef NDEBUG +#define emscripten_set_current_thread_status(newStatus) +#define emscripten_conditional_set_current_thread_status(expectedStatus, newStatus) +#define emscripten_set_thread_name(threadId, name) +#else // Sets the profiler status of the calling thread. This is a no-op if thread // profiling is not active. // This is an internal function and generally not intended for user code. @@ -332,6 +337,7 @@ void emscripten_conditional_set_current_thread_status(EM_THREAD_STATUS expectedS // When thread profiler is not enabled (not building with --threadprofiler), // this is a no-op. void emscripten_set_thread_name(pthread_t threadId, const char *name); +#endif // Gets the stored pointer to a string representing the canvases to transfer to // the created thread. diff --git a/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.exports b/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.exports index 4460c5af8dd38..7e469e468abf7 100644 --- a/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.exports +++ b/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.exports @@ -10,9 +10,9 @@ I J K L -M -N -O +r +s +t u v w diff --git a/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.imports b/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.imports index 9479133a56d79..ac4ee2d44f8ad 100644 --- a/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.imports +++ b/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.imports @@ -15,6 +15,3 @@ a.n a.o a.p a.q -a.r -a.s -a.t diff --git a/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.sent b/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.sent index b64b08c98af4d..f6c3b87f767e8 100644 --- a/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.sent +++ b/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.sent @@ -15,6 +15,3 @@ n o p q -r -s -t diff --git a/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.size b/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.size index 424790743c383..d10e00f1b1a56 100644 --- a/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.size +++ b/tests/other/metadce/minimal_main_Oz_USE_PTHREADS_PROXY_TO_PTHREAD.size @@ -1 +1 @@ -16909 +16826