aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/splicer
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-01-10 14:09:24 -0500
committerGravatar Mike Klein <mtklein@chromium.org>2017-01-10 19:29:43 +0000
commit13ccda4847c1ec43c0015e090924cc9c3127feb9 (patch)
tree56edabc062a5fb889aae432d1511b4bcdc8a5708 /src/splicer
parent7ba89a15fcba8543da6bef56674cd0806dcc6439 (diff)
SkSplicer: fix aarch64 jump offset, turn on testing on aarch64 Android bots
I also updated the dump feature to work with aarch64, and included comments on how to disassemble an aarch64 dump. Looking at an aarch64 dump made it immediately obvious that the jump offset was off by 1. Change-Id: I17fa6ee44779e8be69ab4582e338c88212aba36c Reviewed-on: https://skia-review.googlesource.com/6841 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/splicer')
-rw-r--r--src/splicer/SkSplicer.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/splicer/SkSplicer.cpp b/src/splicer/SkSplicer.cpp
index 789b3593e2..9fcb99c0fb 100644
--- a/src/splicer/SkSplicer.cpp
+++ b/src/splicer/SkSplicer.cpp
@@ -14,10 +14,16 @@
#include "SkSplicer_generated.h"
#include "SkSplicer_shared.h"
-// Uncomment to dump output with IACA markers.
-// #define IACA_DUMP "/tmp/dump.o"
-// https://software.intel.com/en-us/articles/intel-architecture-code-analyzer
-// $ ./iaca.sh -arch HSW -64 -mark 0 /tmp/dump.o | less
+// Uncomment to dump output JIT'd pipeline.
+//#define DUMP "/tmp/dump.bin"
+//
+// On x86, we'll include IACA markers too.
+// https://software.intel.com/en-us/articles/intel-architecture-code-analyzer
+// Running IACA will disassemble, and more.
+// $ ./iaca.sh -arch HSW -64 -mark 0 /tmp/dump.bin | less
+//
+// To disassemble an aarch64 dump,
+// $ gobjdump -b binary -m aarch64 -D dump.bin
namespace {
@@ -56,7 +62,7 @@ namespace {
static void loop(SkWStream* buf, int loop_start) {
splice(buf, 0x91001000); // add x0, x0, #4
splice(buf, 0xeb01001f); // cmp x0, x1
- int off = loop_start - (int)(buf->bytesWritten() + 4); // TODO: check that this is right
+ int off = loop_start - (int)buf->bytesWritten();
off /= 4; // bytes -> instructions, still signed
off = (off & 0x7ffff) << 5; // 19 bit maximum range (+- 256K instructions)
splice(buf, 0x54000003 | off); // b.cc loop_start (cc == "carry clear", unsigned less than)
@@ -93,7 +99,7 @@ namespace {
}
#endif
-#ifdef IACA_DUMP
+#if !defined(__aarch64__) && defined(DUMP)
static const uint8_t ud2[] = { 0x0f, 0x0b }; // undefined... crashes when run
static const uint8_t nop3[] = { 0x64, 0x67, 0x90 }; // 3 byte no-op
static const uint8_t movl_ebx[] = { 0xbb }; // move next 4 bytes into ebx
@@ -204,8 +210,8 @@ namespace {
fSplicedLen = data->size();
fSpliced = copy_to_executable_mem(data->data(), fSplicedLen);
- #ifdef IACA_DUMP
- SkFILEWStream(IACA_DUMP).write(data->data(), data->size());
+ #if defined(DUMP)
+ SkFILEWStream(DUMP).write(data->data(), data->size());
#endif
}