[PATCH] D73015: Add more detailed comment for ORC stub code

Axis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 19 21:04:39 PST 2020


dongAxis created this revision.
dongAxis added a reviewer: MaskRay.
dongAxis added a project: Speculative Compilation in ORC.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

0xF1C40000000025ff means 
stub1:

  jmpq    *ptr1(%rip)
  .byte   0xC4         ; <- Invalid opcode padding.
  .byte   0xF1

But 0xF1C40000000025ff is hard to understand what is means. So i use this patch to make code more readable.


Repository:
  rL LLVM

https://reviews.llvm.org/D73015

Files:
  llvm/lib/ExecutionEngine/Orc/OrcABISupport.cpp


Index: llvm/lib/ExecutionEngine/Orc/OrcABISupport.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/OrcABISupport.cpp
+++ llvm/lib/ExecutionEngine/Orc/OrcABISupport.cpp
@@ -252,8 +252,13 @@
   uint64_t *Stub = reinterpret_cast<uint64_t *>(StubsBlock.base());
   uint64_t PtrOffsetField = static_cast<uint64_t>(NumPages * PageSize - 6)
                             << 16;
+  uint8_t StubCode[8] = {
+      0xFF, 0x25, 0x00, 0x00, 0x00, 0x00,   // jmpq    *0x00 (%rip)
+      0xC4,                                 // invalid code: 0xC4, 0xF1
+      0xF1
+  };
   for (unsigned I = 0; I < NumStubs; ++I)
-    Stub[I] = 0xF1C40000000025ff | PtrOffsetField;
+    Stub[I] = *(uint64_t *)StubCode | PtrOffsetField;
 
   if (auto EC = sys::Memory::protectMappedMemory(
           StubsBlock, sys::Memory::MF_READ | sys::Memory::MF_EXEC))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73015.239025.patch
Type: text/x-patch
Size: 885 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200120/7c478a9f/attachment.bin>


More information about the llvm-commits mailing list