Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #1

Open
wants to merge 3 commits into
base: filament/prolog-debug
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions src/coreclr/jit/codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -522,9 +522,9 @@ class CodeGen final : public CodeGenInterface

void genReserveProlog(BasicBlock* block); // currently unused
void genReserveEpilog(BasicBlock* block);
#if defined(TARGET_AMD64)
#if defined(WINDOWS_AMD64_ABI)
void genFnPreProlog();
#endif // defined(TARGET_AMD64)
#endif // defined(WINDOWS_AMD64_ABI)
void genFnProlog();
void genFnEpilog(BasicBlock* block);

Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/jit/codegencommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5483,11 +5483,11 @@ void CodeGen::genFinalizeFrame()
* genFnPreProlog is optional (currently only on for x64 but eventually
* some frames will likely skip it).
*
* Although currently only being used for TARGET_AMD64, this is eventually
* Although currently only being used for WINDOWS_AMD64_ABI, this is eventually
* intended for all architectures, so it is not in codegenxarch.cpp.
*/

#if defined(TARGET_AMD64)
#if defined(WINDOWS_AMD64_ABI)
void CodeGen::genFnPreProlog()
{
ScopedSetVariable<bool> _setGeneratingPreProlog(&compiler->compGeneratingPreProlog, true);
Expand Down Expand Up @@ -5545,7 +5545,7 @@ void CodeGen::genFnPreProlog()

emit->emitEndPreProlog();
}
#endif // defined(TARGET_AMD64)
#endif // defined(WINDOWS_AMD64_ABI)

/*****************************************************************************
*
Expand Down
34 changes: 10 additions & 24 deletions src/coreclr/jit/emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,7 @@ void emitter::emitCheckIGoffsets()

#endif // DEBUG

#if defined(TARGET_AMD64)
#if defined(WINDOWS_AMD64_ABI)

void emitter::emitBegPreProlog()
{
Expand All @@ -1666,27 +1666,13 @@ void emitter::emitBegPreProlog()

int UnwindCodeNodeSize(UNWIND_CODE code)
{
int unwindCodeNodeSize = 1;
switch (code.UnwindOp)
if (code.UnwindOp == UWOP_ALLOC_LARGE)
{
case UWOP_ALLOC_LARGE:
if (code.OpInfo == 0)
unwindCodeNodeSize = 2;
else
unwindCodeNodeSize = 3;
break;

case UWOP_SAVE_XMM128:
case UWOP_SAVE_NONVOL:
unwindCodeNodeSize = 2;
break;

case UWOP_SAVE_NONVOL_FAR:
case UWOP_SAVE_XMM128_FAR:
unwindCodeNodeSize = 3;
break;
return (code.OpInfo == 0) ? 2 : 3;
}
return unwindCodeNodeSize;

// Since table gives -extra- slots, we add one for the actual size
return UnwindOpExtraSlotTable[code.UnwindOp] + 1;
}

void emitter::emitEndPreProlog()
Expand All @@ -1697,20 +1683,20 @@ void emitter::emitEndPreProlog()
FuncInfoDsc* func = emitComp->funCurrentFunc();
assert(func->unwindHeader.CountOfUnwindCodes == 0); // Can't call this after unwindReserve

auto unwindCodeStart = (UNWIND_CODE*)&func->unwindCodes[func->unwindCodeSlot];
auto unwindCodeEnd = (UNWIND_CODE*)&func->unwindCodes[sizeof(func->unwindCodes)];
auto unwindCodeStart = reinterpret_cast<UNWIND_CODE*>(&func->unwindCodes[func->unwindCodeSlot]);
auto unwindCodeEnd = reinterpret_cast<UNWIND_CODE*>(&func->unwindCodes[sizeof(func->unwindCodes)]);

int unwindCodeNodeSize = 1;
for (auto unwindCodeCurrent = unwindCodeStart; unwindCodeCurrent != unwindCodeEnd; unwindCodeCurrent += UnwindCodeNodeSize(*unwindCodeCurrent))
{
assert(unwindCodeCurrent < unwindCodeEnd); // Avoid a corrupted size leading to overrun by skipping the end
uint8_t oldCodeOffset = unwindCodeCurrent->CodeOffset;
uint8_t newCodeOffset = (uint8_t)(oldCodeOffset + prePrologSize);
assert(newCodeOffset > oldCodeOffset); // I'm not sure if we can overflow here, but an assert should help
unwindCodeCurrent->CodeOffset = newCodeOffset;
}
}

#endif // defined(TARGET_AMD64)
#endif // defined(WINDOWS_AMD64_ABI)


/*****************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/jit/emitpub.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ unsigned emitGetEpilogCnt();
template <typename Callback>
bool emitGenNoGCLst(Callback& cb);

#if defined(TARGET_AMD64)
#if defined(WINDOWS_AMD64_ABI)
void emitBegPreProlog();
void emitEndPreProlog();
#endif // defined(TARGET_AMD64)
#endif // defined(WINDOWS_AMD64_ABI)
void emitBegProlog();
unsigned emitGetPrologOffsetEstimate();
void emitMarkPrologEnd();
Expand Down