Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/jsifier.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ function(${args}) {
proxyMode = PROXY_SYNC;
}
}
const rtnType = sig && sig.length ? sig[0] : null;
const rtnType = sig?.[0];
const proxyFunc =
MEMORY64 && rtnType == 'p' ? 'proxyToMainThreadPtr' : 'proxyToMainThread';
deps.push('$' + proxyFunc);
Expand Down Expand Up @@ -567,11 +567,7 @@ function(${args}) {
}
addedLibraryItems[symbol] = true;

if (!(symbol + '__deps' in LibraryManager.library)) {
LibraryManager.library[symbol + '__deps'] = [];
}

const deps = LibraryManager.library[symbol + '__deps'];
const deps = LibraryManager.library[symbol + '__deps'] ??= [];
let sig = LibraryManager.library[symbol + '__sig'];
if (!WASM_BIGINT && sig && sig[0] == 'j') {
// Without WASM_BIGINT functions that return i64 depend on setTempRet0
Expand Down Expand Up @@ -702,7 +698,7 @@ function(${args}) {
// signatures are relevant and they differ between and alais and
// it's target) we need to construct a forwarding function from
// one to the other.
const isSigRelevant = MAIN_MODULE || MEMORY64 || CAN_ADDRESS_2GB || (sig && sig.includes('j'));
const isSigRelevant = MAIN_MODULE || MEMORY64 || CAN_ADDRESS_2GB || sig?.includes('j');
const targetSig = LibraryManager.library[aliasTarget + '__sig'];
if (isSigRelevant && sig && targetSig && sig != targetSig) {
debugLog(`${symbol}: Alias target (${aliasTarget}) has different signature (${sig} vs ${targetSig})`)
Expand Down
6 changes: 2 additions & 4 deletions src/lib/libcore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ addToLibrary({
// (https://github.com/WebAudio/web-audio-api/issues/2527), so if building
// with
// Audio Worklets enabled, do a dynamic check for its presence.
if (globalThis.performance && performance.now) {
if (globalThis.performance?.now) {
#if PTHREADS
_emscripten_get_now = () => performance.timeOrigin + performance.now();
#else
Expand Down Expand Up @@ -2616,8 +2616,6 @@ function wrapSyscallFunction(x, library, isWasi) {
// instead of synchronously, and marked with
// __proxy: 'async'
// (but essentially all syscalls do have return values).
if (library[x + '__proxy'] === undefined) {
library[x + '__proxy'] = 'sync';
}
library[x + '__proxy'] ??= 'sync';
#endif
}
6 changes: 3 additions & 3 deletions src/lib/libhtml5.js
Original file line number Diff line number Diff line change
Expand Up @@ -829,9 +829,9 @@ var LibraryHTML5 = {
supportedFields |= ag && {{{ cDefs.EMSCRIPTEN_DEVICE_MOTION_EVENT_SUPPORTS_ACCELERATION_INCLUDING_GRAVITY }}};
var rr = e['rotationRate'];
supportedFields |= rr && {{{ cDefs.EMSCRIPTEN_DEVICE_MOTION_EVENT_SUPPORTS_ROTATION_RATE }}};
a = a || {};
ag = ag || {};
rr = rr || {};
a ??= {};
Comment thread
sbc100 marked this conversation as resolved.
ag ??= {};
rr ??= {};
{{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenDeviceMotionEvent.supportedFields, 'supportedFields', 'i32') }}};
{{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationX, 'a["x"]', 'double') }}};
{{{ makeSetValue('eventStruct', C_STRUCTS.EmscriptenDeviceMotionEvent.accelerationY, 'a["y"]', 'double') }}};
Expand Down
2 changes: 1 addition & 1 deletion src/lib/libsdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ var LibrarySDL = {
var ly = Browser.lastTouches[touch.identifier].y / canvas.height;
var dx = x - lx;
var dy = y - ly;
if (touch['deviceID'] === undefined) touch.deviceID = SDL.TOUCH_DEFAULT_ID;
touch.deviceID ??= SDL.TOUCH_DEFAULT_ID;
if (dx === 0 && dy === 0 && event.type === 'touchmove') return false; // don't send these if nothing happened
{{{ makeSetValue('ptr', C_STRUCTS.SDL_TouchFingerEvent.type, 'SDL.DOMEventToSDLEvent[event.type]', 'i32') }}};
{{{ makeSetValue('ptr', C_STRUCTS.SDL_TouchFingerEvent.timestamp, '_SDL_GetTicks()', 'i32') }}};
Expand Down
8 changes: 4 additions & 4 deletions src/lib/libsockfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ addToLibrary({

if (sock.recv_queue.length ||
!dest || // connection-less sockets are always ready to read
(dest && dest.socket.readyState === dest.socket.CLOSING) ||
(dest && dest.socket.readyState === dest.socket.CLOSED)) { // let recv return 0 once closed
dest?.socket.readyState === dest.socket.CLOSING ||
dest?.socket.readyState === dest.socket.CLOSED) { // let recv return 0 once closed
mask |= ({{{ cDefs.POLLRDNORM }}} | {{{ cDefs.POLLIN }}});
}

Expand All @@ -398,8 +398,8 @@ addToLibrary({
mask |= {{{ cDefs.POLLOUT }}};
}

if ((dest && dest.socket.readyState === dest.socket.CLOSING) ||
(dest && dest.socket.readyState === dest.socket.CLOSED)) {
if (dest?.socket.readyState === dest.socket.CLOSING ||
dest?.socket.readyState === dest.socket.CLOSED) {
// When an non-blocking connect fails mark the socket as writable.
// Its up to the calling code to then use getsockopt with SO_ERROR to
// retrieve the error.
Expand Down
4 changes: 2 additions & 2 deletions test/codesize/test_codesize_hello_dylink_all.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"a.out.js": 244603,
"a.out.js": 244577,
"a.out.nodebug.wasm": 578054,
"total": 822657,
"total": 822631,
"sent": [
"IMG_Init",
"IMG_Load",
Expand Down
Loading