From 6f29f0be4f699d6aacde916e3ce15ff0f90c48ea Mon Sep 17 00:00:00 2001 From: monojenkins Date: Tue, 17 Nov 2020 20:38:57 -0500 Subject: [PATCH] [wasm] Use the functions in emscripten/stack.h to compute stack bounds. (#44819) Co-authored-by: vargaz --- src/mono/mono/utils/mono-threads-wasm.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/mono/mono/utils/mono-threads-wasm.c b/src/mono/mono/utils/mono-threads-wasm.c index 33f4688..dc792e8 100644 --- a/src/mono/mono/utils/mono-threads-wasm.c +++ b/src/mono/mono/utils/mono-threads-wasm.c @@ -10,6 +10,7 @@ #include #include +#include #include #define round_down(addr, val) ((void*)((addr) & ~((val) - 1))) @@ -18,19 +19,14 @@ EMSCRIPTEN_KEEPALIVE static int wasm_get_stack_base (void) { - // Return the bottom limit of the stack - return EM_ASM_INT ({ - return STACK_MAX; - }); + return emscripten_stack_get_end (); } EMSCRIPTEN_KEEPALIVE static int wasm_get_stack_size (void) { - return EM_ASM_INT ({ - return TOTAL_STACK; - }); + return (guint8*)emscripten_stack_get_base () - (guint8*)emscripten_stack_get_end (); } int -- 2.7.4