Skip to content

SAFE_HEAP: remove fastcomp, prepare for new emscripten approach #3078

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 5 commits into from
Aug 25, 2020

Conversation

kripken
Copy link
Member

@kripken kripken commented Aug 25, 2020

In fastcomp we implemented emscripten_get_sbrk_ptr in wasm, and
exported _emscripten_get_sbrk_ptr. We don't need that anymore and
can remove it.

However I want to switch us to implementing emscripten_get_sbrk_ptr
in wasm in upstream too, as part of removing DYNAMICTOP_PTR and
other silliness that we have around link (#3043).

This makes us support an export of emscripten_get_sbrk_ptr (no
prefix), and also it makes sure not to instrument that function, which
may contain some memory operations itself, but if we SAFE_HEAP-ify
them we'd get infinite recursion, as the SAFE_HEAP methods need to
call that.

@kripken kripken requested review from sbc100 and tlively August 25, 2020 14:44
@@ -102,13 +109,14 @@ struct AccessInstrumenter : public WalkerPass<PostWalker<AccessInstrumenter>> {

struct SafeHeap : public Pass {
PassOptions options;
Name funcToIgnore;
Copy link
Member

Choose a reason for hiding this comment

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

This simultaneously looks like a general mechanism for ignoring functions (due to the name) and also like a very specific mechanism (because there is only one name). Would it make more sense to name it something like shouldIgnoreGetSbrkPtr and make it a bool to make it clear that it is a very specific mechanism that is only used for that one thing?

Copy link
Member Author

Choose a reason for hiding this comment

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

A bool would be inconvenient actually, because we need to know the name. If we just pass a bool to a function-parallel pass like this, then each instance (one per function) would need to look up the function name, and we need to look it up because we need to find an export with that name - there may be no Name section, but the export is guaranteed.

Copy link
Member Author

Choose a reason for hiding this comment

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

(I can add a comment explaining this more, if you think that's useful?)

Copy link
Member

Choose a reason for hiding this comment

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

I see. Perhaps a name like GetSbrkPtrFuncToIgnore would be more descriptive then?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, yeah, a better name could help here. How about getSbrkPtrName (which matches getSbrkPtr which is the actual function), which I pushed now?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh wait... getSbrkPtr was already the name. So no new variable or name was needed! Fixed.

Copy link
Member

@tlively tlively left a comment

Choose a reason for hiding this comment

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

👍

@kripken kripken merged commit 18d6780 into master Aug 25, 2020
@kripken kripken deleted the newsafe branch August 25, 2020 22:22
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