Skip to content

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

Merged
aardappel merged 3 commits into
emscripten-core:mainfrom
aardappel:b2
Oct 7, 2021
Merged

[Memory64] Core JS runtime changes for 64-bit#15219
aardappel merged 3 commits into
emscripten-core:mainfrom
aardappel:b2

Conversation

@aardappel

Copy link
Copy Markdown
Collaborator

No description provided.

@aardappel
aardappel requested a review from kripken October 4, 2021 23:03
Comment thread src/postamble.js Outdated
Comment thread src/parseTools.js Outdated

@sbc100 sbc100 left a comment

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.

Thanks for splitting this off! Much appreciated.

Comment thread 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread src/parseTools.js

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

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.

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

Copy link
Copy Markdown
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 :)

Comment thread src/settings.js
// 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
Copy Markdown
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
Copy Markdown
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.

Comment thread src/parseTools.js Outdated

@sbc100 sbc100 left a comment

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.

Nice!

Comment thread src/parseTools.js
const POINTER_BITS = POINTER_SIZE * 8;
const POINTER_TYPE = 'i' + POINTER_BITS;

const SIZE_TYPE = POINTER_TYPE;

Copy link
Copy Markdown
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
Copy Markdown
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