Skip to content

Commit 4be3462

Browse files
authored
Remove EMCC_SAVE_OPT_TEMP environment variable (#19716)
The files in questions are already save by when `EMCC_DEBUG` (or just `EMCC_DEBUG_SAVE`) are set. Having a third options seems rather pointless. Furthermore `EMCC_SAVE_OPT_TEMP` doesn't actually work on its own since it save files into the emscripten temp directory, which is completely removed unless one of the above options I used. In addition this code is currently broken due to the expression: `int(saved.replace('input', '').replace('.txt', ''))` It seems like the above code was assuming the intput was of the form `include<N>.txt` but that is not the case since `saved` is declared on the line above as: `saved = 'save_' + os.path.basename(filename)` Also remove an unused function from `tools/shared.py`
1 parent 0fb0479 commit 4be3462

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

tools/js_optimizer.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -266,21 +266,9 @@ def write_chunk(chunk, i):
266266
return temp_file
267267
filenames = [write_chunk(chunk, i) for i, chunk in enumerate(chunks)]
268268

269-
if filenames:
270-
with ToolchainProfiler.profile_block('run_optimizer'):
271-
commands = [config.NODE_JS + [ACORN_OPTIMIZER, f] + passes for f in filenames]
272-
273-
if os.environ.get('EMCC_SAVE_OPT_TEMP') and os.environ.get('EMCC_SAVE_OPT_TEMP') != '0':
274-
for filename in filenames:
275-
saved = 'save_' + os.path.basename(filename)
276-
while os.path.exists(saved):
277-
saved = 'input' + str(int(saved.replace('input', '').replace('.txt', '')) + 1) + '.txt'
278-
shutil.copyfile(filename, os.path.join(shared.get_emscripten_temp_dir(), saved))
279-
280-
filenames = shared.run_multiple_processes(commands, route_stdout_to_temp_files_suffix='js_opt.jo.js')
281-
282-
for filename in filenames:
283-
temp_files.note(filename)
269+
with ToolchainProfiler.profile_block('run_optimizer'):
270+
commands = [config.NODE_JS + [ACORN_OPTIMIZER, f] + passes for f in filenames]
271+
filenames = shared.run_multiple_processes(commands, route_stdout_to_temp_files_suffix='js_opt.jo.js')
284272

285273
with ToolchainProfiler.profile_block('split_closure_cleanup'):
286274
if closure or cleanup:

tools/scons/site_scons/site_tools/emscripten/emscripten.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def generate(env, emscripten_path=None, **kw):
2525
'EMCC_AUTODEBUG', 'EM_COMPILER_WRAPPER',
2626
'MOZ_DISABLE_AUTO_SAFE_MODE', 'EMCC_STDERR_FILE',
2727
'EMSCRIPTEN_SUPPRESS_USAGE_WARNING', 'NODE_PATH', 'EMCC_JSOPT_MIN_CHUNK_SIZE',
28-
'EMCC_JSOPT_MAX_CHUNK_SIZE', 'EMCC_SAVE_OPT_TEMP', 'EMCC_CORES', 'EMCC_NO_OPT_SORT',
28+
'EMCC_JSOPT_MAX_CHUNK_SIZE', 'EMCC_CORES', 'EMCC_NO_OPT_SORT',
2929
'EMCC_BUILD_DIR', 'EMCC_DEBUG_SAVE', 'EMCC_SKIP_SANITY_CHECK',
3030
'EM_PKG_CONFIG_PATH', 'EMCC_CLOSURE_ARGS', 'JAVA_HEAP_SIZE',
3131
'EMCC_FORCE_STDLIBS', 'EMCC_ONLY_FORCED_STDLIBS', 'EM_PORTS', 'IDL_CHECKS', 'IDL_VERBOSE']:

tools/shared.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,6 @@ def get_num_cores():
132132
return int(os.environ.get('EMCC_CORES', os.cpu_count()))
133133

134134

135-
def mp_run_process(command_tuple):
136-
cmd, env, route_stdout_to_temp_files_suffix = command_tuple
137-
stdout = None
138-
if route_stdout_to_temp_files_suffix:
139-
stdout = get_temp_files().get(route_stdout_to_temp_files_suffix)
140-
subprocess.run(cmd, stdout=stdout, stderr=None, env=env, check=True)
141-
if route_stdout_to_temp_files_suffix:
142-
return stdout.name
143-
144-
145135
def returncode_to_str(code):
146136
assert code != 0
147137
if code < 0:

0 commit comments

Comments
 (0)