Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions src/coreclr/jit/codegenwasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "gcinfoencoder.h"

static const int LINEAR_MEMORY_INDEX = 0;
Comment thread
kg marked this conversation as resolved.
// stackPointer is the 0th global in our generated Wasm modules
static const int STACK_POINTER_GLOBAL = 0;
Comment thread
kg marked this conversation as resolved.

#ifdef TARGET_64BIT
static const instruction INS_I_load = INS_i64_load;
Expand Down Expand Up @@ -144,16 +146,20 @@ void CodeGen::genAllocLclFrame(unsigned frameSize, regNumber initReg, bool* pIni

m_compiler->unwindAllocStack(frameSize);

// TODO-WASM: reverse pinvoke frame allocation
//
unsigned initialSPLclIndex;
unsigned spLclIndex = WasmRegToIndex(spReg);
if (!m_compiler->lvaGetDesc(m_compiler->lvaWasmSpArg)->lvIsParam)
{
NYI_WASM("alloc local frame for reverse pinvoke");
initialSPLclIndex = spLclIndex;
GetEmitter()->emitIns_I(INS_global_get, EA_PTRSIZE, STACK_POINTER_GLOBAL);
GetEmitter()->emitIns_I(INS_local_set, EA_PTRSIZE, initialSPLclIndex);
}
else
{
initialSPLclIndex =
WasmRegToIndex(m_compiler->lvaGetParameterABIInfo(m_compiler->lvaWasmSpArg).Segment(0).GetRegister());
}

unsigned initialSPLclIndex =
WasmRegToIndex(m_compiler->lvaGetParameterABIInfo(m_compiler->lvaWasmSpArg).Segment(0).GetRegister());
unsigned spLclIndex = WasmRegToIndex(spReg);
assert(initialSPLclIndex == spLclIndex);
if (frameSize != 0)
{
Expand Down
Loading