// Note: For maximum-speed code, see "Optimizing Code" on the Emscripten wiki, https://github.com/kripken/emscripten/wiki/Optimizing-Code // Note: Some Emscripten settings may limit the speed of the generated code. // The Module object: Our interface to the outside world. We import // and export values on it, and do the work to get that through // closure compiler if necessary. There are various ways Module can be used: // 1. Not defined. We create it here // 2. A function parameter, function(Module) { ..generated code.. } // 3. pre-run appended it, var Module = {}; ..generated code.. // 4. External script tag defines var Module. // We need to do an eval in order to handle the closure compiler // case, where this code here is minified but Module was defined // elsewhere (e.g. case 4 above). We also need to check if Module // already exists (e.g. case 3 above). // Note that if you want to run closure, and also to use Module // after the generated code, you will need to define var Module = {}; // before the code. Then that object will be used in the code, and you // can continue to use Module afterwards as well. var Module; if (!Module) Module = eval('(function() { try { return Module || {} } catch(e) { return {} } })()'); // Sometimes an existing Module object exists with properties // meant to overwrite the default module functionality. Here // we collect those properties and reapply _after_ we configure // the current environment's defaults to avoid having to be so // defensive during initialization. var moduleOverrides = {}; for (var key in Module) { if (Module.hasOwnProperty(key)) {
moduleOverrides[key] = Module[key];
}
} // The environment setup code below is customized to use Module. // *** Environment setup code *** var printedOutput = "";
Module['print'] = function f(str) {
printedOutput += str;
} if (typeof printErr != 'undefined') Module['printErr'] = printErr; // not present in v8 or older sm if (typeof read != 'undefined') {
Module['read'] = read;
} else {
Module['read'] = function() { throw'no read() available (jsc?)' };
}
Module['readBinary'] = function(f) { return read(f, 'binary');
}; if (typeof scriptArgs != 'undefined') {
Module['arguments'] = scriptArgs;
} elseif (typeof arguments != 'undefined') {
Module['arguments'] = arguments;
} this['Module'] = Module; function globalEval(x) {
eval.call(null, x);
} if (!Module['load'] == 'undefined' && Module['read']) {
Module['load'] = function(f) {
globalEval(Module['read'](f));
};
} if (!Module['printErr']) {
Module['printErr'] = Module['print'];
} // *** Environment setup code *** // Closure helpers
Module.print = Module['print'];
Module.printErr = Module['printErr']; // Callbacks
Module['preRun'] = [];
Module['postRun'] = []; // Merge back in the overrides for (var key in moduleOverrides) { if (moduleOverrides.hasOwnProperty(key)) {
Module[key] = moduleOverrides[key];
}
} // === Auto-generated preamble library stuff === //======================================== // Runtime code shared with compiler //======================================== var Runtime = {
stackSave: function () { return STACKTOP;
},
stackRestore: function (stackTop) {
STACKTOP = stackTop;
},
forceAlign: function (target, quantum) {
quantum = quantum || 4; if (quantum == 1) return target; if (isNumber(target) && isNumber(quantum)) { return Math.ceil(target/quantum)*quantum;
} elseif (isNumber(quantum) && isPowerOfTwo(quantum)) { var logg = log2(quantum); return'((((' +target + ')+' + (quantum-1) + ')>>' + logg + ')<<' + logg + ')';
} return'Math.ceil((' + target + ')/' + quantum + ')*' + quantum;
},
isNumberType: function (type) { return type in Runtime.INT_TYPES || type in Runtime.FLOAT_TYPES;
},
isPointerType: function isPointerType(type) { return type[type.length-1] == '*';
},
isStructType: function isStructType(type) { if (isPointerType(type)) returnfalse; if (isArrayType(type)) returntrue; if (/<?{ ?[^}]* ?}>?/.test(type)) returntrue; // { i32, i8 } etc. - anonymous struct types // See comment in isStructPointerType() return type[0] == '%';
},
INT_TYPES: {"i1":0,"i8":0,"i16":0,"i32":0,"i64":0},
FLOAT_TYPES: {"float":0,"double":0},
or64: function (x, y) { var l = (x | 0) | (y | 0); var h = (Math.round(x / 4294967296) | Math.round(y / 4294967296)) * 4294967296; return l + h;
},
and64: function (x, y) { var l = (x | 0) & (y | 0); var h = (Math.round(x / 4294967296) & Math.round(y / 4294967296)) * 4294967296; return l + h;
},
xor64: function (x, y) { var l = (x | 0) ^ (y | 0); var h = (Math.round(x / 4294967296) ^ Math.round(y / 4294967296)) * 4294967296; return l + h;
},
getNativeTypeSize: function (type, quantumSize) { if (Runtime.QUANTUM_SIZE == 1) return 1; var size = { '%i1': 1, '%i8': 1, '%i16': 2, '%i32': 4, '%i64': 8, "%float": 4, "%double": 8
}['%'+type]; // add '%' since float and double confuse Closure compiler as keys, and also spidermonkey as a compiler will remove 's from '_i8' etc if (!size) { if (type.charAt(type.length-1) == '*') {
size = Runtime.QUANTUM_SIZE; // A pointer
} elseif (type[0] == 'i') { var bits = parseInt(type.substr(1)); assert(bits % 8 == 0);
size = bits/8;
}
} return size;
},
getNativeFieldSize: function (type) { return Math.max(Runtime.getNativeTypeSize(type), Runtime.QUANTUM_SIZE);
},
dedup: function dedup(items, ident) { var seen = {}; if (ident) { return items.filter(function(item) { if (seen[item[ident]]) returnfalse;
seen[item[ident]] = true; returntrue;
});
} else { return items.filter(function(item) { if (seen[item]) returnfalse;
seen[item] = true; returntrue;
});
}
},
set: function set() { var args = typeof arguments[0] === 'object' ? arguments[0] : arguments; var ret = {}; for (var i = 0; i < args.length; i++) {
ret[args[i]] = 0;
} return ret;
},
STACK_ALIGN: 8,
getAlignSize: function (type, size, vararg) { // we align i64s and doubles on 64-bit boundaries, unlike x86 if (type == 'i64' || type == 'double' || vararg) return 8; if (!type) return Math.min(size, 8); // align structures internally to 64 bits return Math.min(size || (type ? Runtime.getNativeFieldSize(type) : 0), Runtime.QUANTUM_SIZE);
},
calculateStructAlignment: function calculateStructAlignment(type) {
type.flatSize = 0;
type.alignSize = 0; var diffs = []; var prev = -1; var index = 0;
type.flatIndexes = type.fields.map(function(field) {
index++; var size, alignSize; if (Runtime.isNumberType(field) || Runtime.isPointerType(field)) {
size = Runtime.getNativeTypeSize(field); // pack char; char; in structs, also char[X]s.
alignSize = Runtime.getAlignSize(field, size);
} elseif (Runtime.isStructType(field)) { if (field[1] === '0') { // this is [0 x something]. When inside another structure like here, it must be at the end, // and it adds no size // XXX this happens in java-nbody for example... assert(index === type.fields.length, 'zero-length in the middle!');
size = 0; if (Types.types[field]) {
alignSize = Runtime.getAlignSize(null, Types.types[field].alignSize);
} else {
alignSize = type.alignSize || QUANTUM_SIZE;
}
} else {
size = Types.types[field].flatSize;
alignSize = Runtime.getAlignSize(null, Types.types[field].alignSize);
}
} elseif (field[0] == 'b') { // bN, large number field, like a [N x i8]
size = field.substr(1)|0;
alignSize = 1;
} else { throw'Unclear type in struct: ' + field + ', in ' + type.name_ + ' :: ' + dump(Types.types[type.name_]);
} if (type.packed) alignSize = 1;
type.alignSize = Math.max(type.alignSize, alignSize); var curr = Runtime.alignMemory(type.flatSize, alignSize); // if necessary, place this on aligned memory
type.flatSize = curr + size; if (prev >= 0) {
diffs.push(curr-prev);
}
prev = curr; return curr;
});
type.flatSize = Runtime.alignMemory(type.flatSize, type.alignSize); if (diffs.length == 0) {
type.flatFactor = type.flatSize;
} elseif (Runtime.dedup(diffs).length == 1) {
type.flatFactor = diffs[0];
}
type.needsFlattening = (type.flatFactor != 1); return type.flatIndexes;
},
generateStructInfo: function (struct, typeName, offset) { var type, alignment; if (typeName) {
offset = offset || 0;
type = (typeof Types === 'undefined' ? Runtime.typeInfo : Types.types)[typeName]; if (!type) returnnull; if (type.fields.length != struct.length) {
printErr('Number of named fields must match the type for ' + typeName + ': possibly duplicate struct names. Cannot return structInfo'); returnnull;
}
alignment = type.flatIndexes;
} else { var type = { fields: struct.map(function(item) { return item[0] }) };
alignment = Runtime.calculateStructAlignment(type);
} var ret = {
__size__: type.flatSize
}; if (typeName) {
struct.forEach(function(item, i) { if (typeof item === 'string') {
ret[item] = alignment[i] + offset;
} else { // embedded struct var key; for (var k in item) key = k;
ret[key] = Runtime.generateStructInfo(item[key], type.fields[i], alignment[i]);
}
});
} else {
struct.forEach(function(item, i) {
ret[item[1]] = alignment[i];
});
} return ret;
},
dynCall: function (sig, ptr, args) { if (args && args.length) { if (!args.splice) args = Array.prototype.slice.call(args);
args.splice(0, 0, ptr); return Module['dynCall_' + sig].apply(null, args);
} else { return Module['dynCall_' + sig].call(null, ptr);
}
},
functionPointers: [],
addFunction: function (func) { for (var i = 0; i < Runtime.functionPointers.length; i++) { if (!Runtime.functionPointers[i]) {
Runtime.functionPointers[i] = func; return 2 + 2*i;
}
} throw'Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.';
},
removeFunction: function (index) {
Runtime.functionPointers[(index-2)/2] = null;
},
warnOnce: function (text) { if (!Runtime.warnOnce.shown) Runtime.warnOnce.shown = {}; if (!Runtime.warnOnce.shown[text]) {
Runtime.warnOnce.shown[text] = 1;
Module.printErr(text);
}
},
funcWrappers: {},
getFuncWrapper: function (func, sig) { assert(sig); if (!Runtime.funcWrappers[func]) {
Runtime.funcWrappers[func] = function() { return Runtime.dynCall(sig, func, arguments);
};
} return Runtime.funcWrappers[func];
},
UTF8Processor: function () { var buffer = []; var needed = 0; this.processCChar = function (code) {
code = code & 0xFF; if (buffer.length == 0) { if ((code & 0x80) == 0x00) { // 0xxxxxxx return String.fromCharCode(code);
}
buffer.push(code); if ((code & 0xE0) == 0xC0) { // 110xxxxx
needed = 1;
} elseif ((code & 0xF0) == 0xE0) { // 1110xxxx
needed = 2;
} else { // 11110xxx
needed = 3;
} return'';
} if (needed) {
buffer.push(code);
needed--; if (needed > 0) return'';
} var c1 = buffer[0]; var c2 = buffer[1]; var c3 = buffer[2]; var c4 = buffer[3]; var ret; if (buffer.length == 2) {
ret = String.fromCharCode(((c1 & 0x1F) << 6) | (c2 & 0x3F));
} elseif (buffer.length == 3) {
ret = String.fromCharCode(((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F));
} else { // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae var codePoint = ((c1 & 0x07) << 18) | ((c2 & 0x3F) << 12) |
((c3 & 0x3F) << 6) | (c4 & 0x3F);
ret = String.fromCharCode(
Math.floor((codePoint - 0x10000) / 0x400) + 0xD800,
(codePoint - 0x10000) % 0x400 + 0xDC00);
}
buffer.length = 0; return ret;
} this.processJSString = function(string) {
string = unescape(encodeURIComponent(string)); var ret = []; for (var i = 0; i < string.length; i++) {
ret.push(string.charCodeAt(i));
} return ret;
}
},
stackAlloc: function (size) { var ret = STACKTOP;STACKTOP = (STACKTOP + size)|0;STACKTOP = ((((STACKTOP)+7)>>3)<<3); return ret; },
staticAlloc: function (size) { var ret = STATICTOP;STATICTOP = (STATICTOP + size)|0;STATICTOP = ((((STATICTOP)+7)>>3)<<3); return ret; },
dynamicAlloc: function (size) { var ret = DYNAMICTOP;DYNAMICTOP = (DYNAMICTOP + size)|0;DYNAMICTOP = ((((DYNAMICTOP)+7)>>3)<<3); if (DYNAMICTOP >= TOTAL_MEMORY) enlargeMemory();; returnret; },
alignMemory: function (size,quantum) { var ret = size = Math.ceil((size)/(quantum ? quantum : 8))*(quantum ? quantum : 8); return ret; },
makeBigInt: function (low,high,unsigned) { var ret = (unsigned ? ((+(((low)>>>(0))))+((+(((high)>>>(0))))*(+(4294967296)))) : ((+(((low)>>>(0))))+((+(((high)|(0))))*(+(4294967296))))); return ret; },
GLOBAL_BASE: 8,
QUANTUM_SIZE: 4,
__dummy__: 0
} //======================================== // Runtime essentials //======================================== var __THREW__ = 0; // Used in checking for thrown exceptions. var ABORT = false; // whether we are quitting the application. no code should run after this. set in exit() and abort() var EXITSTATUS = 0; var undef = 0; // tempInt is used for 32-bit signed values or smaller. tempBigInt is used // for 32-bit unsigned values or more than 32 bits. TODO: audit all uses of tempInt var tempValue, tempInt, tempBigInt, tempInt2, tempBigInt2, tempPair, tempBigIntI, tempBigIntR, tempBigIntS, tempBigIntP, tempBigIntD; var tempI64, tempI64b; var tempRet0, tempRet1, tempRet2, tempRet3, tempRet4, tempRet5, tempRet6, tempRet7, tempRet8, tempRet9; functionassert(condition, text) { if (!condition) {
abort('Assertion failed: ' + text);
}
} var globalScope = this; // C calling interface. A convenient way to call C functions (in C files, or // defined with extern "C"). // // Note: LLVM optimizations can inline and remove functions, after which you will not be // able to call them. Closure can also do so. To avoid that, add your function to // the exports using something like // // -s EXPORTED_FUNCTIONS='["_main", "_myfunc"]' // // @param ident The name of the C function (note that C++ functions will be name-mangled - use extern "C") // @param returnType The return type of the function, one of the JS types 'number', 'string' or 'array' (use 'number' for any C pointer, and // 'array' for JavaScript arrays and typed arrays; note that arrays are 8-bit). // @param argTypes An array of the types of arguments for the function (if there are no arguments, this can be ommitted). Types are as in returnType, // except that 'array' is not possible (there is no way for us to know the length of the array) // @param args An array of the arguments to the function, as native JS values (as in returnType) // Note that string arguments will be stored on the stack (the JS string will become a C string on the stack). // @return The return value, as a native JS value (as in returnType) function ccall(ident, returnType, argTypes, args) { return ccallFunc(getCFunc(ident), returnType, argTypes, args);
}
Module["ccall"] = ccall; // Returns the C function with a specified identifier (for C++, you need to do manual name mangling) function getCFunc(ident) { try { var func = Module['_' + ident]; // closure exported function if (!func) func = eval('_' + ident); // explicit lookup
} catch(e) {
} assert(func, 'Cannot call unknown function ' + ident + ' (perhaps LLVM optimizations or closure removed it?)'); return func;
} // Internal function that does a C call using a function, not an identifier function ccallFunc(func, returnType, argTypes, args) { var stack = 0; function toC(value, type) { if (type == 'string') { if (value === null || value === undefined || value === 0) return 0; // null string if (!stack) stack = Runtime.stackSave(); var ret = Runtime.stackAlloc(value.length+1);
writeStringToMemory(value, ret); return ret;
} elseif (type == 'array') { if (!stack) stack = Runtime.stackSave(); var ret = Runtime.stackAlloc(value.length);
writeArrayToMemory(value, ret); return ret;
} return value;
} function fromC(value, type) { if (type == 'string') { return Pointer_stringify(value);
} assert(type != 'array'); return value;
} var i = 0; var cArgs = args ? args.map(function(arg) { return toC(arg, argTypes[i++]);
}) : []; var ret = fromC(func.apply(null, cArgs), returnType); if (stack) Runtime.stackRestore(stack); return ret;
} // Returns a native JS wrapper for a C function. This is similar to ccall, but // returns a function you can call repeatedly in a normal way. For example: // // var my_function = cwrap('my_c_function', 'number', ['number', 'number']); // alert(my_function(5, 22)); // alert(my_function(99, 12)); // function cwrap(ident, returnType, argTypes) { var func = getCFunc(ident); returnfunction() { return ccallFunc(func, returnType, argTypes, Array.prototype.slice.call(arguments));
}
}
Module["cwrap"] = cwrap; // Sets a value in memory in a dynamic way at run-time. Uses the // type data. This is the same as makeSetValue, except that // makeSetValue is done at compile-time and generates the needed // code then, whereas this function picks the right code at // run-time. // Note that setValue and getValue only do *aligned* writes and reads! // Note that ccall uses JS types as for defining types, while setValue and // getValue need LLVM types ('i8', 'i32') - this is a lower-level operation function setValue(ptr, value, type, noSafe) {
type = type || 'i8'; if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit switch(type) { case'i1': HEAP8[(ptr)]=value; break; case'i8': HEAP8[(ptr)]=value; break; case'i16': HEAP16[((ptr)>>1)]=value; break; case'i32': HEAP32[((ptr)>>2)]=value; break; case'i64': (tempI64 = [value>>>0,(tempDouble=value,(+(Math.abs(tempDouble))) >= (+(1)) ? (tempDouble > (+(0)) ? ((Math.min((+(Math.floor((tempDouble)/(+(4294967296))))), (+(4294967295))))|0)>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/(+(4294967296)))))))>>>0) : 0)],HEAP32[((ptr)>>2)]=tempI64[0],HEAP32[(((ptr)+(4))>>2)]=tempI64[1]); break; case'float': HEAPF32[((ptr)>>2)]=value; break; case'double': HEAPF64[((ptr)>>3)]=value; break; default: abort('invalid type for setValue: ' + type);
}
}
Module['setValue'] = setValue; // Parallel to setValue. function getValue(ptr, type, noSafe) {
type = type || 'i8'; if (type.charAt(type.length-1) === '*') type = 'i32'; // pointers are 32-bit switch(type) { case'i1': return HEAP8[(ptr)]; case'i8': return HEAP8[(ptr)]; case'i16': return HEAP16[((ptr)>>1)]; case'i32': return HEAP32[((ptr)>>2)]; case'i64': return HEAP32[((ptr)>>2)]; case'float': return HEAPF32[((ptr)>>2)]; case'double': return HEAPF64[((ptr)>>3)]; default: abort('invalid type for setValue: ' + type);
} returnnull;
}
Module['getValue'] = getValue; var ALLOC_NORMAL = 0; // Tries to use _malloc() var ALLOC_STACK = 1; // Lives for the duration of the current function call var ALLOC_STATIC = 2; // Cannot be freed var ALLOC_DYNAMIC = 3; // Cannot be freed except through sbrk var ALLOC_NONE = 4; // Do not allocate
Module['ALLOC_NORMAL'] = ALLOC_NORMAL;
Module['ALLOC_STACK'] = ALLOC_STACK;
Module['ALLOC_STATIC'] = ALLOC_STATIC;
Module['ALLOC_DYNAMIC'] = ALLOC_DYNAMIC;
Module['ALLOC_NONE'] = ALLOC_NONE; // allocate(): This is for internal use. You can use it yourself as well, but the interface // is a little tricky (see docs right below). The reason is that it is optimized // for multiple syntaxes to save space in generated code. So you should // normally not use allocate(), and instead allocate memory using _malloc(), // initialize it with setValue(), and so forth. // @slab: An array of data, or a number. If a number, then the size of the block to allocate, // in *bytes* (note that this is sometimes confusing: the next parameter does not // affect this!) // @types: Either an array of types, one for each byte (or 0 if no type at that position), // or a single type which is used for the entire block. This only matters if there // is initial data - if @slab is a number, then this does not matter at all and is // ignored. // @allocator: How to allocate memory, see ALLOC_* function allocate(slab, types, allocator, ptr) { var zeroinit, size; if (typeof slab === 'number') {
zeroinit = true;
size = slab;
} else {
zeroinit = false;
size = slab.length;
} var singleType = typeof types === 'string' ? types : null; var ret; if (allocator == ALLOC_NONE) {
ret = ptr;
} else {
ret = [_malloc, Runtime.stackAlloc, Runtime.staticAlloc, Runtime.dynamicAlloc][allocator === undefined ? ALLOC_STATIC : allocator](Math.max(size, singleType ? 1 : types.length));
} if (zeroinit) { var ptr = ret, stop; assert((ret & 3) == 0);
stop = ret + (size & ~3); for (; ptr < stop; ptr += 4) {
HEAP32[((ptr)>>2)]=0;
}
stop = ret + size; while (ptr < stop) {
HEAP8[((ptr++)|0)]=0;
} return ret;
} if (singleType === 'i8') { if (slab.subarray || slab.slice) {
HEAPU8.set(slab, ret);
} else {
HEAPU8.set(new Uint8Array(slab), ret);
} return ret;
} var i = 0, type, typeSize, previousType; while (i < size) { var curr = slab[i]; if (typeof curr === 'function') {
curr = Runtime.getFunctionIndex(curr);
}
type = singleType || types[i]; if (type === 0) {
i++; continue;
} if (type == 'i64') type = 'i32'; // special case: we have one i32 here, and one i32 later
setValue(ret+i, curr, type); // no need to look up size unless type changes, so cache it if (previousType !== type) {
typeSize = Runtime.getNativeTypeSize(type);
previousType = type;
}
i += typeSize;
} return ret;
}
Module['allocate'] = allocate; function Pointer_stringify(ptr, /* optional */ length) { // TODO: use TextDecoder // Find the length, and check for UTF while doing so var hasUtf = false; var t; var i = 0; while (1) {
t = HEAPU8[(((ptr)+(i))|0)]; if (t >= 128) hasUtf = true; elseif (t == 0 && !length) break;
i++; if (length && i == length) break;
} if (!length) length = i; var ret = ''; if (!hasUtf) { var MAX_CHUNK = 1024; // split up into chunks, because .apply on a huge string can overflow the stack var curr; while (length > 0) {
curr = String.fromCharCode.apply(String, HEAPU8.subarray(ptr, ptr + Math.min(length, MAX_CHUNK)));
ret = ret ? ret + curr : curr;
ptr += MAX_CHUNK;
length -= MAX_CHUNK;
} return ret;
} var utf8 = new Runtime.UTF8Processor(); for (i = 0; i < length; i++) {
t = HEAPU8[(((ptr)+(i))|0)];
ret += utf8.processCChar(t);
} return ret;
}
Module['Pointer_stringify'] = Pointer_stringify; // Given a pointer 'ptr' to a null-terminated UTF16LE-encoded string in the emscripten HEAP, returns // a copy of that string as a Javascript String object. function UTF16ToString(ptr) { var i = 0; var str = ''; while (1) { var codeUnit = HEAP16[(((ptr)+(i*2))>>1)]; if (codeUnit == 0) return str;
++i; // fromCharCode constructs a character from a UTF-16 code unit, so we can pass the UTF16 string right through.
str += String.fromCharCode(codeUnit);
}
}
Module['UTF16ToString'] = UTF16ToString; // Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr', // null-terminated and encoded in UTF16LE form. The copy will require at most (str.length*2+1)*2 bytes of space in the HEAP. function stringToUTF16(str, outPtr) { for(var i = 0; i < str.length; ++i) { // charCodeAt returns a UTF-16 encoded code unit, so it can be directly written to the HEAP. var codeUnit = str.charCodeAt(i); // possibly a lead surrogate
HEAP16[(((outPtr)+(i*2))>>1)]=codeUnit
} // Null-terminate the pointer to the HEAP.
HEAP16[(((outPtr)+(str.length*2))>>1)]=0
}
Module['stringToUTF16'] = stringToUTF16; // Given a pointer 'ptr' to a null-terminated UTF32LE-encoded string in the emscripten HEAP, returns // a copy of that string as a Javascript String object. function UTF32ToString(ptr) { var i = 0; var str = ''; while (1) { var utf32 = HEAP32[(((ptr)+(i*4))>>2)]; if (utf32 == 0) return str;
++i; // Gotcha: fromCharCode constructs a character from a UTF-16 encoded code (pair), not from a Unicode code point! So encode the code point to UTF-16 for constructing. if (utf32 >= 0x10000) { var ch = utf32 - 0x10000;
str += String.fromCharCode(0xD800 | (ch >> 10), 0xDC00 | (ch & 0x3FF));
} else {
str += String.fromCharCode(utf32);
}
}
}
Module['UTF32ToString'] = UTF32ToString; // Copies the given Javascript String object 'str' to the emscripten HEAP at address 'outPtr', // null-terminated and encoded in UTF32LE form. The copy will require at most (str.length+1)*4 bytes of space in the HEAP, // but can use less, since str.length does not return the number of characters in the string, but the number of UTF-16 code units in the string. function stringToUTF32(str, outPtr) { var iChar = 0; for(var iCodeUnit = 0; iCodeUnit < str.length; ++iCodeUnit) { // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code unit, not a Unicode code point of the character! We must decode the string to UTF-32 to the heap. var codeUnit = str.charCodeAt(iCodeUnit); // possibly a lead surrogate if (codeUnit >= 0xD800 && codeUnit <= 0xDFFF) { var trailSurrogate = str.charCodeAt(++iCodeUnit);
codeUnit = 0x10000 + ((codeUnit & 0x3FF) << 10) | (trailSurrogate & 0x3FF);
}
HEAP32[(((outPtr)+(iChar*4))>>2)]=codeUnit
++iChar;
} // Null-terminate the pointer to the HEAP.
HEAP32[(((outPtr)+(iChar*4))>>2)]=0
}
Module['stringToUTF32'] = stringToUTF32; // Memory management var PAGE_SIZE = 4096; function alignMemoryPage(x) { return ((x+4095)>>12)<<12;
} var HEAP; var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; var STATIC_BASE = 0, STATICTOP = 0, staticSealed = false; // static area var STACK_BASE = 0, STACKTOP = 0, STACK_MAX = 0; // stack area var DYNAMIC_BASE = 0, DYNAMICTOP = 0; // dynamic area handled by sbrk function enlargeMemory() {
abort('Cannot enlarge memory arrays in asm.js. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value ' + TOTAL_MEMORY + ', or (2) set Module.TOTAL_MEMORY before the program runs.');
} var TOTAL_STACK = Module['TOTAL_STACK'] || 5242880; var TOTAL_MEMORY = Module['TOTAL_MEMORY'] || 16777216; var FAST_MEMORY = Module['FAST_MEMORY'] || 2097152; // Initialize the runtime's memory // check for full engine support (use string 'subarray' to avoid closure compiler confusion) assert(!!Int32Array && !!Float64Array && !!(new Int32Array(1)['subarray']) && !!(new Int32Array(1)['set']), 'Cannot fallback to non-typed array case: Code is too specialized'); var buffer = new ArrayBuffer(TOTAL_MEMORY);
HEAP8 = new Int8Array(buffer);
HEAP16 = new Int16Array(buffer);
HEAP32 = new Int32Array(buffer);
HEAPU8 = new Uint8Array(buffer);
HEAPU16 = new Uint16Array(buffer);
HEAPU32 = new Uint32Array(buffer);
HEAPF32 = new Float32Array(buffer);
HEAPF64 = new Float64Array(buffer); // Endianness check (note: assumes compiler arch was little-endian)
HEAP32[0] = 255; assert(HEAPU8[0] === 255 && HEAPU8[3] === 0, 'Typed arrays 2 must be run on a little-endian system');
Module['HEAP'] = HEAP;
Module['HEAP8'] = HEAP8;
Module['HEAP16'] = HEAP16;
Module['HEAP32'] = HEAP32;
Module['HEAPU8'] = HEAPU8;
Module['HEAPU16'] = HEAPU16;
Module['HEAPU32'] = HEAPU32;
Module['HEAPF32'] = HEAPF32;
Module['HEAPF64'] = HEAPF64; function callRuntimeCallbacks(callbacks) { while(callbacks.length > 0) { var callback = callbacks.shift(); if (typeof callback == 'function') {
callback(); continue;
} var func = callback.func; if (typeof func === 'number') { if (callback.arg === undefined) {
Runtime.dynCall('v', func);
} else {
Runtime.dynCall('vi', func, [callback.arg]);
}
} else {
func(callback.arg === undefined ? null : callback.arg);
}
}
} var __ATPRERUN__ = []; // functions called before the runtime is initialized var __ATINIT__ = []; // functions called during startup var __ATMAIN__ = []; // functions called when main() is to be run var __ATEXIT__ = []; // functions called during shutdown var __ATPOSTRUN__ = []; // functions called after the runtime has exited var runtimeInitialized = false; function preRun() { // compatibility - merge in anything from Module['preRun'] at this time if (Module['preRun']) { if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']]; while (Module['preRun'].length) {
addOnPreRun(Module['preRun'].shift());
}
}
callRuntimeCallbacks(__ATPRERUN__);
} function ensureInitRuntime() { if (runtimeInitialized) return;
runtimeInitialized = true;
callRuntimeCallbacks(__ATINIT__);
} function preMain() {
callRuntimeCallbacks(__ATMAIN__);
} function exitRuntime() {
callRuntimeCallbacks(__ATEXIT__);
} function postRun() { // compatibility - merge in anything from Module['postRun'] at this time if (Module['postRun']) { if (typeof Module['postRun'] == 'function') Module['postRun'] = [Module['postRun']]; while (Module['postRun'].length) {
addOnPostRun(Module['postRun'].shift());
}
}
callRuntimeCallbacks(__ATPOSTRUN__);
} function addOnPreRun(cb) {
__ATPRERUN__.unshift(cb);
}
Module['addOnPreRun'] = Module.addOnPreRun = addOnPreRun; function addOnInit(cb) {
__ATINIT__.unshift(cb);
}
Module['addOnInit'] = Module.addOnInit = addOnInit; function addOnPreMain(cb) {
__ATMAIN__.unshift(cb);
}
Module['addOnPreMain'] = Module.addOnPreMain = addOnPreMain; function addOnExit(cb) {
__ATEXIT__.unshift(cb);
}
Module['addOnExit'] = Module.addOnExit = addOnExit; function addOnPostRun(cb) {
__ATPOSTRUN__.unshift(cb);
}
Module['addOnPostRun'] = Module.addOnPostRun = addOnPostRun; // Tools // This processes a JS string into a C-line array of numbers, 0-terminated. // For LLVM-originating strings, see parser.js:parseLLVMString function function intArrayFromString(stringy, dontAddNull, length /* optional */) { var ret = (new Runtime.UTF8Processor()).processJSString(stringy); if (length) {
ret.length = length;
} if (!dontAddNull) {
ret.push(0);
} return ret;
}
Module['intArrayFromString'] = intArrayFromString; function intArrayToString(array) { var ret = []; for (var i = 0; i < array.length; i++) { var chr = array[i]; if (chr > 0xFF) {
chr &= 0xFF;
}
ret.push(String.fromCharCode(chr));
} return ret.join('');
}
Module['intArrayToString'] = intArrayToString; // Write a Javascript array to somewhere in the heap function writeStringToMemory(string, buffer, dontAddNull) { var array = intArrayFromString(string, dontAddNull); var i = 0; while (i < array.length) { var chr = array[i];
HEAP8[(((buffer)+(i))|0)]=chr
i = i + 1;
}
}
Module['writeStringToMemory'] = writeStringToMemory; function writeArrayToMemory(array, buffer) { for (var i = 0; i < array.length; i++) {
HEAP8[(((buffer)+(i))|0)]=array[i];
}
}
Module['writeArrayToMemory'] = writeArrayToMemory; function unSign(value, bits, ignore, sig) { if (value >= 0) { return value;
} return bits <= 32 ? 2*Math.abs(1 << (bits-1)) + value // Need some trickery, since if bits == 32, we are right at the limit of the bits JS uses in bitshifts
: Math.pow(2, bits) + value;
} function reSign(value, bits, ignore, sig) { if (value <= 0) { return value;
} var half = bits <= 32 ? Math.abs(1 << (bits-1)) // abs is needed if bits == 32
: Math.pow(2, bits-1); if (value >= half && (bits <= 32 || value > half)) { // for huge values, we can hit the precision limit and always get true here. so don't do that // but, in general there is no perfect solution here. With 64-bit ints, we get rounding and errors // TODO: In i64 mode 1, resign the two parts separately and safely
value = -2*half + value; // Cannot bitshift half, as it may be at the limit of the bits JS uses in bitshifts
} return value;
} if (!Math['imul']) Math['imul'] = function(a, b) { var ah = a >>> 16; var al = a & 0xffff; var bh = b >>> 16; var bl = b & 0xffff; return (al*bl + ((ah*bl + al*bh) << 16))|0;
};
Math.imul = Math['imul']; // A counter of dependencies for calling run(). If we need to // do asynchronous work before running, increment this and // decrement it. Incrementing must happen in a place like // PRE_RUN_ADDITIONS (used by emcc to add file preloading). // Note that you can add dependencies in preRun, even though // it happens right before run - run will be postponed until // the dependencies are met. var runDependencies = 0; var runDependencyTracking = {}; var calledInit = false, calledRun = false; var runDependencyWatcher = null; function addRunDependency(id) {
runDependencies++; if (Module['monitorRunDependencies']) {
Module['monitorRunDependencies'](runDependencies);
} if (id) { assert(!runDependencyTracking[id]);
runDependencyTracking[id] = 1;
} else {
Module.printErr('warning: run dependency added without ID');
}
}
Module['addRunDependency'] = addRunDependency; function removeRunDependency(id) {
runDependencies--; if (Module['monitorRunDependencies']) {
Module['monitorRunDependencies'](runDependencies);
} if (id) { assert(runDependencyTracking[id]); delete runDependencyTracking[id];
} else {
Module.printErr('warning: run dependency removed without ID');
} if (runDependencies == 0) { if (runDependencyWatcher !== null) {
clearInterval(runDependencyWatcher);
runDependencyWatcher = null;
} // If run has never been called, and we should call run (INVOKE_RUN is true, and Module.noInitialRun is not false) if (!calledRun) run();
}
}
Module['removeRunDependency'] = removeRunDependency;
Module["preloadedImages"] = {}; // maps url to image data
Module["preloadedAudios"] = {}; // maps url to audio data function loadMemoryInitializer(filename) { function applyData(data) {
HEAPU8.set(data, STATIC_BASE);
} // always do this asynchronously, to keep shell and web as similar as possible
addOnPreRun(function() { if (ENVIRONMENT_IS_NODE || ENVIRONMENT_IS_SHELL) {
applyData(Module['readBinary'](filename));
} else {
Browser.asyncLoad(filename, function(data) {
applyData(data);
}, function(data) { throw'could not load memory initializer ' + filename;
});
}
});
} // === Body ===
STATIC_BASE = 8;
STATICTOP = STATIC_BASE + 14352; /* global initializers */ __ATINIT__.push({ func: function() { runPostSets() } },{ func: function() { __GLOBAL__I_a() } }); var ___dso_handle; var __ZTVN10__cxxabiv120__si_class_type_infoE; var __ZTVN10__cxxabiv117__class_type_infoE; var __ZN23btDiscreteDynamicsWorldC1EP12btDispatcherP21btBroadphaseInterfaceP18btConstraintSolverP24btCollisionConfiguration; var __ZN11btRigidBodyC1ERKNS_27btRigidBodyConstructionInfoE; var __ZN11btRigidBodyC1EfP13btMotionStateP16btCollisionShapeRK9btVector3; var __ZN35btSequentialImpulseConstraintSolverC1Ev; var __ZN21btCollisionDispatcherC1EP24btCollisionConfiguration; var __ZN27btContinuousConvexCollisionC1EPK13btConvexShapeS2_P22btVoronoiSimplexSolverP30btConvexPenetrationDepthSolver; var __ZN27btContinuousConvexCollisionC1EPK13btConvexShapePK18btStaticPlaneShape; var __ZN16btDbvtBroadphaseC1EP22btOverlappingPairCache; var __ZN31btDefaultCollisionConfigurationC1ERK34btDefaultCollisionConstructionInfo; var __ZN16btEmptyAlgorithmC1ERK36btCollisionAlgorithmConstructionInfo; var __ZN17btGjkPairDetectorC1EPK13btConvexShapeS2_P22btVoronoiSimplexSolverP30btConvexPenetrationDepthSolver; var __ZN17btGjkPairDetectorC1EPK13btConvexShapeS2_iiffP22btVoronoiSimplexSolverP30btConvexPenetrationDepthSolver; var __ZN16btManifoldResultC1EP17btCollisionObjectS1_; var __ZN28btHashedOverlappingPairCacheC1Ev; var __ZN25btSimulationIslandManagerC1Ev; var __ZN32btSphereSphereCollisionAlgorithmC1EP20btPersistentManifoldRK36btCollisionAlgorithmConstructionInfoP17btCollisionObjectS6_; var __ZN34btSphereTriangleCollisionAlgorithmC1EP20btPersistentManifoldRK36btCollisionAlgorithmConstructionInfoP17btCollisionObjectS6_b; var __ZN22btSubsimplexConvexCastC1EPK13btConvexShapeS2_P22btVoronoiSimplexSolver; var __ZN11btUnionFindD1Ev; var __ZN11btUnionFindC1Ev; var __ZN22SphereTriangleDetectorC1EP13btSphereShapeP15btTriangleShapef; var __ZN26btBoxBoxCollisionAlgorithmC1EP20btPersistentManifoldRK36btCollisionAlgorithmConstructionInfoP17btCollisionObjectS6_; var __ZN16btBoxBoxDetectorC1EP10btBoxShapeS1_; var __ZN28btCompoundCollisionAlgorithmC1ERK36btCollisionAlgorithmConstructionInfoP17btCollisionObjectS4_b; var __ZN33btConvexConcaveCollisionAlgorithmC1ERK36btCollisionAlgorithmConstructionInfoP17btCollisionObjectS4_b; var __ZN23btConvexConvexAlgorithm10CreateFuncC1EP22btVoronoiSimplexSolverP30btConvexPenetrationDepthSolver; var __ZN31btConvexPlaneCollisionAlgorithmC1EP20btPersistentManifoldRK36btCollisionAlgorithmConstructionInfoP17btCollisionObjectS6_bii; var __ZN18btConvexPolyhedronC1Ev; var __ZN6btDbvtC1Ev; var __ZN6btDbvtD1Ev; var __ZN15btGjkConvexCastC1EPK13btConvexShapeS2_P22btVoronoiSimplexSolver;
__ZTVN10__cxxabiv120__si_class_type_infoE=allocate([0,0,0,0,96,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "i8", ALLOC_STATIC);
__ZTVN10__cxxabiv117__class_type_infoE=allocate([0,0,0,0,112,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], "i8", ALLOC_STATIC);
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.16Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.