[wasm] allocate Asyncify setjmp buffer in heap

`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.
This commit is contained in:
Yuta Saito 2023-11-12 07:18:01 +09:00
parent f1b95095d6
commit 50a5b76dec
3 changed files with 62 additions and 5 deletions

2
vm.c
View file

@ -2462,7 +2462,7 @@ vm_exec(rb_execution_context_t *ec)
rb_wasm_try_catch_init(&try_catch, vm_exec_bottom_main, vm_exec_bottom_rescue, &ctx);
rb_wasm_try_catch_loop_run(&try_catch, &_tag.buf);
rb_wasm_try_catch_loop_run(&try_catch, &RB_VM_TAG_JMPBUF_GET(_tag.buf));
result = ctx.result;
#else