Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some embind tests under >2gb addressing #20079

Merged
merged 1 commit into from
Aug 21, 2023
Merged
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
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,8 @@ jobs:
wasm64_4gb.test_async_main
wasm64_4gb.*embind*
core_2gb.test_em_asm
core_2gb.test_embind_unsigned_bigint
core_2gb.test_embind_no_rtti
wasm64l.test_bigswitch
other.test_memory64_proxies
other.test_failing_growth_wasm64"
Expand Down
6 changes: 2 additions & 4 deletions src/jsifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,8 @@ function runJSify() {
error(`handleI64Signatures: missing name for argument ${i} in ${symbol}`);
return snippet;
}
if (WASM_BIGINT) {
if (sig[i] == 'p' || (sig[i] == 'j' && i53abi)) {
argConvertions += ` ${receiveI64ParamAsI53(name, undefined, false)}\n`;
}
if (WASM_BIGINT && ((MEMORY64 && sig[i] == 'p') || (i53abi && sig[i] == 'j'))) {
argConvertions += ` ${receiveI64ParamAsI53(name, undefined, false)}\n`;
} else {
if (sig[i] == 'j' && i53abi) {
argConvertions += ` ${receiveI64ParamAsI53(name, undefined, false)}\n`;
Expand Down
5 changes: 4 additions & 1 deletion src/parseTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ function getHeapOffset(offset, type) {
const shifts = Math.log(sz) / Math.LN2;
if (MEMORY64 == 1) {
return `((${offset})/${2 ** shifts})`;
} else if (CAN_ADDRESS_2GB) {
return `((${offset})>>>${shifts})`;
} else {
return `((${offset})>>${shifts})`;
}
Expand Down Expand Up @@ -422,7 +424,8 @@ function makeSetValueImpl(ptr, pos, value, type) {

function makeHEAPView(which, start, end) {
const size = parseInt(which.replace('U', '').replace('F', '')) / 8;
const mod = size == 1 ? '' : ('>>' + Math.log2(size));
const shift = Math.log2(size);
const mod = size == 1 ? '' : CAN_ADDRESS_2GB ? ('>>>' + shift) : ('>>' + shift);
return `HEAP${which}.subarray((${start})${mod}, (${end})${mod})`;
}

Expand Down
2 changes: 1 addition & 1 deletion tools/extract_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def extract_metadata(filename):
if e.kind == webassembly.ExternType.GLOBAL and e.name.startswith('__em_js__'):
name = utils.removeprefix(e.name, '__em_js__')
globl = module.get_global(e.index)
string_address = get_global_value(globl)
string_address = to_unsigned(get_global_value(globl))
em_js_funcs[name] = get_string_at(module, string_address)

for i in imports:
Expand Down