[llvm-commits] CVS: llvm/lib/Reoptimizer/Inst/lib/PhaseInfo.h Phases.cpp SparcInstManip.cpp

Joel Stanley jstanley at cs.uiuc.edu
Sun May 18 15:34:00 PDT 2003


Changes in directory llvm/lib/Reoptimizer/Inst/lib:

PhaseInfo.h updated: 1.8 -> 1.9
Phases.cpp updated: 1.32 -> 1.33
SparcInstManip.cpp updated: 1.12 -> 1.13

---
Log message:

Fixed page-permissions problem.


---
Diffs of the changes:

Index: llvm/lib/Reoptimizer/Inst/lib/PhaseInfo.h
diff -u llvm/lib/Reoptimizer/Inst/lib/PhaseInfo.h:1.8 llvm/lib/Reoptimizer/Inst/lib/PhaseInfo.h:1.9
--- llvm/lib/Reoptimizer/Inst/lib/PhaseInfo.h:1.8	Sun May 18 12:45:25 2003
+++ llvm/lib/Reoptimizer/Inst/lib/PhaseInfo.h	Sun May 18 15:33:46 2003
@@ -16,7 +16,7 @@
 #define DEBUG 1
 #if DEBUG
 // Maximum verbosity is level 5
-#define VERBOSE 4
+#define VERBOSE 2
 #define DEBUG_MSG(v, x) if(VERBOSE >= v) std::cerr << "[pp] " << x
 #define HEX(x) std::hex << x << std::dec
 #else


Index: llvm/lib/Reoptimizer/Inst/lib/Phases.cpp
diff -u llvm/lib/Reoptimizer/Inst/lib/Phases.cpp:1.32 llvm/lib/Reoptimizer/Inst/lib/Phases.cpp:1.33
--- llvm/lib/Reoptimizer/Inst/lib/Phases.cpp:1.32	Sun May 18 12:45:25 2003
+++ llvm/lib/Reoptimizer/Inst/lib/Phases.cpp	Sun May 18 15:33:46 2003
@@ -373,7 +373,7 @@
         copySnippetToSlot(snippet, slotBase, m_pTC->getVM(), m_pIM);
 
         // just one candidate for now
-        break;
+        //break;
     }
 }
 


Index: llvm/lib/Reoptimizer/Inst/lib/SparcInstManip.cpp
diff -u llvm/lib/Reoptimizer/Inst/lib/SparcInstManip.cpp:1.12 llvm/lib/Reoptimizer/Inst/lib/SparcInstManip.cpp:1.13
--- llvm/lib/Reoptimizer/Inst/lib/SparcInstManip.cpp:1.12	Sun May 18 12:45:26 2003
+++ llvm/lib/Reoptimizer/Inst/lib/SparcInstManip.cpp	Sun May 18 15:33:47 2003
@@ -208,6 +208,8 @@
     unsigned retAddrStkOff = STKFRM_MIN + sharedSize + 2 * WORD_WIDTH;
     unsigned* heapSlot = buildPhase5HeapSlot(gbte, sharedSize, retAddrStkOff);
 
+    DEBUG_MSG(2, "buildPhase5HeapSlot completed\n");
+
     // If we're dealing with a start-interval instrumentation function, heap-allocate
     // its parameter memory
 
@@ -250,6 +252,7 @@
     generateBranchAlways(instAddr + getInstWidth(), slotBase, getSPSub(-stkSize));
 
     endCode();
+    DEBUG_MSG(2, "buildSlot(p5) completed\n");
 }
 
 unsigned SparcInstManip::getSlotSize(Phase2* p2) const
@@ -319,7 +322,6 @@
         im->printInst(*curr);
         cerr << endl;
     }
-    DEBUG_MSG(3, "Done with heap region construction, moving on to jump slot\n");
 }
 
 static void copySnippetToHeapSlot(vector<unsigned>& snippet,
@@ -384,11 +386,18 @@
     endCode();
 
     copySnippetToHeapSlot(heapcode, heapSlot, getPhase5HeapSize());
-    setPageBits(heapSlot, numHeapBytes, PROT_READ | PROT_EXEC);
+
+    // NB: Clearing PROT_WRITE here will result in subsequent valloc/memalign calls
+    // segfaulting.  Apparently, write access to the page is still needed for later heap
+    // allocations from the same page, although the requirement of write access is
+    // somewhat unclear.
+
+    setPageBits(heapSlot, numHeapBytes, PROT_READ | PROT_WRITE | PROT_EXEC);
 
 #if VERBOSE > 2
     DEBUG_MSG(3, "Dumping contents of heap-slot memory...\n");
     dumpHeapSlot(heapSlot, getPhase5HeapSize(), this);
+    DEBUG_MSG(3, "Done with heap region construction, moving on to jump slot\n");
 #endif
 
     return heapSlot;





More information about the llvm-commits mailing list