Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3244072
Hide align behind a jmp
kunalspathak Oct 8, 2021
e7c0710
Fix a problem where curIG==0 and loop might be emitted in curIG, adju…
kunalspathak Oct 22, 2021
bd922aa
Add stress mode to emit int3 for xarch
kunalspathak Oct 22, 2021
4d0f912
Add stress mode to emit bkpt for arm64
kunalspathak Oct 22, 2021
8d64351
Add a loop align instruction placement phase
kunalspathak Oct 29, 2021
9b9b616
review comments
kunalspathak Oct 29, 2021
6302975
Change from unsigned short to unsigned
kunalspathak Oct 29, 2021
d20da6d
review comments around cleanup
kunalspathak Nov 10, 2021
c6a2d70
emitForceNewIG
kunalspathak Nov 10, 2021
e9c5eec
Remove emitPrevIG
kunalspathak Nov 10, 2021
c1c5db3
Revert change to forceNewIG for align instruction
kunalspathak Nov 10, 2021
b8a9742
Use loopAlignCandidates
kunalspathak Nov 11, 2021
db98ec2
Use loopHeadIG reference
kunalspathak Nov 11, 2021
5ab9edc
jit format
kunalspathak Nov 11, 2021
c8a9e01
Remove unneeded method
kunalspathak Nov 11, 2021
5bb1563
Misc changes
kunalspathak Nov 11, 2021
2c6e81d
Review feedback
kunalspathak Nov 12, 2021
bbc2ac5
Do not include align behind Jmp in PerfScore calculation
kunalspathak Nov 13, 2021
64bba41
jit format and fix a bug
kunalspathak Nov 15, 2021
1e24fcb
fix the loopCandidates == 0 scenario
kunalspathak Nov 15, 2021
b301fa5
Add unmarkLoopAlign(), add check for fgFirstBB
kunalspathak Nov 16, 2021
57759d0
merge conflict fix
kunalspathak Nov 16, 2021
ef0e859
Add missing }
kunalspathak Nov 16, 2021
976b253
Grammar nit
kunalspathak Nov 18, 2021
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
Prev Previous commit
Next Next commit
Add stress mode to emit int3 for xarch
  • Loading branch information
kunalspathak committed Nov 16, 2021
commit bd922aa6f74f2b4bdd73ad3fac08779bd3d5bb58
31 changes: 29 additions & 2 deletions src/coreclr/jit/emitxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10063,8 +10063,35 @@ BYTE* emitter::emitOutputAlign(insGroup* ig, instrDesc* id, BYTE* dst)
#endif

BYTE* dstRW = dst + writeableOffset;
if (emitComp->compStressCompile(Compiler::STRESS_EMITTER, 1) && !validatePadding && paddingToAdd >= 1)
// if (emitComp->opts.disAsm)

#ifdef DEBUG
// Under STRESS_EMITTER, if this is the 'align' before the 'jmp' instruction,
// then add "int3" instruction. Sinc int3 takes 1 byte, we would only add
// it if paddingToAdd >= 1 byte.

if(emitComp->compStressCompile(Compiler::STRESS_EMITTER, 1) &&
!validatePadding && paddingToAdd >= 1)
{
size_t int3Code = insCodeMR(INS_BREAKPOINT);
// There is no good way to squeeze in "int3" as well as display it
// in the disassembly because there is no corresponding instrDesc for
// it. As such, leave it as is, the "0xCC" bytecode will be seen next
// to the nop instruction in disasm
// e.g. CC align [1 bytes for IG29]
//
//if (emitComp->opts.disAsm)
//{
// emitDispInsAddr(dstRW);

// emitDispInsOffs(0, false);

// printf(" %-9s ; stress-mode injected interrupt\n", "int3");
//}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment? Or uncomment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally left it as commented so during debugging, we could uncomment and see the instruction. Let me know if you think otherwise.

dstRW += emitOutputByte(dstRW, int3Code);
paddingToAdd -= 1;
}
#endif

dstRW = emitOutputNOP(dstRW, paddingToAdd);
return dstRW - writeableOffset;
}
Expand Down