[llvm-commits] CVS: reopt/lib/TraceCache/TraceCache.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Thu Jul 8 02:15:01 PDT 2004
Changes in directory reopt/lib/TraceCache:
TraceCache.cpp updated: 1.20 -> 1.21
---
Log message:
Refactor duplicated code from various TraceCache constructors into init method.
---
Diffs of the changes: (+18 -39)
Index: reopt/lib/TraceCache/TraceCache.cpp
diff -u reopt/lib/TraceCache/TraceCache.cpp:1.20 reopt/lib/TraceCache/TraceCache.cpp:1.21
--- reopt/lib/TraceCache/TraceCache.cpp:1.20 Fri Apr 23 16:25:12 2004
+++ reopt/lib/TraceCache/TraceCache.cpp Thu Jul 8 02:14:16 2004
@@ -21,57 +21,36 @@
using std::cerr;
using namespace llvm;
-TraceCache::TraceCache(int limitSize){
- mm = new MemoryManager();
-
- assert(limitSize <= mm->getMemSize() && "can't allocate this large space");
+void TraceCache::init (int limitSize) {
+ assert (limitSize <= mm->getMemSize () && "can't allocate this large space");
limit = limitSize;
-
isLimitSet = true;
currSize = 0;
-
- vm = new VirtualMem();
}
-TraceCache::TraceCache(){
- mm = new MemoryManager();
-
- isLimitSet = true; //making limit as the size of memory
- currSize = 0;
- limit = mm->getMemSize();
-
- vm = new VirtualMem();
+TraceCache::TraceCache (int lim)
+ : vm (new VirtualMem), mm (new MemoryManager) {
+ init (lim);
}
-TraceCache::TraceCache(VirtualMem *vmem){
- mm = new MemoryManager();
-
- isLimitSet = true; //making limit as the size of memory
- currSize = 0;
- limit = mm->getMemSize();
-
- vm = vmem;
+TraceCache::TraceCache ()
+ : vm (new VirtualMem), mm (new MemoryManager) {
+ init (mm->getMemSize ());
}
-TraceCache::TraceCache(unsigned int memSize, VirtualMem *vmem){
- mm = new MemoryManager(memSize);
-
- isLimitSet = true; //making limit as the size of memory
- currSize = 0;
- limit = mm->getMemSize();
-
- vm = vmem;
+TraceCache::TraceCache (VirtualMem *vmem)
+ : vm (vmem), mm (new MemoryManager) {
+ init (mm->getMemSize ());
}
-TraceCache::TraceCache(void (*dfunc)(), unsigned int memSize,
- VirtualMem *vmem){
- mm = new MemoryManager(dfunc, memSize);
+TraceCache::TraceCache (unsigned int memSize, VirtualMem *vmem)
+ : vm (vmem), mm (new MemoryManager (memSize)) {
+ init (mm->getMemSize ());
+}
- isLimitSet = true; //making limit as the size of memory
- currSize = 0;
- limit = mm->getMemSize();
-
- vm = vmem;
+TraceCache::TraceCache(void (*dfunc)(), unsigned int memSize, VirtualMem *vmem)
+ : vm (vmem), mm (new MemoryManager (dfunc, memSize)) {
+ init (mm->getMemSize ());
}
void TraceCache::setLimit(int n) {
More information about the llvm-commits
mailing list