Commit 1d7443ef authored by Kirill Smelkov's avatar Kirill Smelkov

-O1

wasm@deco:~/trydynlib$ make -B
emcc -s WASM=0 -O1 -s SIDE_MODULE=1 -DLIBK_COMPILE -o libk_so.js libk.c
emcc -s WASM=0 -O1 -s MAIN_MODULE=1 -s RUNTIME_LINKED_LIBS="['libk_so.js']" -o prog.js prog.c

wasm@deco:~/trydynlib$ node prog.js
prog!
libk.kfunc1 -> 12
parent 8b6885f5
......@@ -10,6 +10,7 @@ SO := js
endif
#CC += -v
CC += -O1
all : prog.js
......
......@@ -54,7 +54,7 @@ for (var i = gb; i < gb + 0; ++i) HEAP8[i] = 0;
/* no memory initializer */
// {{PRE_LIBRARY}}
var ASSERTIONS = true;
var ASSERTIONS = false;
// Copyright 2017 The Emscripten Authors. All rights reserved.
// Emscripten is available under two separate licenses, the MIT license and the
......@@ -91,10 +91,10 @@ function intArrayToString(array) {
Module.asmGlobalArg = { "Math": Math, "Int8Array": Int8Array, "Int16Array": Int16Array, "Int32Array": Int32Array, "Uint8Array": Uint8Array, "Uint16Array": Uint16Array, "Uint32Array": Uint32Array, "Float32Array": Float32Array, "Float64Array": Float64Array, "NaN": NaN, "Infinity": Infinity };
Module.asmLibraryArg = { "abort": abort, "assert": assert, "enlargeMemory": enlargeMemory, "getTotalMemory": getTotalMemory, "abortOnCannotGrowMemory": abortOnCannotGrowMemory, "abortStackOverflow": abortStackOverflow, "setTempRet0": setTempRet0, "getTempRet0": getTempRet0, "DYNAMICTOP_PTR": DYNAMICTOP_PTR, "tempDoublePtr": tempDoublePtr, "STACKTOP": STACKTOP, "STACK_MAX": STACK_MAX, "gb": gb, "fb": fb };
Module.asmLibraryArg = { "abort": abort, "assert": assert, "enlargeMemory": enlargeMemory, "getTotalMemory": getTotalMemory, "abortOnCannotGrowMemory": abortOnCannotGrowMemory, "setTempRet0": setTempRet0, "getTempRet0": getTempRet0, "DYNAMICTOP_PTR": DYNAMICTOP_PTR, "tempDoublePtr": tempDoublePtr, "STACKTOP": STACKTOP, "STACK_MAX": STACK_MAX, "gb": gb, "fb": fb };
// EMSCRIPTEN_START_ASM
var asm = (/** @suppress {uselessCode} */ function(global, env, buffer) {
'almost asm';
'use asm';
var HEAP8 = new global.Int8Array(buffer);
......@@ -143,7 +143,6 @@ var asm = (/** @suppress {uselessCode} */ function(global, env, buffer) {
var enlargeMemory=env.enlargeMemory;
var getTotalMemory=env.getTotalMemory;
var abortOnCannotGrowMemory=env.abortOnCannotGrowMemory;
var abortStackOverflow=env.abortStackOverflow;
var setTempRet0=env.setTempRet0;
var getTempRet0=env.getTempRet0;
var tempFloat = 0.0;
......@@ -156,8 +155,7 @@ function stackAlloc(size) {
ret = STACKTOP;
STACKTOP = (STACKTOP + size)|0;
STACKTOP = (STACKTOP + 15)&-16;
if ((STACKTOP|0) >= (STACK_MAX|0)) abortStackOverflow(size|0);
return ret|0;
}
function stackSave() {
......@@ -202,17 +200,6 @@ function runPostSets() {
// EMSCRIPTEN_END_ASM
(Module.asmGlobalArg, Module.asmLibraryArg, buffer);
var real__kfunc1 = asm["_kfunc1"]; asm["_kfunc1"] = function() {
assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
return real__kfunc1.apply(null, arguments);
};
var real_setThrew = asm["setThrew"]; asm["setThrew"] = function() {
assert(runtimeInitialized, 'you need to wait for the runtime to be ready (e.g. wait for main() to be called)');
assert(!runtimeExited, 'the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)');
return real_setThrew.apply(null, arguments);
};
var _kfunc1 = Module["_kfunc1"] = asm["_kfunc1"];
var runPostSets = Module["runPostSets"] = asm["runPostSets"];
var setThrew = Module["setThrew"] = asm["setThrew"];
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment