Skip to content

Commit

Permalink
Remove arm64 neardiffer hack (#96266)
Browse files Browse the repository at this point in the history
Reverts #91668

The hack should no longer be necessary with a new coredistools library
(version 1.4.0) based on LLVM 17.0.6.
  • Loading branch information
BruceForstall authored Jan 3, 2024
1 parent 5a2d151 commit bc0b28f
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions src/coreclr/tools/superpmi/superpmi/neardiffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1310,45 +1310,6 @@ bool NearDiffer::compare(MethodContext* mc, CompileResult* cr1, CompileResult* c
orig_roDataBlock_2 = (void*)((size_t)orig_hotCodeBlock_2 + nativeSizeOfCode_2);
hotCodeSize_2 = nativeSizeOfCode_2;
}

auto rewriteUnsupportedInstrs = [](unsigned char* bytes, size_t numBytes) {
for (size_t i = 0; i < numBytes; i += 4)
{
uint32_t inst;
memcpy(&inst, &bytes[i], 4);

const uint32_t ldapurMask = 0b00111111111000000000110000000000;
const uint32_t ldapurBits = 0b00011001010000000000000000000000;
const uint32_t ldurBits = 0b00111000010000000000000000000000;

const uint32_t stlurMask = 0b00111111111000000000110000000000;
const uint32_t stlurBits = 0b00011001000000000000000000000000;
const uint32_t sturBits = 0b00111000000000000000000000000000;
if ((inst & ldapurMask) == ldapurBits)
{
inst ^= (ldapurBits ^ ldurBits);
memcpy(&bytes[i], &inst, 4);
}
else if ((inst & stlurMask) == stlurBits)
{
inst ^= (stlurBits ^ sturBits);
memcpy(&bytes[i], &inst, 4);
}
}
};

// As of 2023-09-13, our coredistools does not support stlur/ldapur
// instructions, so we rewrite them into supported stur/ldur
// instructions before passing them to the near differ. This means we
// will miss diffs when changing stlur<->stur and ldapur<->ldur,
// but this is better than the decode failure that otherwise results
// (which shows up as a zero-sized diff unconditionally).
// This code should be removed once a new coredistools is compiled that
// supports new instructions.
rewriteUnsupportedInstrs(hotCodeBlock_1, hotCodeSize_1);
rewriteUnsupportedInstrs(coldCodeBlock_1, coldCodeSize_1);
rewriteUnsupportedInstrs(hotCodeBlock_2, hotCodeSize_2);
rewriteUnsupportedInstrs(coldCodeBlock_2, coldCodeSize_2);
}

LogDebug("HCS1 %d CCS1 %d RDS1 %d xcpnt1 %d flag1 %08X, HCB %p CCB %p RDB %p ohcb %p occb %p odb %p", hotCodeSize_1,
Expand Down

0 comments on commit bc0b28f

Please sign in to comment.