File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2166,6 +2166,9 @@ template <> OBJECTREF* TGcInfoDecoder<InterpreterGcInfoEncoding>::GetStackSlot(
21662166}
21672167#endif
21682168
2169+ #ifdef TARGET_WASM
2170+ TADDR GetWasmFramePointerFromStackPointer (TADDR sp);
2171+ #endif
21692172
21702173template <typename GcInfoEncoding> OBJECTREF * TGcInfoDecoder<GcInfoEncoding>::GetStackSlot(
21712174 INT32 spOffset,
@@ -2188,6 +2191,17 @@ template <typename GcInfoEncoding> OBJECTREF* TGcInfoDecoder<GcInfoEncoding>::Ge
21882191 _ASSERTE ( GC_FRAMEREG_REL == spBase );
21892192 _ASSERTE ( NO_STACK_BASE_REGISTER != m_StackBaseRegister );
21902193
2194+ #ifdef TARGET_WASM
2195+ // Wasm is a bit strange and when we do SetStackBaseRegister(REG_FPBASE)
2196+ // what that actually does is set it to REG_NA, which currently has the value 2.
2197+ _ASSERTE ( 2 == m_StackBaseRegister );
2198+ // We have the stack pointer, use it to recover the frame pointer.
2199+ TADDR pFrameReg = GetWasmFramePointerFromStackPointer ((TADDR )pRD->SP );
2200+
2201+ pObjRef = (OBJECTREF *)(pFrameReg + spOffset);
2202+
2203+ #else // TARGET_WASM
2204+
21912205 SIZE_T * pFrameReg = (SIZE_T *) GetRegisterSlot (m_StackBaseRegister, pRD);
21922206
21932207#if defined(TARGET_UNIX) && !defined(FEATURE_NATIVEAOT)
@@ -2201,6 +2215,7 @@ template <typename GcInfoEncoding> OBJECTREF* TGcInfoDecoder<GcInfoEncoding>::Ge
22012215#endif // TARGET_UNIX && !FEATURE_NATIVEAOT
22022216
22032217 pObjRef = (OBJECTREF *)(*pFrameReg + spOffset);
2218+ #endif // !TARGET_WASM
22042219 }
22052220
22062221 return pObjRef;
You can’t perform that action at this time.
0 commit comments