@@ -2124,26 +2124,27 @@ def do_minify(): # minifies the code. this is also when we do certain optimizati
2124
2124
cmd += ['--mem-max=' + str (shared .Settings .BINARYEN_MEM_MAX )]
2125
2125
if shared .Building .is_wasm_only ():
2126
2126
cmd += ['--wasm-only' ] # this asm.js is code not intended to run as asm.js, it is only ever going to be wasm, an can contain special fastcomp-wasm support
2127
+ if debug_level >= 2 or profiling_funcs :
2128
+ cmd += ['-g' ]
2129
+ if emit_symbol_map or shared .Settings .CYBERDWARF :
2130
+ cmd += ['--symbolmap=' + target + '.symbols' ]
2131
+ cmd += ['-o' , wasm_binary_target ]
2127
2132
logging .debug ('asm2wasm (asm.js => WebAssembly): ' + ' ' .join (cmd ))
2128
2133
TimeLogger .update ()
2129
- subprocess .check_call (cmd , stdout = open ( wasm_text_target , 'w' ) )
2134
+ subprocess .check_call (cmd )
2130
2135
if import_mem_init :
2131
2136
# remove and forget about the mem init file in later processing; it does not need to be prefetched in the html, etc.
2132
2137
os .unlink (memfile )
2133
2138
memory_init_file = False
2134
2139
log_time ('asm2wasm' )
2135
2140
if shared .Settings .BINARYEN_PASSES :
2136
- shutil .move (wasm_text_target , wasm_text_target + '.pre' )
2137
- cmd = [os .path .join (binaryen_bin , 'wasm-opt' ), wasm_text_target + '.pre' , '-o' , wasm_text_target ] + map (lambda p : '--' + p , shared .Settings .BINARYEN_PASSES .split (',' ))
2141
+ shutil .move (wasm_binary_target , wasm_binary_target + '.pre' )
2142
+ cmd = [os .path .join (binaryen_bin , 'wasm-opt' ), wasm_binary_target + '.pre' , '-o' , wasm_binary_target ] + map (lambda p : '--' + p , shared .Settings .BINARYEN_PASSES .split (',' ))
2138
2143
logging .debug ('wasm-opt on BINARYEN_PASSES: ' + ' ' .join (cmd ))
2139
2144
subprocess .check_call (cmd )
2140
- if 'native-wasm' in shared .Settings .BINARYEN_METHOD or 'interpret-binary' in shared .Settings .BINARYEN_METHOD :
2141
- cmd = [os .path .join (binaryen_bin , 'wasm-as' ), wasm_text_target , '-o' , wasm_binary_target ]
2142
- if debug_level >= 2 or profiling_funcs :
2143
- cmd += ['-g' ]
2144
- if emit_symbol_map or shared .Settings .CYBERDWARF :
2145
- cmd += ['--symbolmap=' + target + '.symbols' ]
2146
- logging .debug ('wasm-as (text => binary): ' + ' ' .join (cmd ))
2145
+ if 'interpret-s-expr' in shared .Settings .BINARYEN_METHOD :
2146
+ cmd = [os .path .join (binaryen_bin , 'wasm-dis' ), wasm_binary_target , '-o' , wasm_text_target ]
2147
+ logging .debug ('wasm-dis (binary => text): ' + ' ' .join (cmd ))
2147
2148
subprocess .check_call (cmd )
2148
2149
if shared .Settings .BINARYEN_SCRIPTS :
2149
2150
binaryen_scripts = os .path .join (shared .Settings .BINARYEN_ROOT , 'scripts' )
0 commit comments