Skip to content
Closed
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
9 changes: 5 additions & 4 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,8 @@ def check_human_readable_list(items):
def make_js_executable(script):
src = read_file(script)
cmd = config.JS_ENGINE
if settings.WASM_BIGINT:
cmd.append('--experimental-wasm-bigint')
#if settings.WASM_BIGINT:
# cmd.append('--experimental-wasm-bigint')
cmd = shared.shlex_join(cmd)
if not os.path.isabs(config.JS_ENGINE[0]):
# TODO: use whereis etc. And how about non-*NIX?
Expand Down Expand Up @@ -2618,10 +2618,10 @@ def get_full_import_name(name):

# check if we can address the 2GB mark and higher: either if we start at
# 2GB, or if we allow growth to either any amount or to 2GB or more.
if settings.INITIAL_MEMORY > 2 * 1024 * 1024 * 1024 or \
if settings.MEMORY64 == 0 and (settings.INITIAL_MEMORY > 2 * 1024 * 1024 * 1024 or \
(settings.ALLOW_MEMORY_GROWTH and
(settings.MAXIMUM_MEMORY < 0 or
settings.MAXIMUM_MEMORY > 2 * 1024 * 1024 * 1024)):
settings.MAXIMUM_MEMORY > 2 * 1024 * 1024 * 1024))):
settings.CAN_ADDRESS_2GB = 1

settings.EMSCRIPTEN_VERSION = shared.EMSCRIPTEN_VERSION
Expand Down Expand Up @@ -3466,6 +3466,7 @@ def phase_binaryen(target, options, wasm_target):
# >=2GB heap support requires pointers in JS to be unsigned. rather than
# require all pointers to be unsigned by default, which increases code size
# a little, keep them signed, and just unsign them here if we need that.
# BELOW DOES NOT WORK IN COMBINATION WITH BigInt and wasm64 support
if settings.CAN_ADDRESS_2GB:
final_js = building.use_unsigned_pointers_in_js(final_js)

Expand Down
5 changes: 3 additions & 2 deletions src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ mergeInto(LibraryManager.library, {
// full 4GB Wasm memories, the size will wrap back to 0 bytes in Wasm side
// for any code that deals with heap sizes, which would require special
// casing all heap size related code to treat 0 specially.
return {{{ Math.min(MAXIMUM_MEMORY, FOUR_GB - WASM_PAGE_SIZE) }}};
return {{{ MAXIMUM_MEMORY }}};
#else // no growth
return HEAPU8.length;
#endif
Expand Down Expand Up @@ -1270,7 +1270,7 @@ mergeInto(LibraryManager.library, {
// These are in order to print helpful error messages when either longjmp of
// setjmp is used.
longjmp__deps: [function() {
error('longjmp support was disabled (SUPPORT_LONGJMP=0), but it is required by the code (either set SUPPORT_LONGJMP=1, or remove uses of it in the project)');
//error('longjmp support was disabled (SUPPORT_LONGJMP=0), but it is required by the code (either set SUPPORT_LONGJMP=1, or remove uses of it in the project)');
}],
get setjmp__deps() {
return this.longjmp__deps;
Expand Down Expand Up @@ -3325,6 +3325,7 @@ mergeInto(LibraryManager.library, {
$getWasmTableEntry__internal: true,
$getWasmTableEntry__deps: ['$wasmTableMirror'],
$getWasmTableEntry: function(funcPtr) {
funcPtr = Number(funcPtr);
var func = wasmTableMirror[funcPtr];
if (!func) {
if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1;
Expand Down
10 changes: 5 additions & 5 deletions src/library_egl.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var LibraryEGL = {
} else if (param == 0x3038 /*EGL_NONE*/) {
break;
}
attribList += 8;
attribList += 8n;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the way we avoid actually having to deal with BigInts in the JS libraries is to use __sig specifiers on the functions that receive the pointers. We use the p specifier within the signature to signify that a paramater or return type is a pointer or size_t value. For example a __sig of vpip would mean a void function that take a pointer, and integer, and another pointer. Then the library code will automatically convert pointers to JS numbers (int53 numbers to be precise) at the boundary.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right, i think i did change the __sig of some other method in order to get this to work. I think there are a few places in the opengl code which use "i" instead of "p".

}
}

Expand Down Expand Up @@ -102,7 +102,7 @@ var LibraryEGL = {
// Therefore, be lax and allow anything to be passed in, and return the magic handle to our default EGLDisplay object.

// if (nativeDisplayType == 0 /* EGL_DEFAULT_DISPLAY */) {
return 62000; // Magic ID for Emscripten 'default display'
return 62000n; // Magic ID for Emscripten 'default display'
// }
// else
// return 0; // EGL_NO_DISPLAY
Expand Down Expand Up @@ -292,7 +292,7 @@ var LibraryEGL = {
// - EGL_VG_COLORSPACE (can't be set)
// - EGL_VG_ALPHA_FORMAT (can't be set)
EGL.setErrorCode(0x3000 /* EGL_SUCCESS */);
return 62006; /* Magic ID for Emscripten 'default surface' */
return 62006n; /* Magic ID for Emscripten 'default surface' */
},

// EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay display, EGLSurface surface);
Expand Down Expand Up @@ -342,7 +342,7 @@ var LibraryEGL = {
EGL.setErrorCode(0x3004 /*EGL_BAD_ATTRIBUTE*/);
return 0;
}
contextAttribs += 8;
contextAttribs += 8n;
}
#if MAX_WEBGL_VERSION >= 2
if (glesContextVersion < 2 || glesContextVersion > 3) {
Expand Down Expand Up @@ -375,7 +375,7 @@ var LibraryEGL = {

// Note: This function only creates a context, but it shall not make it active.
GL.makeContextCurrent(null);
return 62004; // Magic ID for Emscripten EGLContext
return 62004n; // Magic ID for Emscripten EGLContext
} else {
EGL.setErrorCode(0x3009 /* EGL_BAD_MATCH */); // By the EGL 1.4 spec, an implementation that does not support GLES2 (WebGL in this case), this error code is set.
return 0; /* EGL_NO_CONTEXT */
Expand Down
2 changes: 1 addition & 1 deletion src/library_html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ var LibraryHTML5 = {
JSEvents.queueEventHandlerOnThread_iiii(targetThread, callbackfunc, eventTypeId, mouseEventData, userData);
} else
#endif
if ({{{ makeDynCall('iiii', 'callbackfunc') }}}(eventTypeId, JSEvents.mouseEvent, userData)) e.preventDefault();
if ({{{ makeDynCall('iipp', 'callbackfunc') }}}(eventTypeId, JSEvents.mouseEvent, userData)) e.preventDefault();
};

var eventHandler = {
Expand Down
Loading