2 #include "wasm/machine.h"
3 #include "wasm/asyncify.h"
5 #ifndef WASM_SCAN_STACK_BUFFER_SIZE
6 # define WASM_SCAN_STACK_BUFFER_SIZE 6144
12 uint8_t buffer
[WASM_SCAN_STACK_BUFFER_SIZE
];
16 init_asyncify_buf(struct asyncify_buf
* buf
)
18 buf
->top
= &buf
->buffer
[0];
19 buf
->end
= &buf
->buffer
[WASM_SCAN_STACK_BUFFER_SIZE
];
22 static void *_rb_wasm_active_scan_buf
= NULL
;
25 rb_wasm_scan_locals(rb_wasm_scan_func scan
)
27 static struct asyncify_buf buf
;
28 static int spilling
= 0;
31 init_asyncify_buf(&buf
);
32 _rb_wasm_active_scan_buf
= &buf
;
33 asyncify_start_unwind(&buf
);
35 asyncify_stop_rewind();
37 _rb_wasm_active_scan_buf
= NULL
;
38 scan(buf
.top
, buf
.end
);
42 static void *rb_wasm_stack_base
= NULL
;
44 __attribute__((constructor
))
46 rb_wasm_record_stack_base(void)
48 rb_wasm_stack_base
= rb_wasm_get_stack_pointer();
53 rb_wasm_stack_get_base(void)
55 return rb_wasm_stack_base
;
59 rb_wasm_handle_scan_unwind(void)
61 return _rb_wasm_active_scan_buf
;