diff --git a/emscripten.py b/emscripten.py index 47a825d87..e689cc699 100755 --- a/emscripten.py +++ b/emscripten.py @@ -168,6 +168,7 @@ def main(args): settings = {} for setting in args.settings: name, value = setting.strip().split('=', 1) + assert name != 'OPTIMIZE', 'OPTIMIZE has been renamed MICRO_OPTS, to not confuse new users. Sorry for any inconvenience.' settings[name] = json.loads(value) # Adjust sign correction for dlmalloc. diff --git a/src/analyzer.js b/src/analyzer.js index efba03e8b..52017f276 100644 --- a/src/analyzer.js +++ b/src/analyzer.js @@ -363,10 +363,10 @@ function analyzer(data) { variable.impl = VAR_EMULATED; } else if (variable.type == 'i64*' && I64_MODE == 1) { variable.impl = VAR_EMULATED; - } else if (OPTIMIZE && variable.pointingLevels === 0 && !variable.hasAddrTaken) { + } else if (MICRO_OPTS && variable.pointingLevels === 0 && !variable.hasAddrTaken) { // A simple int value, can be implemented as a native variable variable.impl = VAR_NATIVE; - } else if (OPTIMIZE && variable.origin === 'alloca' && !variable.hasAddrTaken && !variable.hasValueTaken && + } else if (MICRO_OPTS && variable.origin === 'alloca' && !variable.hasAddrTaken && !variable.hasValueTaken && variable.allocatedNum === 1 && (Runtime.isNumberType(pointedType) || Runtime.isPointerType(pointedType))) { // A pointer to a value which is only accessible through this pointer. Basically diff --git a/src/compiler.js b/src/compiler.js index 3d33ed22f..fd96386c6 100644 --- a/src/compiler.js +++ b/src/compiler.js @@ -62,7 +62,7 @@ assert(!(USE_TYPED_ARRAYS === 2 && QUANTUM_SIZE !== 4), 'For USE_TYPED_ARRAYS == // Output some info and warnings based on settings -if (!OPTIMIZE || !RELOOP || ASSERTIONS || CHECK_SIGNS || CHECK_OVERFLOWS || INIT_STACK || INIT_HEAP || +if (!MICRO_OPTS || !RELOOP || ASSERTIONS || CHECK_SIGNS || CHECK_OVERFLOWS || INIT_STACK || INIT_HEAP || !SKIP_STACK_IN_SMALL || SAFE_HEAP || PGO || PROFILE || !DISABLE_EXCEPTION_CATCHING) { print('// Note: Some Emscripten settings will significantly limit the speed of the generated code.'); } else { diff --git a/src/settings.js b/src/settings.js index 1d64f1439..acdb8c149 100644 --- a/src/settings.js +++ b/src/settings.js @@ -37,7 +37,7 @@ TOTAL_MEMORY = 50*1024*1024; // The total amount of memory to use. This mainly m // is currently no warning about that! // Code embetterments -OPTIMIZE = 0; // Optimize llvm operations into js commands +MICRO_OPTS = 0; // Various micro-optimizations, like nativizing variables RELOOP = 0; // Recreate js native loops from llvm data USE_TYPED_ARRAYS = 0; // Try to use typed arrays for the heap // 1 has two heaps, IHEAP (int32) and FHEAP (double), diff --git a/tests/runner.py b/tests/runner.py index 2a050deb5..ced640df8 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -1551,7 +1551,7 @@ if 'benchmark' not in str(sys.argv): self.do_run(src, '*2,2,5,8,8***8,8,5,8,8***7,2,6,990,7,2*', [], lambda x: x.replace('\n', '*')) def test_emscripten_api(self): - #if Settings.OPTIMIZE or Settings.RELOOP or Building.LLVM_OPTS: return self.skip('FIXME') + #if Settings.MICRO_OPTS or Settings.RELOOP or Building.LLVM_OPTS: return self.skip('FIXME') src = ''' #include @@ -3299,7 +3299,7 @@ if 'benchmark' not in str(sys.argv): def test_freetype(self): if Settings.QUANTUM_SIZE == 1: return self.skip('TODO: Figure out and try to fix') - if Building.LLVM_OPTS: Settings.RELOOP = 0 # Too slow; we do care about typed arrays and OPTIMIZE though + if Building.LLVM_OPTS: Settings.RELOOP = 0 # Too slow; we do care about typed arrays and MICRO_OPTS though if Settings.CORRECT_SIGNS == 0: Settings.CORRECT_SIGNS = 1 # Not sure why, but needed @@ -3558,7 +3558,7 @@ if 'benchmark' not in str(sys.argv): # Overflows in string_hash Settings.CORRECT_OVERFLOWS = 1 Settings.CHECK_OVERFLOWS = 0 - Settings.RELOOP = 0 # Too slow; we do care about typed arrays and OPTIMIZE though + Settings.RELOOP = 0 # Too slow; we do care about typed arrays and MICRO_OPTS though Settings.SAFE_HEAP = 0 # Has bitfields which are false positives. Also the PyFloat_Init tries to detect endianness. Settings.CORRECT_SIGNS = 1 # Not sure why, but needed Settings.EXPORTED_FUNCTIONS = ['_main', '_PyRun_SimpleStringFlags'] # for the demo @@ -4397,7 +4397,7 @@ class %s(T): quantum_size = %d Settings.USE_TYPED_ARRAYS = %d Settings.INVOKE_RUN = 1 - Settings.RELOOP = Settings.OPTIMIZE = embetter + Settings.RELOOP = Settings.MICRO_OPTS = embetter Settings.QUANTUM_SIZE = quantum_size Settings.ASSERTIONS = 1-embetter Settings.SAFE_HEAP = 1-(embetter and llvm_opts) @@ -4505,7 +4505,7 @@ else: class benchmark(RunnerCore): def setUp(self): - Settings.RELOOP = Settings.OPTIMIZE = 1 + Settings.RELOOP = Settings.MICRO_OPTS = 1 Settings.USE_TYPED_ARRAYS = 1 Settings.QUANTUM_SIZE = 1 Settings.I64_MODE = 0 diff --git a/tools/shared.py b/tools/shared.py index fa6475b60..f720e890e 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -265,7 +265,7 @@ class Building: # Run Emscripten exported_settings = {} - for setting in ['QUANTUM_SIZE', 'RELOOP', 'OPTIMIZE', 'ASSERTIONS', 'USE_TYPED_ARRAYS', 'SAFE_HEAP', 'CHECK_OVERFLOWS', 'CORRECT_OVERFLOWS', 'CORRECT_SIGNS', 'CHECK_SIGNS', 'CORRECT_OVERFLOWS_LINES', 'CORRECT_SIGNS_LINES', 'CORRECT_ROUNDINGS', 'CORRECT_ROUNDINGS_LINES', 'INVOKE_RUN', 'SAFE_HEAP_LINES', 'INIT_STACK', 'PGO', 'EXPORTED_FUNCTIONS', 'EXPORTED_GLOBALS', 'BUILD_AS_SHARED_LIB', 'INCLUDE_FULL_LIBRARY', 'RUNTIME_TYPE_INFO', 'DISABLE_EXCEPTION_CATCHING', 'TOTAL_MEMORY', 'FAST_MEMORY', 'EXCEPTION_DEBUG', 'PROFILE', 'I64_MODE', 'EMULATE_UNALIGNED_ACCESSES']: + for setting in ['QUANTUM_SIZE', 'RELOOP', 'MICRO_OPTS', 'ASSERTIONS', 'USE_TYPED_ARRAYS', 'SAFE_HEAP', 'CHECK_OVERFLOWS', 'CORRECT_OVERFLOWS', 'CORRECT_SIGNS', 'CHECK_SIGNS', 'CORRECT_OVERFLOWS_LINES', 'CORRECT_SIGNS_LINES', 'CORRECT_ROUNDINGS', 'CORRECT_ROUNDINGS_LINES', 'INVOKE_RUN', 'SAFE_HEAP_LINES', 'INIT_STACK', 'PGO', 'EXPORTED_FUNCTIONS', 'EXPORTED_GLOBALS', 'BUILD_AS_SHARED_LIB', 'INCLUDE_FULL_LIBRARY', 'RUNTIME_TYPE_INFO', 'DISABLE_EXCEPTION_CATCHING', 'TOTAL_MEMORY', 'FAST_MEMORY', 'EXCEPTION_DEBUG', 'PROFILE', 'I64_MODE', 'EMULATE_UNALIGNED_ACCESSES']: try: value = eval('Settings.' + setting) if value is not None: