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

Use absolute memory addresses for emasm string indexes. #2408

Merged
merged 2 commits into from
Oct 31, 2019
Merged

Conversation

sbc100
Copy link
Member

@sbc100 sbc100 commented Oct 30, 2019

Before we used 0-based indexes which meant that we needed to modify the
code calling the emask function to replace the first argument.

Now we use the string address itself as the index/code for the emasm
constant. This allows use code to go unmodifed as the emscripten side
will accept the memory address as the index/code.

See: emscripten-core/emscripten#9013

}

auto* value = arg->cast<Const>();
auto code = codeForConstAddr(wasm, segmentOffsets, value);
auto& asmConst = createAsmConst(code, sig, importName);
int32_t address = value->value.geti32();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reason codeForConstAddr changed from taking a Const* to an int32_t? It seems like this was a partial change that didn't make it in to the final PR, so the effect was that we just outlined the value->value.geti32() bit.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, I outlines it because it need to use that address in two places now. Maybe I should just have both consumers call ->value.geti32()?

Before we used 0-based indexes which meant that we needed to modify the
code calling the emask function to replace the first argument.

Now we use the string address itself as the index/code for the emasm
constant.  This allows use code to go unmodifed as the emscripten side
will accept the memory address as the index/code.

See: emscripten-core/emscripten#9013
@sbc100 sbc100 requested a review from kripken October 30, 2019 22:40
@sbc100
Copy link
Member Author

sbc100 commented Oct 30, 2019

PTAL

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.

2 participants