Skip to content

Commit

Permalink
Release: Update WebAssembly files
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseMax committed Oct 8, 2024
1 parent 7aa14c5 commit 381398c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 41 deletions.
92 changes: 51 additions & 41 deletions public/assets/salam/salam-wa.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var ENVIRONMENT_IS_WEB = typeof window == 'object';
var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function';
// N.b. Electron.js environment is simultaneously a NODE-environment, but
// also a web environment.
var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string';
var ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string' && process.type != 'renderer';
var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;

if (Module['ENVIRONMENT']) {
Expand Down Expand Up @@ -330,6 +330,7 @@ function updateMemoryViews() {
Module['HEAPF32'] = HEAPF32 = new Float32Array(b);
Module['HEAPF64'] = HEAPF64 = new Float64Array(b);
}

// end include: runtime_shared.js
assert(!Module['STACK_SIZE'], 'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time')

Expand Down Expand Up @@ -551,7 +552,6 @@ function abort(what) {
err(what);

ABORT = true;
EXITSTATUS = 1;

// Use a wasm runtime error, because a JS error might be seen as a foreign
// exception, which means we'd run destructors on it. We need the error to
Expand Down Expand Up @@ -756,7 +756,7 @@ function createWasm() {
}
}

if (!wasmBinaryFile) wasmBinaryFile = findWasmBinary();
wasmBinaryFile ??= findWasmBinary();

instantiateAsync(wasmBinary, wasmBinaryFile, info, receiveInstantiationResult);
return {}; // no exports yet; we'll fill them in later
Expand All @@ -768,7 +768,7 @@ var tempI64;

// include: runtime_debug.js
// Endianness check
(function() {
(() => {
var h16 = new Int16Array(1);
var h8 = new Int8Array(h16.buffer);
h16[0] = 0x6373;
Expand Down Expand Up @@ -807,45 +807,51 @@ function isExportedByForceFilesystem(name) {
name === 'removeRunDependency';
}

function missingGlobal(sym, msg) {
if (typeof globalThis != 'undefined') {
/**
* Intercept access to a global symbol. This enables us to give informative
* warnings/errors when folks attempt to use symbols they did not include in
* their build, or no symbols that no longer exist.
*/
function hookGlobalSymbolAccess(sym, func) {
if (typeof globalThis != 'undefined' && !Object.getOwnPropertyDescriptor(globalThis, sym)) {
Object.defineProperty(globalThis, sym, {
configurable: true,
get() {
warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`);
func();
return undefined;
}
});
}
}

function missingGlobal(sym, msg) {
hookGlobalSymbolAccess(sym, () => {
warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`);
});
}

missingGlobal('buffer', 'Please use HEAP8.buffer or wasmMemory.buffer');
missingGlobal('asm', 'Please use wasmExports instead');

function missingLibrarySymbol(sym) {
if (typeof globalThis != 'undefined' && !Object.getOwnPropertyDescriptor(globalThis, sym)) {
Object.defineProperty(globalThis, sym, {
configurable: true,
get() {
// Can't `abort()` here because it would break code that does runtime
// checks. e.g. `if (typeof SDL === 'undefined')`.
var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`;
// DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in
// library.js, which means $name for a JS name with no prefix, or name
// for a JS name like _name.
var librarySymbol = sym;
if (!librarySymbol.startsWith('_')) {
librarySymbol = '$' + sym;
}
msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`;
if (isExportedByForceFilesystem(sym)) {
msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
}
warnOnce(msg);
return undefined;
}
});
}
hookGlobalSymbolAccess(sym, () => {
// Can't `abort()` here because it would break code that does runtime
// checks. e.g. `if (typeof SDL === 'undefined')`.
var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`;
// DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in
// library.js, which means $name for a JS name with no prefix, or name
// for a JS name like _name.
var librarySymbol = sym;
if (!librarySymbol.startsWith('_')) {
librarySymbol = '$' + sym;
}
msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`;
if (isExportedByForceFilesystem(sym)) {
msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';
}
warnOnce(msg);
});

// Any symbol that is not included from the JS library is also (by definition)
// not exported on the Module object.
unexportedRuntimeSymbol(sym);
Expand Down Expand Up @@ -2071,6 +2077,8 @@ function dbg(...args) {
},
filesystems:null,
syncFSRequests:0,
readFiles:{
},
FSStream:class {
constructor() {
// TODO(https://github.com/emscripten-core/emscripten/issues/21414):
Expand Down Expand Up @@ -2970,7 +2978,6 @@ function dbg(...args) {
stream.stream_ops.open(stream);
}
if (Module['logReadFiles'] && !(flags & 1)) {
if (!FS.readFiles) FS.readFiles = {};
if (!(path in FS.readFiles)) {
FS.readFiles[path] = 1;
}
Expand Down Expand Up @@ -3391,7 +3398,7 @@ function dbg(...args) {
createDevice(parent, name, input, output) {
var path = PATH.join2(typeof parent == 'string' ? parent : FS.getPath(parent), name);
var mode = FS_getMode(!!input, !!output);
if (!FS.createDevice.major) FS.createDevice.major = 64;
FS.createDevice.major ??= 64;
var dev = FS.makedev(FS.createDevice.major++, 0);
// Create a fake device that a set of stream ops to emulate
// the old behavior.
Expand Down Expand Up @@ -3676,11 +3683,11 @@ function dbg(...args) {
var mtime = stat.mtime.getTime();
var ctime = stat.ctime.getTime();
(tempI64 = [Math.floor(atime / 1000)>>>0,(tempDouble = Math.floor(atime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(40))>>2)] = tempI64[0],HEAP32[(((buf)+(44))>>2)] = tempI64[1]);
HEAPU32[(((buf)+(48))>>2)] = (atime % 1000) * 1000;
HEAPU32[(((buf)+(48))>>2)] = (atime % 1000) * 1000 * 1000;
(tempI64 = [Math.floor(mtime / 1000)>>>0,(tempDouble = Math.floor(mtime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(56))>>2)] = tempI64[0],HEAP32[(((buf)+(60))>>2)] = tempI64[1]);
HEAPU32[(((buf)+(64))>>2)] = (mtime % 1000) * 1000;
HEAPU32[(((buf)+(64))>>2)] = (mtime % 1000) * 1000 * 1000;
(tempI64 = [Math.floor(ctime / 1000)>>>0,(tempDouble = Math.floor(ctime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(72))>>2)] = tempI64[0],HEAP32[(((buf)+(76))>>2)] = tempI64[1]);
HEAPU32[(((buf)+(80))>>2)] = (ctime % 1000) * 1000;
HEAPU32[(((buf)+(80))>>2)] = (ctime % 1000) * 1000 * 1000;
(tempI64 = [stat.ino>>>0,(tempDouble = stat.ino,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(88))>>2)] = tempI64[0],HEAP32[(((buf)+(92))>>2)] = tempI64[1]);
return 0;
},
Expand Down Expand Up @@ -4339,14 +4346,16 @@ var missingLibrarySymbols = [
'setImmediateWrapped',
'clearImmediateWrapped',
'polyfillSetImmediate',
'registerPostMainLoop',
'registerPreMainLoop',
'getPromise',
'makePromise',
'idsToPromises',
'makePromiseCallback',
'ExceptionInfo',
'findMatchingCatch',
'Browser_asyncPrepareDataCounter',
'setMainLoop',
'safeRequestAnimationFrame',
'isLeapYear',
'ydayFromDate',
'arraySum',
Expand All @@ -4362,6 +4371,9 @@ var missingLibrarySymbols = [
'webgl_enable_OES_vertex_array_object',
'webgl_enable_WEBGL_draw_buffers',
'webgl_enable_WEBGL_multi_draw',
'webgl_enable_EXT_polygon_offset_clamp',
'webgl_enable_EXT_clip_control',
'webgl_enable_WEBGL_polygon_mode',
'emscriptenWebGLGet',
'computeUnpackAlignedImageSize',
'colorChannelsInGlTextureFormat',
Expand Down Expand Up @@ -4590,10 +4602,8 @@ function run(args = arguments_) {

if (Module['setStatus']) {
Module['setStatus']('Running...');
setTimeout(function() {
setTimeout(function() {
Module['setStatus']('');
}, 1);
setTimeout(() => {
setTimeout(() => Module['setStatus'](''), 1);
doRun();
}, 1);
} else
Expand Down Expand Up @@ -4624,7 +4634,7 @@ function checkUnflushedContent() {
try { // it doesn't matter if it fails
_fflush(0);
// also flush in the JS FS layer
['stdout', 'stderr'].forEach(function(name) {
['stdout', 'stderr'].forEach((name) => {
var info = FS.analyzePath('/dev/' + name);
if (!info) return;
var stream = info.object;
Expand Down
Binary file modified public/assets/salam/salam-wa.wasm
Binary file not shown.

0 comments on commit 381398c

Please sign in to comment.