Skip to content

Commit

Permalink
[wasm64] Fix makeHEAPView for addresses over 4gb
Browse files Browse the repository at this point in the history
This enables all the cubegeom tests to pass
  • Loading branch information
sbc100 committed Feb 13, 2024
1 parent fa57899 commit d790162
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,8 @@ jobs:
browser64_4gb.test_html5_webgl_create_context*
browser64_4gb.test_sdl_image
browser64_4gb.test_wasm_worker*
browser64_4gb.test_cube_explosion
browser64_4gb.test_cubegeom_*
"
test-browser-firefox:
executor: bionic
Expand Down
11 changes: 10 additions & 1 deletion src/parseTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,16 @@ function makeSetValueImpl(ptr, pos, value, type) {
function makeHEAPView(which, start, end) {
const size = parseInt(which.replace('U', '').replace('F', '')) / 8;
const shift = Math.log2(size);
const mod = size == 1 ? '' : (CAN_ADDRESS_2GB || MEMORY64) ? ('>>>' + shift) : ('>>' + shift);
let mod = '';
if (size) {
if (MEMORY64) {
mod = '/' + size;
} else if (CAN_ADDRESS_2GB) {
mod = '>>>' + shift;
} else {
mod = '>>' + shift;
}
}
return `HEAP${which}.subarray((${start})${mod}, (${end})${mod})`;
}

Expand Down

0 comments on commit d790162

Please sign in to comment.