Simplify and improve Basis makefile

This commit is contained in:
Surma
2021-05-21 13:38:18 +01:00
parent a6f3bb596a
commit e0895ca074
6 changed files with 27 additions and 118 deletions

View File

@@ -971,9 +971,9 @@ function updateGlobalBufferAndViews(buf) {
Module['HEAPF64'] = HEAPF64 = new Float64Array(buf);
}
var STACK_BASE = 5776352,
var STACK_BASE = 5775920,
STACKTOP = STACK_BASE,
STACK_MAX = 533472;
STACK_MAX = 533040;
var TOTAL_STACK = 5242880;
@@ -1418,12 +1418,6 @@ var ASM_CONSTS = {
abort('Assertion failed: ' + UTF8ToString(condition) + ', at: ' + [filename ? UTF8ToString(filename) : 'unknown filename', line, func ? UTF8ToString(func) : 'unknown function']);
}
var ExceptionInfoAttrs={DESTRUCTOR_OFFSET:0,REFCOUNT_OFFSET:4,TYPE_OFFSET:8,CAUGHT_OFFSET:12,RETHROWN_OFFSET:13,SIZE:16};
function ___cxa_allocate_exception(size) {
// Thrown object is prepended by exception metadata block
return _malloc(size + ExceptionInfoAttrs.SIZE) + ExceptionInfoAttrs.SIZE;
}
function _atexit(func, arg) {
}
function ___cxa_thread_atexit(a0,a1
@@ -1431,88 +1425,6 @@ var ASM_CONSTS = {
return _atexit(a0,a1);
}
function ExceptionInfo(excPtr) {
this.excPtr = excPtr;
this.ptr = excPtr - ExceptionInfoAttrs.SIZE;
this.set_type = function(type) {
HEAP32[(((this.ptr)+(ExceptionInfoAttrs.TYPE_OFFSET))>>2)]=type;
};
this.get_type = function() {
return HEAP32[(((this.ptr)+(ExceptionInfoAttrs.TYPE_OFFSET))>>2)];
};
this.set_destructor = function(destructor) {
HEAP32[(((this.ptr)+(ExceptionInfoAttrs.DESTRUCTOR_OFFSET))>>2)]=destructor;
};
this.get_destructor = function() {
return HEAP32[(((this.ptr)+(ExceptionInfoAttrs.DESTRUCTOR_OFFSET))>>2)];
};
this.set_refcount = function(refcount) {
HEAP32[(((this.ptr)+(ExceptionInfoAttrs.REFCOUNT_OFFSET))>>2)]=refcount;
};
this.set_caught = function (caught) {
caught = caught ? 1 : 0;
HEAP8[(((this.ptr)+(ExceptionInfoAttrs.CAUGHT_OFFSET))>>0)]=caught;
};
this.get_caught = function () {
return HEAP8[(((this.ptr)+(ExceptionInfoAttrs.CAUGHT_OFFSET))>>0)] != 0;
};
this.set_rethrown = function (rethrown) {
rethrown = rethrown ? 1 : 0;
HEAP8[(((this.ptr)+(ExceptionInfoAttrs.RETHROWN_OFFSET))>>0)]=rethrown;
};
this.get_rethrown = function () {
return HEAP8[(((this.ptr)+(ExceptionInfoAttrs.RETHROWN_OFFSET))>>0)] != 0;
};
// Initialize native structure fields. Should be called once after allocated.
this.init = function(type, destructor) {
this.set_type(type);
this.set_destructor(destructor);
this.set_refcount(0);
this.set_caught(false);
this.set_rethrown(false);
}
this.add_ref = function() {
var value = HEAP32[(((this.ptr)+(ExceptionInfoAttrs.REFCOUNT_OFFSET))>>2)];
HEAP32[(((this.ptr)+(ExceptionInfoAttrs.REFCOUNT_OFFSET))>>2)]=value + 1;
};
// Returns true if last reference released.
this.release_ref = function() {
var prev = HEAP32[(((this.ptr)+(ExceptionInfoAttrs.REFCOUNT_OFFSET))>>2)];
HEAP32[(((this.ptr)+(ExceptionInfoAttrs.REFCOUNT_OFFSET))>>2)]=prev - 1;
return prev === 1;
};
}
var exceptionLast=0;
function __ZSt18uncaught_exceptionv() { // std::uncaught_exception()
return __ZSt18uncaught_exceptionv.uncaught_exceptions > 0;
}
function ___cxa_throw(ptr, type, destructor) {
var info = new ExceptionInfo(ptr);
// Initialize ExceptionInfo content after it was allocated in __cxa_allocate_exception.
info.init(type, destructor);
exceptionLast = ptr;
if (!("uncaught_exception" in __ZSt18uncaught_exceptionv)) {
__ZSt18uncaught_exceptionv.uncaught_exceptions = 1;
} else {
__ZSt18uncaught_exceptionv.uncaught_exceptions++;
}
throw ptr;
}
function getShiftFromSize(size) {
switch (size) {
case 1: return 0;
@@ -2619,9 +2531,7 @@ function intArrayToString(array) {
__ATINIT__.push({ func: function() { ___wasm_call_ctors() } });
var asmLibraryArg = {
"__assert_fail": ___assert_fail,
"__cxa_allocate_exception": ___cxa_allocate_exception,
"__cxa_thread_atexit": ___cxa_thread_atexit,
"__cxa_throw": ___cxa_throw,
"_embind_register_bool": __embind_register_bool,
"_embind_register_emval": __embind_register_emval,
"_embind_register_float": __embind_register_float,
@@ -2651,11 +2561,6 @@ var ___wasm_call_ctors = Module["___wasm_call_ctors"] = function() {
return (___wasm_call_ctors = Module["___wasm_call_ctors"] = Module["asm"]["__wasm_call_ctors"]).apply(null, arguments);
};
/** @type {function(...*):?} */
var _free = Module["_free"] = function() {
return (_free = Module["_free"] = Module["asm"]["free"]).apply(null, arguments);
};
/** @type {function(...*):?} */
var _realloc = Module["_realloc"] = function() {
return (_realloc = Module["_realloc"] = Module["asm"]["realloc"]).apply(null, arguments);
@@ -2666,6 +2571,11 @@ var _malloc = Module["_malloc"] = function() {
return (_malloc = Module["_malloc"] = Module["asm"]["malloc"]).apply(null, arguments);
};
/** @type {function(...*):?} */
var _free = Module["_free"] = function() {
return (_free = Module["_free"] = Module["asm"]["free"]).apply(null, arguments);
};
/** @type {function(...*):?} */
var ___getTypeName = Module["___getTypeName"] = function() {
return (___getTypeName = Module["___getTypeName"] = Module["asm"]["__getTypeName"]).apply(null, arguments);