From b2f27e0a96a44573ebf97f729a1b6be2f57f4c51 Mon Sep 17 00:00:00 2001 From: Pent Ploompuu Date: Tue, 27 Nov 2018 23:24:30 +0200 Subject: [PATCH] Diff-able disassembly fixes (dotnet/coreclr#20863) Commit migrated from https://github.com/dotnet/coreclr/commit/3766ae3f90fa8cb9bc5ae28370b45053ce85248b --- src/coreclr/src/jit/emitxarch.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/coreclr/src/jit/emitxarch.cpp b/src/coreclr/src/jit/emitxarch.cpp index f572ce1..366124c 100644 --- a/src/coreclr/src/jit/emitxarch.cpp +++ b/src/coreclr/src/jit/emitxarch.cpp @@ -7852,16 +7852,16 @@ void emitter::emitDispAddrMode(instrDesc* id, bool noDetail) else { // Munge any pointers if we want diff-able disassembly - if (emitComp->opts.disDiffable) + // It's assumed to be a pointer when disp is outside of the range (-1M, +1M); top bits are not 0 or -1 + if (!frameRef && emitComp->opts.disDiffable && (static_cast((disp >> 20) + 1) > 1)) { - ssize_t top12bits = (disp >> 20); - if ((top12bits != 0) && (top12bits != -1)) + if (nsep) { - disp = 0xD1FFAB1E; + printf("+"); } + printf("D1FFAB1EH"); } - - if (disp > 0) + else if (disp > 0) { if (nsep) { @@ -7898,8 +7898,12 @@ void emitter::emitDispAddrMode(instrDesc* id, bool noDetail) { printf("-%04XH", -disp); } - else if ((disp & 0x7F000000) != 0x7F000000) + else if (disp < -0xFFFFFF) { + if (nsep) + { + printf("+"); + } printf("%08XH", disp); } else @@ -8271,7 +8275,7 @@ void emitter::emitDispIns( { printf("%d", val); } - else if ((val > 0) || ((val & 0x7F000000) != 0x7F000000)) + else if ((val > 0) || (val < -0xFFFFFF)) { printf("0x%IX", val); } -- 2.7.4