This commit is contained in:
Alon Zakai 2011-11-18 10:02:45 -08:00
Родитель 0e278173c9
Коммит 316ac8372e
6 изменённых файлов: 11 добавлений и 10 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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),

Просмотреть файл

@ -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 <stdio.h>
@ -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

Просмотреть файл

@ -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: