From: Rodrigo Kumpera Date: Mon, 21 Aug 2017 22:30:16 +0000 (-0700) Subject: [wasm] Add wasm stubs for MonoContext and membar ops. X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;ds=sidebyside;h=61529745be76d5395f6d7eb260d0779e668972c5;p=mono.git [wasm] Add wasm stubs for MonoContext and membar ops. --- diff --git a/mono/utils/mono-context.h b/mono/utils/mono-context.h index b26442f73f5..827e0ed9f81 100644 --- a/mono/utils/mono-context.h +++ b/mono/utils/mono-context.h @@ -34,7 +34,25 @@ typedef struct __darwin_xmm_reg MonoContextSimdReg; * MONO_CONTEXT_GET_CURRENT captures the current context as close as possible. One reg might be clobbered * to hold the address of the target MonoContext. It will be a caller save one, so should not be a problem. */ -#if (defined(__i386__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_X86)) +#if defined (TARGET_WASM) + +typedef struct { + mgreg_t wasm_sp; + mgreg_t wasm_bp; + mgreg_t llvm_exc_reg; + mgreg_t wasm_ip; + mgreg_t wasm_pc; +} MonoContext; + +#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->wasm_ip = (mgreg_t)(ip); } while (0); +#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->wasm_bp = (mgreg_t)(bp); } while (0); +#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->wasm_sp = (mgreg_t)(sp); } while (0); + +#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->wasm_ip)) +#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->wasm_bp)) +#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->wasm_sp)) + +#elif (defined(__i386__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_X86)) /*HACK, move this to an eventual mono-signal.c*/ #if defined( __linux__) || defined(__sun) || defined(__APPLE__) || defined(__NetBSD__) || \ diff --git a/mono/utils/mono-membar.h b/mono/utils/mono-membar.h index 3f937b3b431..7abf273a650 100644 --- a/mono/utils/mono-membar.h +++ b/mono/utils/mono-membar.h @@ -15,7 +15,22 @@ #include -#ifdef _MSC_VER + +#ifdef TARGET_WASM + +static inline void mono_memory_barrier (void) +{ +} + +static inline void mono_memory_read_barrier (void) +{ +} + +static inline void mono_memory_write_barrier (void) +{ +} + +#elif _MSC_VER #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif