Skip to content

[wasm] allocate Asyncify setjmp buffer in heap#8902

Merged
kateinoigakukun merged 1 commit intoruby:masterfrom
kateinoigakukun:katei/heap-alloc-jmpbuf
Nov 13, 2023
Merged

[wasm] allocate Asyncify setjmp buffer in heap#8902
kateinoigakukun merged 1 commit intoruby:masterfrom
kateinoigakukun:katei/heap-alloc-jmpbuf

Conversation

@kateinoigakukun
Copy link
Member

rb_jmpbuf_t type is considerably large due to inline-allocated Asyncify buffer, and it leads to stack overflow even with small number of C-method call frames. This commit allocates the Asyncify buffer used by rb_wasm_setjmp in heap to mitigate the issue.

This patch introduces a new type rb_vm_tag_jmpbuf_t to abstract the representation of a jump buffer, and init/deinit hook points to manage lifetime of the buffer. These changes are effectively NFC for non-wasm platforms.

@kateinoigakukun kateinoigakukun marked this pull request as draft November 11, 2023 23:58
`rb_jmpbuf_t` type is considerably large due to inline-allocated
Asyncify buffer, and it leads to stack overflow even with small number
of C-method call frames. This commit allocates the Asyncify buffer used
by `rb_wasm_setjmp` in heap to mitigate the issue.

This patch introduces a new type `rb_vm_tag_jmpbuf_t` to abstract the
representation of a jump buffer, and init/deinit hook points to manage
lifetime of the buffer. These changes are effectively NFC for non-wasm
platforms.
@kateinoigakukun kateinoigakukun marked this pull request as ready for review November 13, 2023 04:19
@kateinoigakukun kateinoigakukun merged commit 50a5b76 into ruby:master Nov 13, 2023
@kateinoigakukun kateinoigakukun deleted the katei/heap-alloc-jmpbuf branch November 13, 2023 10:17
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.

1 participant