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

Add binaryen option --add-stack-limit-global #2849

Closed
wants to merge 2 commits into from

Conversation

juj
Copy link
Collaborator

@juj juj commented May 14, 2020

Add binaryen option --add-stack-limit-global to enable controlling when to emit the stack limit global variable to the wasm module.

juj added 2 commits May 14, 2020 14:16
…en to emit the stack limit global variable to the wasm module
@kripken
Copy link
Member

kripken commented May 14, 2020

This should be controlled by the emscripten ASSERTIONS flag - is that not good enough for some reason?

@juj
Copy link
Collaborator Author

juj commented May 14, 2020

This is for release builds. We want to have ability to check free stack space, but not emit runtime stack checks or other debug code.

@kripken
Copy link
Member

kripken commented May 14, 2020

We want to have ability to check free stack space

Oh, can't you do that with stackSave() already? That gets the current stack location. Then you have STACK_BASE and STACK_MAX which is the valid range for it.

@sbc100
Copy link
Member

sbc100 commented May 15, 2020

Hopefully a lot of this will not be necessary in emscripten-core/emscripten#11166 lands.

After this change it should be possible to these two new functions as aliases that live in system/lib/compiler-rt/stack_ops.s which can then be exported as needed via EXPORTED_FUNCTIONS.

The alias syntax in the .s format is:

.set alias_of_foo, foo

@juj
Copy link
Collaborator Author

juj commented May 15, 2020

Oh, can't you do that with stackSave() already?

I was not able to call stackSave() from C code, that did not seem possible, although with Sam's assembly code that would become a possibility?

Then you have STACK_BASE and STACK_MAX which is the valid range for it.

Also was not able to access these from within wasm, without having to jump out to JS.

@sbc100
Copy link
Member

sbc100 commented May 17, 2020

Oh, can't you do that with stackSave() already?

I was not able to call stackSave() from C code, that did not seem possible, although with Sam's assembly code that would become a possibility?

Yes, as of, #11166 you should now be able to call stackSave() and friends from the C code.

Then you have STACK_BASE and STACK_MAX which is the valid range for it.

Also was not able to access these from within wasm, without having to jump out to JS.

@juj
Copy link
Collaborator Author

juj commented Mar 22, 2022

This was resolved in another way earlier, so no longer relevant.

@juj juj closed this Mar 22, 2022
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