Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions src/coreclr/jit/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,11 @@ class CodeGen final : public CodeGenInterface
// Prolog functions and data (there are a few exceptions for more generally used things)
//

void genEstablishFramePointer(int delta, bool reportUnwindData);
void genHomeRegisterParams(regNumber initReg, bool* initRegStillZeroed);
void genEstablishFramePointer(int delta, bool reportUnwindData);
void genHomeRegisterParams(regNumber initReg, bool* initRegStillZeroed);
#ifdef TARGET_WASM
void genHomeRegisterParamsOutsideProlog();
#endif
regMaskTP genGetParameterHomingTempRegisterCandidates();

var_types genParamStackType(LclVarDsc* dsc, const ABIPassingSegment& seg);
Expand Down
10 changes: 10 additions & 0 deletions src/coreclr/jit/codegenlinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,16 @@ void CodeGen::genCodeForBBlist()
}
#endif

#ifdef TARGET_WASM
// genHomeRegisterParams can generate arbitrary amounts of code on Wasm, so
// we have moved it out of the prolog to the first basic block in order to
// work around the restriction that the prolog can only be one insGroup.
if (block->IsFirst())
{
genHomeRegisterParamsOutsideProlog();
}
Comment thread
kg marked this conversation as resolved.
Comment thread
kg marked this conversation as resolved.
#endif

#ifndef TARGET_WASM // TODO-WASM: enable genPoisonFrame
// Emit poisoning into the init BB that comes right after prolog.
// We cannot emit this code in the prolog as it might make the prolog too large.
Expand Down
25 changes: 18 additions & 7 deletions src/coreclr/jit/codegenwasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,22 @@ void CodeGen::genEnregisterOSRArgsAndLocals()
//------------------------------------------------------------------------
// genHomeRegisterParams: place register arguments into their RA-assigned locations.
//
// We can't actually do this task here because the prolog will overflow. Instead, we
// do this later on and inject all the relevant code into the first basic block.
// See genHomeRegisterParamsOutsideProlog, below.
//
// Arguments:
// initReg - Unused
// initRegStillZeroed - Unused
//
void CodeGen::genHomeRegisterParams(regNumber initReg, bool* initRegStillZeroed)
{
// Intentionally empty
}
Comment thread
kg marked this conversation as resolved.

//------------------------------------------------------------------------
// genHomeRegisterParamsOutsideProlog: place register arguments into their RA-assigned locations.
//
// For the WASM RA, we have a much simplified (compared to LSRA) contract of:
// - If an argument is live on entry in a set of registers, then the RA will
// assign those registers to that argument on entry.
Expand All @@ -129,14 +145,9 @@ void CodeGen::genEnregisterOSRArgsAndLocals()
// The main motivation for this (along with the obvious CQ implications) is
// obviating the need to adapt the general "RegGraph"-based algorithm to
// !HAS_FIXED_REGISTER_SET constraints (no reg masks).
//
// Arguments:
// initReg - Unused
// initRegStillZeroed - Unused
//
void CodeGen::genHomeRegisterParams(regNumber initReg, bool* initRegStillZeroed)
void CodeGen::genHomeRegisterParamsOutsideProlog()
{
JITDUMP("*************** In genHomeRegisterParams()\n");
JITDUMP("*************** In genHomeRegisterParamsOutsideProlog()\n");

auto spillParam = [this](unsigned lclNum, unsigned offset, unsigned paramLclNum, const ABIPassingSegment& segment) {
assert(segment.IsPassedInRegister());
Expand Down
5 changes: 4 additions & 1 deletion src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9765,7 +9765,8 @@ insGroup* emitter::emitAllocIG()
ig = (insGroup*)emitGetMem(sz);

#ifdef DEBUG
ig->igSelf = ig;
ig->igSelf = ig;
ig->igDataSize = 0;
#endif

#if EMITTER_STATS
Expand Down Expand Up @@ -9832,6 +9833,8 @@ void emitter::emitInitIG(insGroup* ig)
// Explicitly call init, since IGs don't actually have a constructor.
ig->igBlocks.jitstd::list<BasicBlock*>::init(m_compiler->getAllocator(CMK_DebugOnly));
#endif

ig->igData = nullptr;
}

/*****************************************************************************
Expand Down
Loading