@@ -1410,17 +1410,17 @@ def can_use(self):
14101410 return super (libprintf_long_double , self ).can_use () and settings .PRINTF_LONG_DOUBLE
14111411
14121412
1413- class libwasm_workers (MTLibrary ):
1413+ class libwasm_workers (DebugLibrary ):
14141414 name = 'libwasm_workers'
14151415 includes = ['system/lib/libc' ]
14161416
14171417 def __init__ (self , ** kwargs ):
1418- self .debug = kwargs .pop ('debug ' )
1418+ self .is_stub = kwargs .pop ('stub ' )
14191419 super ().__init__ (** kwargs )
14201420
14211421 def get_cflags (self ):
14221422 cflags = super ().get_cflags ()
1423- if self .debug :
1423+ if self .is_debug :
14241424 cflags += ['-D_DEBUG' ]
14251425 # library_wasm_worker.c contains an assert that a nonnull parameter
14261426 # is no NULL, which llvm now warns is redundant/tautological.
@@ -1433,28 +1433,28 @@ def get_cflags(self):
14331433 cflags += ['-DNDEBUG' , '-Oz' ]
14341434 if settings .MAIN_MODULE :
14351435 cflags += ['-fPIC' ]
1436+ if not self .is_stub :
1437+ cflags += ['-sWASM_WORKERS' ]
14361438 return cflags
14371439
14381440 def get_base_name (self ):
1439- name = 'libwasm_workers'
1440- if not self .is_ww and not self .is_mt :
1441- name += '_stub'
1442- if self .debug :
1443- name += '-debug'
1441+ name = super ().get_base_name ()
1442+ if self .is_stub :
1443+ name += '-stub'
14441444 return name
14451445
14461446 @classmethod
14471447 def vary_on (cls ):
1448- return super ().vary_on () + ['debug ' ]
1448+ return super ().vary_on () + ['stub ' ]
14491449
14501450 @classmethod
14511451 def get_default_variation (cls , ** kwargs ):
1452- return super ().get_default_variation (debug = settings .ASSERTIONS >= 1 , ** kwargs )
1452+ return super ().get_default_variation (stub = not settings .WASM_WORKERS , ** kwargs )
14531453
14541454 def get_files (self ):
14551455 return files_in_path (
14561456 path = 'system/lib/wasm_worker' ,
1457- filenames = ['library_wasm_worker .c' if self .is_ww or self . is_mt else 'library_wasm_worker_stub .c' ])
1457+ filenames = ['library_wasm_worker_stub .c' if self .is_stub else 'library_wasm_worker .c' ])
14581458
14591459 def can_use (self ):
14601460 # see src/library_wasm_worker.js
0 commit comments