Skip to content

[Memory64] Core JS runtime changes for 64-bit #15219

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

Merged
merged 3 commits into from
Oct 7, 2021

Conversation

aardappel
Copy link
Collaborator

No description provided.

@aardappel aardappel requested a review from kripken October 4, 2021 23:03
Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

Thanks for splitting this off! Much appreciated.

src/library.js Outdated
__memory_base__import: true,
// the wasm backend reserves slot 0 for the NULL function pointer
__table_base: 1,
__table_base: "new WebAssembly.Global({'value': '{{{ SIZE_TYPE }}}', 'mutable': false}, {{{ to64(1) }}})",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should these three all be POINTER_TYPE since they store addresses?

Copy link
Collaborator

Choose a reason for hiding this comment

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

(in which case do we even needs SIZE_TYPE?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok.
SIZE_TYPE is used in 9 other locations in the big PR.

@@ -480,7 +490,7 @@ function checkSafeHeap() {
}

function getHeapOffset(offset, type) {
if (Runtime.getNativeFieldSize(type) > 4 && type == 'i64') {
if (!WASM_BIGINT && Runtime.getNativeFieldSize(type) > 4 && type == 'i64') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we sure this will be no-op for wasm32 users of WASM_BIGINT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

according to the test, yes :)

@@ -237,6 +237,7 @@ var MEMORY_GROWTH_LINEAR_STEP = -1;
// the full end-to-end wasm64 mode, and 2 is wasm64 for clang/lld but lowered to
// wasm32 in Binaryen (such that it can run on wasm32 engines, while internally
// using i64 pointers).
// Assumes WASM_BIGINT.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we automatically set this? Maybe Implies WASM_BIGINT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes we do, elsewhere.

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

Nice!

const POINTER_BITS = POINTER_SIZE * 8;
const POINTER_TYPE = 'i' + POINTER_BITS;

const SIZE_TYPE = POINTER_TYPE;
Copy link
Member

Choose a reason for hiding this comment

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

It's not obvious to me what this is. Is it for size_t? Why do we need it? (It's not used anywhere)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There were 10 occurrences in the big PR, so presumably those are used in the other small PRs.

@aardappel aardappel merged commit 42df2fb into emscripten-core:main Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants