Skip to content

Commit c5a4558

Browse files
authored
De-runtime-ification (#5954)
This removes the Runtime object from the generated code. Much of it was not needed at all, the rest is moved into plain JS functions in a new support.js file (which is easier for DCE to remove). This is something @juj suggested we do, and it helps with the goal of shrinking JS - this reduces code from a few % in something like libc++ to 15% in small hello world type things. The history here is that in the early days I thought we'd have a coherent Runtime object, and it would be used at both compile time and execution time, sharing code between them. But with asm.js and wasm, we've been doing less and less in JS anyhow, so Runtime has made less and less sense. Also it turns out there are just a handful of methods we need both at compile time and execution time, at this point. Another old idea was that we need to generate the runtime support dynamically, since we supported weird things like QUANTUM=1 (ints and pointers take one memory address location). That's why we had RuntimeGenerator and all that. But again, with asm.js and wasm, we really just support one type of memory, the plain C style. So it's easier to just write out those methods in support.js instead of generating them from a flexible template. This simplification may also help us in the future with more modularization of our runtime code (ES6 modules, etc.). Breakage-wise, this does affect anyone that used anything on Runtime in a manual way: Runtime.X needs to change to just X. The Runtime object is sort of an internal implementation detail, so hopefully few people ever used it, but still, there's a risk. There are helper messages in assertions mode with some of the more likely candidates, hopefully that will help. Overall, I think this is unavoidable refactoring, and hopefully any inconvenience will be minor.
1 parent e66ac4a commit c5a4558

32 files changed

+691
-789
lines changed

emscripten.py

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ def parse_backend_output(backend_output, DEBUG):
143143
metadata_raw = backend_output[metadata_split+len(metadata_split_marker):]
144144
mem_init = backend_output[end_funcs+len(end_funcs_marker):metadata_split]
145145

146+
# we no longer use the "Runtime" object. TODO: stop emiting it in the backend
147+
mem_init = mem_init.replace('Runtime.', '')
148+
146149
try:
147150
#if DEBUG: print >> sys.stderr, "METAraw", metadata_raw
148151
metadata = json.loads(metadata_raw, object_pairs_hook=OrderedDict)
@@ -378,8 +381,6 @@ def create_module(function_table_sigs, metadata, settings,
378381

379382
asm_end = create_asm_end(exports, settings)
380383

381-
runtime_library_overrides = create_runtime_library_overrides(settings)
382-
383384
module = [
384385
asm_start,
385386
temp_float,
@@ -389,11 +390,11 @@ def create_module(function_table_sigs, metadata, settings,
389390
start_funcs_marker
390391
] + runtime_funcs + funcs_js + ['\n ',
391392
pre_tables, final_function_tables, asm_end,
392-
'\n', receiving, ';\n', runtime_library_overrides]
393+
'\n', receiving, ';\n']
393394

394395
if settings['SIDE_MODULE']:
395396
module.append('''
396-
Runtime.registerFunctions(%(sigs)s, Module);
397+
parentModule['registerFunctions'](%(sigs)s, Module);
397398
''' % { 'sigs': str(list(map(str, function_table_sigs))) })
398399

399400
return module
@@ -564,7 +565,7 @@ def memory_and_global_initializers(pre, metadata, mem_init, settings):
564565
mem_init=mem_init))
565566

566567
if settings['SIDE_MODULE']:
567-
pre = pre.replace('Runtime.GLOBAL_BASE', 'gb')
568+
pre = pre.replace('GLOBAL_BASE', 'gb')
568569
if settings['SIDE_MODULE'] or settings['BINARYEN']:
569570
pre = pre.replace('{{{ STATIC_BUMP }}}', str(staticbump))
570571

@@ -651,8 +652,8 @@ def get_implemented_functions(metadata):
651652

652653
def proxy_debug_print(call_type, settings):
653654
if shared.Settings.PTHREADS_DEBUG:
654-
if call_type == 'sync_on_main_thread_': return 'Runtime.warnOnce("sync proxying function " + code);';
655-
elif call_type == 'async_on_main_thread_': return 'Runtime.warnOnce("async proxying function " + code);';
655+
if call_type == 'sync_on_main_thread_': return 'warnOnce("sync proxying function " + code);';
656+
elif call_type == 'async_on_main_thread_': return 'warnOnce("async proxying function " + code);';
656657
return ''
657658

658659
def include_asm_consts(pre, forwarded_json, metadata, settings):
@@ -1151,9 +1152,8 @@ def table_size(table):
11511152
if not settings['EMULATED_FUNCTION_POINTERS']:
11521153
asm_setup += "\nModule['wasmMaxTableSize'] = %d;\n" % table_total_size
11531154
if settings['RELOCATABLE']:
1154-
asm_setup += 'var setTempRet0 = Runtime.setTempRet0, getTempRet0 = Runtime.getTempRet0;\n'
11551155
if not settings['SIDE_MODULE']:
1156-
asm_setup += 'var gb = Runtime.GLOBAL_BASE, fb = 0;\n'
1156+
asm_setup += 'var gb = GLOBAL_BASE, fb = 0;\n'
11571157
side = 'parent' if settings['SIDE_MODULE'] else ''
11581158
def check(extern):
11591159
if settings['ASSERTIONS']:
@@ -1601,25 +1601,6 @@ def create_asm_end(exports, settings):
16011601
'Module' + access_quote('asmLibraryArg'))
16021602

16031603

1604-
def create_runtime_library_overrides(settings):
1605-
overrides = []
1606-
if not settings.get('SIDE_MODULE'):
1607-
overrides += [
1608-
'stackAlloc',
1609-
'stackSave',
1610-
'stackRestore',
1611-
'establishStackSpace',
1612-
]
1613-
if settings['SAFE_HEAP']:
1614-
overrides.append('setDynamicTop')
1615-
1616-
if not settings['RELOCATABLE']:
1617-
overrides += ['setTempRet0', 'getTempRet0']
1618-
1619-
lines = ["Runtime.{0} = Module['{0}'];".format(func) for func in overrides]
1620-
return '\n'.join(lines)
1621-
1622-
16231604
def create_first_in_asm(settings):
16241605
first_in_asm = ''
16251606
if settings['SPLIT_MEMORY']:
@@ -1995,15 +1976,15 @@ def create_module_wasm(sending, receiving, invoke_funcs, settings):
19951976
STACKTOP = STACK_BASE + TOTAL_STACK;
19961977
STACK_MAX = STACK_BASE;
19971978
HEAP32[%d >> 2] = STACKTOP;
1998-
Runtime.stackAlloc = Module['_stackAlloc'];
1999-
Runtime.stackSave = Module['_stackSave'];
2000-
Runtime.stackRestore = Module['_stackRestore'];
2001-
Runtime.establishStackSpace = Module['establishStackSpace'];
1979+
stackAlloc = Module['_stackAlloc'];
1980+
stackSave = Module['_stackSave'];
1981+
stackRestore = Module['_stackRestore'];
1982+
establishStackSpace = Module['establishStackSpace'];
20021983
''' % shared.Settings.GLOBAL_BASE)
20031984

20041985
module.append('''
2005-
Runtime.setTempRet0 = Module['setTempRet0'];
2006-
Runtime.getTempRet0 = Module['getTempRet0'];
1986+
setTempRet0 = Module['setTempRet0'];
1987+
getTempRet0 = Module['getTempRet0'];
20071988
''')
20081989

20091990
module.append(invoke_wrappers)

src/Fetch.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ function emscripten_start_fetch(fetch, successcb, errorcb, progresscb) {
485485
#if FETCH_DEBUG
486486
console.log('fetch: operation success. e: ' + e);
487487
#endif
488-
if (onsuccess && Runtime.dynCall) Module['dynCall_vi'](onsuccess, fetch);
488+
if (onsuccess && typeof dynCall === 'function') Module['dynCall_vi'](onsuccess, fetch);
489489
else if (successcb) successcb(fetch);
490490
};
491491

@@ -497,29 +497,29 @@ function emscripten_start_fetch(fetch, successcb, errorcb, progresscb) {
497497
#if FETCH_DEBUG
498498
console.log('fetch: IndexedDB store succeeded.');
499499
#endif
500-
if (onsuccess && Runtime.dynCall) Module['dynCall_vi'](onsuccess, fetch);
500+
if (onsuccess && typeof dynCall === 'function') Module['dynCall_vi'](onsuccess, fetch);
501501
else if (successcb) successcb(fetch);
502502
};
503503
var storeError = function(fetch, xhr, e) {
504504
#if FETCH_DEBUG
505505
console.error('fetch: IndexedDB store failed.');
506506
#endif
507-
if (onsuccess && Runtime.dynCall) Module['dynCall_vi'](onsuccess, fetch);
507+
if (onsuccess && typeof dynCall === 'function') Module['dynCall_vi'](onsuccess, fetch);
508508
else if (successcb) successcb(fetch);
509509
};
510510
__emscripten_fetch_cache_data(Fetch.dbInstance, fetch, xhr.response, storeSuccess, storeError);
511511
};
512512

513513
var reportProgress = function(fetch, xhr, e) {
514-
if (onprogress && Runtime.dynCall) Module['dynCall_vi'](onprogress, fetch);
514+
if (onprogress && typeof dynCall === 'function') Module['dynCall_vi'](onprogress, fetch);
515515
else if (progresscb) progresscb(fetch);
516516
};
517517

518518
var reportError = function(fetch, xhr, e) {
519519
#if FETCH_DEBUG
520520
console.error('fetch: operation failed: ' + e);
521521
#endif
522-
if (onerror && Runtime.dynCall) Module['dynCall_vi'](onerror, fetch);
522+
if (onerror && typeof dynCall === 'function') Module['dynCall_vi'](onerror, fetch);
523523
else if (errorcb) errorcb(fetch);
524524
};
525525

src/closure-externs.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,9 @@ var VoidPtr;
10251025

10261026
// Various Emscripten-specific global variables
10271027

1028+
/**
1029+
* @suppress {duplicate}
1030+
*/
10281031
var tempRet0;
10291032
var tempI64;
10301033
var tempDouble;

src/jsifier.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@ function JSify(data, functionsOnly) {
6767

6868
var shellParts = read(shellFile).split('{{BODY}}');
6969
print(processMacros(preprocess(shellParts[0], shellFile)));
70-
var preFile = BUILD_AS_SHARED_LIB || SIDE_MODULE ? 'preamble_sharedlib.js' : 'preamble.js';
71-
var pre = processMacros(preprocess(read(preFile).replace('{{RUNTIME}}', getRuntime()), preFile));
70+
var pre;
71+
if (BUILD_AS_SHARED_LIB || SIDE_MODULE) {
72+
pre = processMacros(preprocess(read('preamble_sharedlib.js'), 'preamble_sharedlib.js'));
73+
} else {
74+
pre = processMacros(preprocess(read('support.js'), 'support.js')) +
75+
processMacros(preprocess(read('preamble.js'), 'preamble.js'));
76+
}
7277
print(pre);
7378
}
7479

@@ -114,8 +119,8 @@ function JSify(data, functionsOnly) {
114119
// name the function; overwrite if it's already named
115120
snippet = snippet.replace(/function(?:\s+([^(]+))?\s*\(/, 'function ' + finalName + '(');
116121
if (LIBRARY_DEBUG && !LibraryManager.library[ident + '__asm']) {
117-
snippet = snippet.replace('{', '{ var ret = (function() { if (Runtime.debug) Module.printErr("[library call:' + finalName + ': " + Array.prototype.slice.call(arguments).map(Runtime.prettyPrint) + "]"); ');
118-
snippet = snippet.substr(0, snippet.length-1) + '}).apply(this, arguments); if (Runtime.debug && typeof ret !== "undefined") Module.printErr(" [ return:" + Runtime.prettyPrint(ret)); return ret; \n}';
122+
snippet = snippet.replace('{', '{ var ret = (function() { if (runtimeDebug) Module.printErr("[library call:' + finalName + ': " + Array.prototype.slice.call(arguments).map(prettyPrint) + "]"); ');
123+
snippet = snippet.substr(0, snippet.length-1) + '}).apply(this, arguments); if (runtimeDebug && typeof ret !== "undefined") Module.printErr(" [ return:" + prettyPrint(ret)); return ret; \n}';
119124
}
120125
return snippet;
121126
}
@@ -130,7 +135,7 @@ function JSify(data, functionsOnly) {
130135
}
131136

132137
var func = "function _emscripten_" + (sync ? '' : 'a') + 'sync_run_in_browser_thread_' + sig + '(func' + argsList(sig.length-1) + ') {\n';
133-
if (sync) func += ' var waitAddress = Runtime.stackSave();\n';
138+
if (sync) func += ' var waitAddress = stackSave();\n';
134139

135140
function sizeofType(t) {
136141
switch(t) {
@@ -421,10 +426,10 @@ function JSify(data, functionsOnly) {
421426
Variables.generatedGlobalBase = true;
422427
// Globals are done, here is the rest of static memory
423428
if (!SIDE_MODULE) {
424-
print('STATIC_BASE = Runtime.GLOBAL_BASE;\n');
429+
print('STATIC_BASE = GLOBAL_BASE;\n');
425430
print('STATICTOP = STATIC_BASE + ' + Runtime.alignMemory(Variables.nextIndexedOffset) + ';\n');
426431
} else {
427-
print('gb = Runtime.alignMemory(getMemory({{{ STATIC_BUMP }}}, ' + MAX_GLOBAL_ALIGN + ' || 1));\n');
432+
print('gb = alignMemory(getMemory({{{ STATIC_BUMP }}}, ' + MAX_GLOBAL_ALIGN + ' || 1));\n');
428433
print('// STATICTOP = STATIC_BASE + ' + Runtime.alignMemory(Variables.nextIndexedOffset) + ';\n'); // comment as metadata only
429434
}
430435
if (BINARYEN) {
@@ -461,7 +466,7 @@ function JSify(data, functionsOnly) {
461466
if (USE_PTHREADS) {
462467
print('if (!ENVIRONMENT_IS_PTHREAD) {') // Pthreads should not initialize memory again, since it's shared with the main thread.
463468
}
464-
print('/* memory initializer */ ' + makePointer(memoryInitialization, null, 'ALLOC_NONE', 'i8', 'Runtime.GLOBAL_BASE' + (SIDE_MODULE ? '+H_BASE' : ''), true));
469+
print('/* memory initializer */ ' + makePointer(memoryInitialization, null, 'ALLOC_NONE', 'i8', 'GLOBAL_BASE' + (SIDE_MODULE ? '+H_BASE' : ''), true));
465470
if (USE_PTHREADS) {
466471
print('}')
467472
}
@@ -472,7 +477,7 @@ function JSify(data, functionsOnly) {
472477
if (!BUILD_AS_SHARED_LIB && !SIDE_MODULE) {
473478
if (USE_PTHREADS) {
474479
print('var tempDoublePtr;\n');
475-
print('if (!ENVIRONMENT_IS_PTHREAD) tempDoublePtr = Runtime.alignMemory(allocate(12, "i8", ALLOC_STATIC), 8);\n');
480+
print('if (!ENVIRONMENT_IS_PTHREAD) tempDoublePtr = alignMemory(allocate(12, "i8", ALLOC_STATIC), 8);\n');
476481
} else {
477482
print('var tempDoublePtr = ' + makeStaticAlloc(8) + '\n');
478483
}
@@ -519,11 +524,11 @@ function JSify(data, functionsOnly) {
519524
for(i in proxiedFunctionInvokers) print(proxiedFunctionInvokers[i]+'\n');
520525
print('if (!ENVIRONMENT_IS_PTHREAD) {\n // Only main thread initializes these, pthreads copy them over at thread worker init time (in pthread-main.js)');
521526
}
522-
print('DYNAMICTOP_PTR = Runtime.staticAlloc(4);\n');
523-
print('STACK_BASE = STACKTOP = Runtime.alignMemory(STATICTOP);\n');
524-
if (STACK_START > 0) print('if (STACKTOP < ' + STACK_START + ') STACK_BASE = STACKTOP = Runtime.alignMemory(' + STACK_START + ');\n');
527+
print('DYNAMICTOP_PTR = staticAlloc(4);\n');
528+
print('STACK_BASE = STACKTOP = alignMemory(STATICTOP);\n');
529+
if (STACK_START > 0) print('if (STACKTOP < ' + STACK_START + ') STACK_BASE = STACKTOP = alignMemory(' + STACK_START + ');\n');
525530
print('STACK_MAX = STACK_BASE + TOTAL_STACK;\n');
526-
print('DYNAMIC_BASE = Runtime.alignMemory(STACK_MAX);\n');
531+
print('DYNAMIC_BASE = alignMemory(STACK_MAX);\n');
527532
print('HEAP32[DYNAMICTOP_PTR>>2] = DYNAMIC_BASE;\n');
528533
print('staticSealed = true; // seal the static portion of memory\n');
529534
if (ASSERTIONS) print('assert(DYNAMIC_BASE < TOTAL_MEMORY, "TOTAL_MEMORY not big enough for stack");\n');

src/library.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -565,14 +565,14 @@ LibraryManager.library = {
565565
* not an issue.
566566
*/
567567
#if ASSERTIONS == 2
568-
Runtime.warnOnce('using stub malloc (reference it from C to have the real one included)');
568+
warnOnce('using stub malloc (reference it from C to have the real one included)');
569569
#endif
570-
var ptr = Runtime.dynamicAlloc(bytes + 8);
570+
var ptr = dynamicAlloc(bytes + 8);
571571
return (ptr+8) & 0xFFFFFFF8;
572572
},
573573
free: function() {
574574
#if ASSERTIONS == 2
575-
Runtime.warnOnce('using stub free (reference it from C to have the real one included)');
575+
warnOnce('using stub free (reference it from C to have the real one included)');
576576
#endif
577577
},
578578

@@ -598,7 +598,7 @@ LibraryManager.library = {
598598
atexit: function(func, arg) {
599599
#if ASSERTIONS
600600
#if NO_EXIT_RUNTIME == 1
601-
Runtime.warnOnce('atexit() called, but NO_EXIT_RUNTIME is set, so atexits() will not be called. set NO_EXIT_RUNTIME to 0 (see the FAQ)');
601+
warnOnce('atexit() called, but NO_EXIT_RUNTIME is set, so atexits() will not be called. set NO_EXIT_RUNTIME to 0 (see the FAQ)');
602602
#endif
603603
#endif
604604
__ATEXIT__.unshift({ func: func, arg: arg });
@@ -641,7 +641,7 @@ LibraryManager.library = {
641641
ENV['_'] = Module['thisProgram'];
642642
// Allocate memory.
643643
poolPtr = allocate(TOTAL_ENV_SIZE, 'i8', ALLOC_STATIC);
644-
envPtr = allocate(MAX_ENV_VALUES * {{{ Runtime.QUANTUM_SIZE }}},
644+
envPtr = allocate(MAX_ENV_VALUES * {{{ Runtime.POINTER_SIZE }}},
645645
'i8*', ALLOC_STATIC);
646646
{{{ makeSetValue('envPtr', '0', 'poolPtr', 'i8*') }}};
647647
{{{ makeSetValue(makeGlobalUse('_environ'), 0, 'envPtr', 'i8*') }}};
@@ -1432,14 +1432,14 @@ LibraryManager.library = {
14321432
if (!self.LLVM_SAVEDSTACKS) {
14331433
self.LLVM_SAVEDSTACKS = [];
14341434
}
1435-
self.LLVM_SAVEDSTACKS.push(Runtime.stackSave());
1435+
self.LLVM_SAVEDSTACKS.push(stackSave());
14361436
return self.LLVM_SAVEDSTACKS.length-1;
14371437
},
14381438
llvm_stackrestore: function(p) {
14391439
var self = _llvm_stacksave;
14401440
var ret = self.LLVM_SAVEDSTACKS[p];
14411441
self.LLVM_SAVEDSTACKS.splice(p, 1);
1442-
Runtime.stackRestore(ret);
1442+
stackRestore(ret);
14431443
},
14441444

14451445
__cxa_pure_virtual: function() {
@@ -1707,12 +1707,12 @@ LibraryManager.library = {
17071707
var lib_data = FS.readFile(filename, { encoding: 'binary' });
17081708
if (!(lib_data instanceof Uint8Array)) lib_data = new Uint8Array(lib_data);
17091709
//Module.printErr('libfile ' + filename + ' size: ' + lib_data.length);
1710-
lib_module = Runtime.loadWebAssemblyModule(lib_data);
1710+
lib_module = loadWebAssemblyModule(lib_data);
17111711
#else
17121712
// the shared library is a JS file, which we eval
17131713
var lib_data = FS.readFile(filename, { encoding: 'utf8' });
17141714
lib_module = eval(lib_data)(
1715-
Runtime.alignFunctionTables(),
1715+
alignFunctionTables(),
17161716
Module
17171717
);
17181718
#endif
@@ -1813,7 +1813,7 @@ LibraryManager.library = {
18131813
} else {
18141814
var result = lib.module[symbol];
18151815
if (typeof result == 'function') {
1816-
result = Runtime.addFunction(result);
1816+
result = addFunction(result);
18171817
//Module.printErr('adding function dlsym result for ' + symbol + ' => ' + result);
18181818
lib.cached_functions = result;
18191819
}
@@ -2005,7 +2005,7 @@ LibraryManager.library = {
20052005
var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset))|0;
20062006
{{{ makeSetValue('tmPtr', C_STRUCTS.tm.tm_isdst, 'dst', 'i32') }}};
20072007

2008-
var zonePtr = {{{ makeGetValue(makeGlobalUse('_tzname'), 'dst ? Runtime.QUANTUM_SIZE : 0', 'i32') }}};
2008+
var zonePtr = {{{ makeGetValue(makeGlobalUse('_tzname'), 'dst ? ' + Runtime.QUANTUM_SIZE + ' : 0', 'i32') }}};
20092009
{{{ makeSetValue('tmPtr', C_STRUCTS.tm.tm_zone, 'zonePtr', 'i32') }}};
20102010

20112011
return tmPtr;
@@ -2052,9 +2052,9 @@ LibraryManager.library = {
20522052

20532053
ctime_r__deps: ['localtime_r', 'asctime_r'],
20542054
ctime_r: function(time, buf) {
2055-
var stack = Runtime.stackSave();
2056-
var rv = _asctime_r(_localtime_r(time, Runtime.stackAlloc({{{ C_STRUCTS.tm.__size__ }}})), buf);
2057-
Runtime.stackRestore(stack);
2055+
var stack = stackSave();
2056+
var rv = _asctime_r(_localtime_r(time, stackAlloc({{{ C_STRUCTS.tm.__size__ }}})), buf);
2057+
stackRestore(stack);
20582058
return rv;
20592059
},
20602060

@@ -4048,7 +4048,7 @@ LibraryManager.library = {
40484048

40494049
// If user requested to see the original source stack, but no source map information is available, just fall back to showing the JS stack.
40504050
if (flags & 8/*EM_LOG_C_STACK*/ && typeof emscripten_source_map === 'undefined') {
4051-
Runtime.warnOnce('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with "--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js" linker flag to add source map loading to code.');
4051+
warnOnce('Source map information is not available, emscripten_log with EM_LOG_C_STACK will be ignored. Build with "--pre-js $EMSCRIPTEN/src/emscripten-source-map.min.js" linker flag to add source map loading to code.');
40524052
flags ^= 8/*EM_LOG_C_STACK*/;
40534053
flags |= 16/*EM_LOG_JS_STACK*/;
40544054
}
@@ -4176,7 +4176,7 @@ LibraryManager.library = {
41764176
emscripten_log: function(flags, varargs) {
41774177
// Extract the (optionally-existing) printf format specifier field from varargs.
41784178
var format = {{{ makeGetValue('varargs', '0', 'i32', undefined, undefined, true) }}};
4179-
varargs += Math.max(Runtime.getNativeFieldSize('i32'), Runtime.getAlignSize('i32', null, true));
4179+
varargs += {{{ Math.max(Runtime.getNativeFieldSize('i32'), Runtime.getAlignSize('i32', null, true)) }}};
41804180
var str = '';
41814181
if (format) {
41824182
var result = __formatString(format, varargs);
@@ -4190,7 +4190,7 @@ LibraryManager.library = {
41904190
emscripten_get_compiler_setting: function(name) {
41914191
name = Pointer_stringify(name);
41924192

4193-
var ret = Runtime.getCompilerSetting(name);
4193+
var ret = getCompilerSetting(name);
41944194
if (typeof ret === 'number') return ret;
41954195

41964196
if (!_emscripten_get_compiler_setting.cache) _emscripten_get_compiler_setting.cache = {};

src/library_bootstrap_structInfo.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ LibraryManager.library = {
2222
if (!self.called) {
2323
HEAP32[DYNAMICTOP_PTR>>2] = alignUp(HEAP32[DYNAMICTOP_PTR>>2], 16777216); // make sure we start out aligned
2424
self.called = true;
25-
assert(Runtime.dynamicAlloc);
26-
self.alloc = Runtime.dynamicAlloc;
27-
Runtime.dynamicAlloc = function() { abort('cannot dynamically allocate, sbrk now has control') };
25+
assert(dynamicAlloc);
26+
self.alloc = dynamicAlloc;
27+
dynamicAlloc = function() { abort('cannot dynamically allocate, sbrk now has control') };
2828
}
2929
var ret = HEAP32[DYNAMICTOP_PTR>>2];
3030
if (bytes != 0) self.alloc(bytes);
3131
return ret; // Previous break location.
3232
},
3333
malloc: function(x) {
34-
return Runtime.dynamicAlloc(x);
34+
return dynamicAlloc(x);
3535
},
3636
};
3737

0 commit comments

Comments
 (0)