[vmkit-commits] [vmkit] r136914 - in /vmkit/trunk: ./ include/mvm/ include/mvm/Threads/ lib/J3/Classpath/ lib/J3/Compiler/ lib/J3/Compiler/AOT/ lib/J3/VMCore/ lib/Mvm/CommonThread/ lib/Mvm/Compiler/ lib/Mvm/Runtime/ lib/Mvm/StaticGCPrinter/ tools/j3/ tools/precompiler/ tools/precompiler/trainer/

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu Aug 4 13:29:08 PDT 2011


Author: geoffray
Date: Thu Aug  4 15:29:08 2011
New Revision: 136914

URL: http://llvm.org/viewvc/llvm-project?rev=136914&view=rev
Log:
Unify GC information between AOT compiled code and JIT compiled. There is now only one type of frame. The function cache is set with FrameInfo objects, and not MethodInfo objects anymore. Removed MethodInfo and all its children classes.



Removed:
    vmkit/trunk/lib/J3/Compiler/AOT/
Modified:
    vmkit/trunk/Makefile.rules
    vmkit/trunk/include/mvm/JIT.h
    vmkit/trunk/include/mvm/MethodInfo.h
    vmkit/trunk/include/mvm/MvmDenseSet.h
    vmkit/trunk/include/mvm/Threads/Thread.h
    vmkit/trunk/include/mvm/VirtualMachine.h
    vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc
    vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp
    vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp
    vmkit/trunk/lib/J3/Compiler/Makefile
    vmkit/trunk/lib/J3/VMCore/JavaClass.cpp
    vmkit/trunk/lib/J3/VMCore/JavaClass.h
    vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp
    vmkit/trunk/lib/J3/VMCore/JavaThread.cpp
    vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp
    vmkit/trunk/lib/J3/VMCore/Jnjvm.h
    vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp
    vmkit/trunk/lib/J3/VMCore/Precompiled.cpp
    vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp
    vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
    vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp
    vmkit/trunk/lib/Mvm/StaticGCPrinter/VmkitGCPrinter.cpp
    vmkit/trunk/tools/j3/Main.cpp
    vmkit/trunk/tools/precompiler/Precompiler.cpp
    vmkit/trunk/tools/precompiler/trainer/Makefile

Modified: vmkit/trunk/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/Makefile.rules?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/Makefile.rules (original)
+++ vmkit/trunk/Makefile.rules Thu Aug  4 15:29:08 2011
@@ -136,7 +136,7 @@
 ifdef BUILD_FRAMETABLE
 
 FrametablesExterns.inc: $(ProjLibsPaths)
-	$(Verb) nm $(ProjLibsPaths) | grep __frametable | sed 's/\([a-f0-9]*\) \([a-zA-Z]*\) _*\([a-zA-Z0-9_]*\)/extern "C" CamlFrames \3;/' > $@
+	$(Verb) nm $(ProjLibsPaths) | grep __frametable | sed 's/\([a-f0-9]*\) \([a-zA-Z]*\) _*\([a-zA-Z0-9_]*\)/extern "C" CompiledFrames \3;/' > $@
 
 FrametablesSymbols.inc: $(ProjLibsPaths)
 	$(Verb) nm $(ProjLibsPaths) | grep __frametable | sed 's/\([a-f0-9]*\) \([a-zA-Z]*\) _*\([a-zA-Z0-9_]*\)/\&\3,/' > $@

Modified: vmkit/trunk/include/mvm/JIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/JIT.h?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/JIT.h (original)
+++ vmkit/trunk/include/mvm/JIT.h Thu Aug  4 15:29:08 2011
@@ -195,6 +195,11 @@
                          llvm::Module* TheModule = 0,
                          llvm::TargetMachine* TheTarget = 0);
 
+   static Frames* addToVM(VirtualMachine* VM,
+                          llvm::GCFunctionInfo* GFI,
+                          llvm::JIT* jit,
+                          mvm::BumpPtrAllocator& allocator);
+
    static int disassemble(unsigned int* addr);
   
    static void protectIR();
@@ -205,26 +210,6 @@
    static const char* getHostTriple();
 };
 
-class JITMethodInfo : public MethodInfo {
-  llvm::GCFunctionInfo* GCInfo;
-public:
-  virtual void scan(uintptr_t closure, void* ip, void* addr);
-  JITMethodInfo(llvm::GCFunctionInfo* GFI) : GCInfo(GFI) {}
-  void addToVM(VirtualMachine* vm, llvm::JIT* jit);
-};
-
-class MvmJITMethodInfo : public JITMethodInfo {
-public:
-  virtual void print(void* ip, void* addr);
-  MvmJITMethodInfo(llvm::GCFunctionInfo* GFI,
-                   const llvm::Function* F,
-                   void* owner) :
-    JITMethodInfo(GFI) {
-      MetaInfo = const_cast<llvm::Function*>(F);
-      Owner = owner;
-  }
-};
-
 } // end namespace mvm
 
 #endif // MVM_JIT_H

Modified: vmkit/trunk/include/mvm/MethodInfo.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/MethodInfo.h?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/MethodInfo.h (original)
+++ vmkit/trunk/include/mvm/MethodInfo.h Thu Aug  4 15:29:08 2011
@@ -15,59 +15,92 @@
 
 namespace mvm {
 
-class MethodInfo : public PermanentObject {
+class FrameInfo {
 public:
-  virtual void print(void* ip, void* addr);
-  virtual void scan(uintptr_t closure, void* ip, void* addr) = 0;
-  virtual bool isHighLevelMethod() {
-    return false;
-  }
+  void* Metadata;
+  void* ReturnAddress;
+  uint16_t SourceIndex;
+  uint16_t FrameSize;
+  uint16_t NumLiveOffsets;
+  int16_t LiveOffsets[1];
+};
+ 
+class MethodInfoHelper {
+public:
+  static void print(void* ip, void* addr);
 
+  static void scan(uintptr_t closure, FrameInfo* FI, void* ip, void* addr);
+  
   static void* isStub(void* ip, void* addr) {
     bool isStub = ((unsigned char*)ip)[0] == 0xCE;
     if (isStub) ip = ((void**)addr)[2];
     return ip;
   }
 
-  void* MetaInfo;
-  void* Owner;
+  static uint32_t FrameInfoSize(uint32_t NumOffsets) {
+    uint32_t FrameInfoSize = sizeof(FrameInfo) + (NumOffsets - 1) * sizeof(int16_t);
+    if (FrameInfoSize & 2) {
+      FrameInfoSize += sizeof(int16_t);
+    }
+    return FrameInfoSize;
+  }
 };
 
-class CamlFrame {
-public:
-  void* ReturnAddress;
-  uint16_t FrameSize;
-  uint16_t NumLiveOffsets;
-  int16_t LiveOffsets[1];
-};
 
-class CamlFrames {
+class Frames {
 public:
-  uint16_t NumDescriptors;
-  CamlFrame* frames() const; 
+  uint32_t NumDescriptors;
+  FrameInfo* frames() const {
+    return reinterpret_cast<FrameInfo*>(
+        reinterpret_cast<uintptr_t>(this) + sizeof(Frames));
+  }
+
+  void* operator new(size_t sz, mvm::BumpPtrAllocator& allocator, uint32_t NumDescriptors, uint32_t NumOffsets) {
+    Frames* res = reinterpret_cast<Frames*>(
+        allocator.Allocate(sizeof(Frames) + NumDescriptors * MethodInfoHelper::FrameInfoSize(NumOffsets), "Frames"));
+    assert((reinterpret_cast<uintptr_t>(res) & 2) == 0);
+    return res;
+  }
 };
 
-class CamlMethodInfo : public MethodInfo {
+class CompiledFrames {
 public:
-  CamlFrame* CF;
-  virtual void scan(uintptr_t closure, void* ip, void* addr);
-  CamlMethodInfo(CamlFrame* C) : CF(C) {
-    Owner = NULL;
-    MetaInfo = NULL;
+  uint32_t NumCompiledFrames;
+  Frames* frames() const {
+    return reinterpret_cast<Frames*>(
+        reinterpret_cast<uintptr_t>(this) + sizeof(CompiledFrames));
   }
 };
 
-class DefaultMethodInfo : public MethodInfo {
+class FrameIterator {
 public:
-  virtual void scan(uintptr_t closure, void* ip, void* addr);
-  static DefaultMethodInfo DM;
-    
-  DefaultMethodInfo() {
-    Owner = NULL;
-    MetaInfo = NULL;
+  const Frames& frames;
+  uint32 currentFrameNumber;
+  FrameInfo* currentFrame;
+
+  FrameIterator(const Frames& f)
+      : frames(f), currentFrameNumber(0) , currentFrame(f.frames()) {
   }
-};
 
+  bool hasNext() {
+    return currentFrameNumber < frames.NumDescriptors;
+  }
+
+  void advance(int NumLiveOffsets) {
+    ++currentFrameNumber;
+    if (!hasNext()) return;
+    uintptr_t ptr =
+      reinterpret_cast<uintptr_t>(currentFrame) + MethodInfoHelper::FrameInfoSize(NumLiveOffsets);
+    currentFrame = reinterpret_cast<FrameInfo*>(ptr);
+  }
+
+  FrameInfo* next() {
+    assert(hasNext());
+    FrameInfo* result = currentFrame;
+    advance(currentFrame->NumLiveOffsets);
+    return result;
+  }
+};
 
 } // end namespace mvm
 #endif // MVM_METHODINFO_H

Modified: vmkit/trunk/include/mvm/MvmDenseSet.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/MvmDenseSet.h?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/MvmDenseSet.h (original)
+++ vmkit/trunk/include/mvm/MvmDenseSet.h Thu Aug  4 15:29:08 2011
@@ -7,7 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// This file defines the MvmDenseMap copied from llvm/ADT/DenseMap.h, but
+// This file defines the MvmDenseSet class copied from llvm/ADT/DenseMap.h, but
 // without storing pairs.
 //
 //===----------------------------------------------------------------------===//

Modified: vmkit/trunk/include/mvm/Threads/Thread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/Thread.h?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/Threads/Thread.h (original)
+++ vmkit/trunk/include/mvm/Threads/Thread.h Thu Aug  4 15:29:08 2011
@@ -29,7 +29,7 @@
 
 namespace mvm {
 
-class MethodInfo;
+class FrameInfo;
 class VirtualMachine;
 
 /// CircularBase - This class represents a circular list. Classes that extend
@@ -334,7 +334,7 @@
   jmp_buf buffer;
 };
 
-/// StackWalker - This class walks the stack of threads, returning a MethodInfo
+/// StackWalker - This class walks the stack of threads, returning a FrameInfo
 /// object at each iteration.
 ///
 class StackWalker {
@@ -347,7 +347,7 @@
   StackWalker(mvm::Thread* th) __attribute__ ((noinline));
   void operator++();
   void* operator*();
-  MethodInfo* get();
+  FrameInfo* get();
 
 };
 

Modified: vmkit/trunk/include/mvm/VirtualMachine.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/VirtualMachine.h?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/VirtualMachine.h (original)
+++ vmkit/trunk/include/mvm/VirtualMachine.h Thu Aug  4 15:29:08 2011
@@ -22,8 +22,9 @@
 
 namespace mvm {
 
-class CamlFrames;
-class MethodInfo;
+class CompiledFrames;
+class FrameInfo;
+class Frames;
 
 class FunctionMap {
 public:
@@ -31,27 +32,26 @@
   /// used when walking the stack so that VMKit knows which applicative method
   /// is executing on the stack.
   ///
-  llvm::DenseMap<void*, MethodInfo*> Functions;
+  llvm::DenseMap<void*, FrameInfo*> Functions;
 
   /// FunctionMapLock - Spin lock to protect the Functions map.
   ///
   mvm::SpinLock FunctionMapLock;
 
-  /// IPToMethodInfo - Map a code start instruction instruction to the MethodInfo.
+  /// IPToFrameInfo - Map a code start instruction instruction to the FrameInfo.
   ///
-  MethodInfo* IPToMethodInfo(void* ip);
+  FrameInfo* IPToFrameInfo(void* ip);
 
-  /// addMethodInfo - A new instruction pointer in the function map.
+  /// addFrameInfo - A new instruction pointer in the function map.
   ///
-  void addMethodInfo(MethodInfo* meth, void* ip);
-  void addMethodInfoNoLock(MethodInfo* meth, void* ip) {
+  void addFrameInfo(void* ip, FrameInfo* meth);
+  void addFrameInfoNoLock(void* ip, FrameInfo* meth) {
     Functions[ip] = meth;
   }
+  /// removeFrameInfos - Remove all FrameInfo owned by the given owner.
+  void removeFrameInfos(void* owner) {} /* TODO */
 
-  /// removeMethodInfos - Remove all MethodInfo owned by the given owner.
-  void removeMethodInfos(void* owner);
-
-  FunctionMap(BumpPtrAllocator& allocator, CamlFrames** frames);
+  FunctionMap(BumpPtrAllocator& allocator, CompiledFrames** frames);
 };
 
 /// VirtualMachine - This class is the root of virtual machine classes. It
@@ -59,7 +59,7 @@
 ///
 class VirtualMachine : public mvm::PermanentObject {
 protected:
-  VirtualMachine(mvm::BumpPtrAllocator &Alloc, mvm::CamlFrames** frames) :
+  VirtualMachine(BumpPtrAllocator &Alloc, CompiledFrames** frames) :
 		  allocator(Alloc), FunctionsCache(Alloc, frames) {
     mainThread = NULL;
     numberOfThreads = 0;
@@ -208,12 +208,14 @@
 //===----------------------------------------------------------------------===//
 
   FunctionMap FunctionsCache;
-  MethodInfo* IPToMethodInfo(void* ip) {
-    return FunctionsCache.IPToMethodInfo(ip);
+  FrameInfo* IPToFrameInfo(void* ip) {
+    return FunctionsCache.IPToFrameInfo(ip);
   }
-  void removeMethodInfos(void* owner) {
-    FunctionsCache.removeMethodInfos(owner);
+  void removeFrameInfos(void* owner) {
+    FunctionsCache.removeFrameInfos(owner);
   }
+
+  virtual void printMethod(FrameInfo* FI, void* ip, void* addr) = 0;
   
 //===----------------------------------------------------------------------===//
 // (4) Launch-related methods.

Modified: vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc (original)
+++ vmkit/trunk/lib/J3/Classpath/ClasspathVMThrowable.inc Thu Aug  4 15:29:08 2011
@@ -83,7 +83,7 @@
 }
 
 
-JavaObject* consStackElement(JavaMethod* meth, void* ip) {
+JavaObject* consStackElement(mvm::FrameInfo* FI, void* ip) {
 
   JavaString* methodName = 0;
   JavaString* className = 0;
@@ -95,6 +95,7 @@
   llvm_gcroot(res, 0);
 
   Jnjvm* vm = JavaThread::get()->getJVM();
+  JavaMethod* meth = (JavaMethod*)FI->Metadata;
   methodName = vm->internalUTF8ToStr(meth->name);
   Class* cl = meth->classDef;
   className = JavaString::internalToJava(cl->name, vm);
@@ -109,7 +110,7 @@
   }
 
   bool native = isNative(meth->access);
-  uint16 lineNumber = meth->lookupLineNumber(reinterpret_cast<uintptr_t>(ip));
+  uint16 lineNumber = meth->lookupLineNumber(FI);
 
   UserClass* newS = vm->upcalls->newStackTraceElement;
   res = newS->doNew(vm);
@@ -143,10 +144,10 @@
   // on the stack.
   sint32 index = 2;;
   while (index != JavaArray::getSize(stack)) {
-    mvm::MethodInfo* MI = vm->IPToMethodInfo(ArrayPtr::getElement((ArrayPtr*)stack, index));
-    if (!MI->isHighLevelMethod()) ++index;
+    mvm::FrameInfo* FI = vm->IPToFrameInfo(ArrayPtr::getElement((ArrayPtr*)stack, index));
+    if (FI->Metadata == NULL) ++index;
     else {
-      JavaMethod* meth = (JavaMethod*)MI->MetaInfo;
+      JavaMethod* meth = (JavaMethod*)FI->Metadata;
       assert(meth && "Wrong stack trace");
       if (meth->classDef->isAssignableFrom(vm->upcalls->newThrowable)) {
         ++index;
@@ -157,9 +158,9 @@
   sint32 size = 0;
   sint32 cur = index;
   while (cur < JavaArray::getSize(stack)) {
-    mvm::MethodInfo* MI = vm->IPToMethodInfo(ArrayPtr::getElement((ArrayPtr*)stack, cur));
+    mvm::FrameInfo* FI = vm->IPToFrameInfo(ArrayPtr::getElement((ArrayPtr*)stack, cur));
     ++cur;
-    if (MI->isHighLevelMethod()) ++size;
+    if (FI->Metadata != NULL) ++size;
   }
 
   result = (ArrayObject*)
@@ -167,10 +168,9 @@
   
   cur = 0;
   for (sint32 i = index; i < JavaArray::getSize(stack); ++i) {
-    mvm::MethodInfo* MI = vm->IPToMethodInfo(ArrayPtr::getElement((ArrayPtr*)stack, i));
-    if (MI->isHighLevelMethod()) {
-      JavaMethod* meth = (JavaMethod*)MI->MetaInfo;
-      ArrayObject::setElement(result, consStackElement(meth, ArrayPtr::getElement((ArrayPtr*)stack, i)), cur);
+    mvm::FrameInfo* FI = vm->IPToFrameInfo(ArrayPtr::getElement((ArrayPtr*)stack, i));
+    if (FI->Metadata != NULL) {
+      ArrayObject::setElement(result, consStackElement(FI, ArrayPtr::getElement((ArrayPtr*)stack, i)), cur);
       cur++;
     }
   }

Modified: vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaAOTCompiler.cpp Thu Aug  4 15:29:08 2011
@@ -2325,18 +2325,14 @@
       for (uint32 i = 0; i < cl->nbVirtualMethods; ++i) {
         JavaMethod& meth = cl->virtualMethods[i];
         if (meth.code != NULL) {
-          Function* Func = parseFunction(&meth);
-          Func->clearGC();
-          Func->setGC("java_aot");
+          parseFunction(&meth);
         }
       }
   
       for (uint32 i = 0; i < cl->nbStaticMethods; ++i) {
         JavaMethod& meth = cl->staticMethods[i];
         if (meth.code != NULL) {
-          Function* Func = parseFunction(&meth);
-          Func->clearGC();
-          Func->setGC("java_aot");
+          parseFunction(&meth);
         }
       }
     }
@@ -2347,8 +2343,6 @@
     toCompile.pop_back();
     getNativeClass(meth->classDef);
     Function* Func = parseFunction(meth);
-    Func->clearGC();
-    Func->setGC("java_aot");
     // Also update code to notify that this function has been emitted.
     meth->code = Func;
   }

Modified: vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp (original)
+++ vmkit/trunk/lib/J3/Compiler/JavaJITCompiler.cpp Thu Aug  4 15:29:08 2011
@@ -40,42 +40,6 @@
 using namespace j3;
 using namespace llvm;
 
-class JavaJITMethodInfo : public mvm::JITMethodInfo {
-public:
-  virtual void print(void* ip, void* addr);
-  virtual bool isHighLevelMethod() {
-    return true;
-  }
-  
-  JavaJITMethodInfo(llvm::GCFunctionInfo* GFI,
-                    JavaMethod* m) :
-      mvm::JITMethodInfo(GFI) {
-    MetaInfo = m;
-    Owner = m->classDef->classLoader->getCompiler();
-  }
-};
-
-void JavaJITMethodInfo::print(void* ip, void* addr) {
-  void* new_ip = NULL;
-  if (ip) new_ip = isStub(ip, addr);
-  JavaMethod* meth = (JavaMethod*)MetaInfo;
-  CodeLineInfo* info = meth->lookupCodeLineInfo((uintptr_t)ip);
-  if (info != NULL) {
-    fprintf(stderr, "; %p (%p) in %s.%s (line %d, bytecode %d, code start %p)", new_ip, addr,
-            UTF8Buffer(meth->classDef->name).cString(),
-            UTF8Buffer(meth->name).cString(),
-            meth->lookupLineNumber((uintptr_t)ip),
-            info->bytecodeIndex, meth->code);
-  } else {
-    fprintf(stderr, "; %p (%p) in %s.%s (native method, code start %p)", new_ip, addr,
-            UTF8Buffer(meth->classDef->name).cString(),
-            UTF8Buffer(meth->name).cString(), meth->code);
-  }
-  if (ip != new_ip) fprintf(stderr, " (from stub)");
-  fprintf(stderr, "\n");
-}
-
-
 void JavaJITListener::NotifyFunctionEmitted(const Function &F,
                                      void *Code, size_t Size,
                                      const EmittedFunctionDetails &Details) {
@@ -347,33 +311,9 @@
     assert((GFI != NULL) && "No GC information");
   
     Jnjvm* vm = JavaThread::get()->getJVM();
-    mvm::JITMethodInfo* MI = 
-      new(allocator, "JavaJITMethodInfo") JavaJITMethodInfo(GFI, meth);
-    MI->addToVM(vm, (JIT*)executionEngine);
-
-    uint32_t infoLength = GFI->size();
-    meth->codeInfoLength = infoLength;
-    if (infoLength == 0) {
-      meth->codeInfo = NULL;
-    } else {
-      mvm::BumpPtrAllocator& JavaAlloc = meth->classDef->classLoader->allocator;
-      CodeLineInfo* infoTable =
-        new(JavaAlloc, "CodeLineInfo") CodeLineInfo[infoLength];
-      uint32_t index = 0;
-      for (GCFunctionInfo::iterator I = GFI->begin(), E = GFI->end();
-           I != E;
-           I++, index++) {
-        DebugLoc DL = I->Loc;
-        uint32_t bytecodeIndex = DL.getLine();
-        uint32_t second = DL.getCol();
-        assert(second == 0 && "Wrong column number");
-        uintptr_t address =
-            ((JIT*)executionEngine)->getCodeEmitter()->getLabelAddress(I->Label);
-        infoTable[index].address = address;
-        infoTable[index].bytecodeIndex = bytecodeIndex;
-      }
-      meth->codeInfo = infoTable;
-    }
+    mvm::Frames* frames = mvm::MvmModule::addToVM(vm, GFI, (JIT*)executionEngine, allocator);
+    meth->frames = frames;
+    meth->updateFrames();
   }
     // Now that it's compiled, we don't need the IR anymore
   func->deleteBody();
@@ -389,9 +329,7 @@
   assert((GFI != NULL) && "No GC information");
   
   Jnjvm* vm = JavaThread::get()->getJVM();
-  mvm::JITMethodInfo* MI = 
-    new(allocator, "JITMethodInfo") mvm::MvmJITMethodInfo(GFI, F, this);
-  MI->addToVM(vm, (JIT*)executionEngine);
+  mvm::MvmModule::addToVM(vm, GFI, (JIT*)executionEngine, allocator);
   
   // Now that it's compiled, we don't need the IR anymore
   F->deleteBody();

Modified: vmkit/trunk/lib/J3/Compiler/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/Compiler/Makefile?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/Compiler/Makefile (original)
+++ vmkit/trunk/lib/J3/Compiler/Makefile Thu Aug  4 15:29:08 2011
@@ -10,7 +10,6 @@
 
 include $(LEVEL)/Makefile.config
 
-DIRS = AOT
 MODULE_WITH_GC = J3Compiler
 
 include $(LEVEL)/Makefile.common

Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.cpp Thu Aug  4 15:29:08 2011
@@ -634,7 +634,7 @@
   access = A;
   canBeInlined = false;
   offset = 0;
-  codeInfo = NULL;
+  frames = NULL;
 }
 
 void JavaField::initialise(Class* cl, const UTF8* N, const UTF8* T, uint16 A) {
@@ -1699,59 +1699,51 @@
   }
 }
 
-CodeLineInfo* JavaMethod::lookupCodeLineInfo(uintptr_t ip) {
-  for(uint16 i = 0; i < codeInfoLength; ++i) {
-    if (codeInfo[i].address == ip) {
-      return &(codeInfo[i]);
-    }
-  }
-  return NULL;
-}
-
-uint16 JavaMethod::lookupLineNumber(uintptr_t ip) {
-  for(uint16 i = 0; i < codeInfoLength; ++i) {
-    if (codeInfo[i].address == ip) {
-      Attribut* codeAtt = lookupAttribut(Attribut::codeAttribut);      
-      if (codeAtt == NULL) return 0;
-      Reader reader(codeAtt, classDef->bytes);
-      reader.readU2(); // max_stack
-      reader.readU2(); // max_locals;
-      uint32_t codeLength = reader.readU4();
-      reader.seek(codeLength, Reader::SeekCur);
-      uint16_t exceptionTableLength = reader.readU2();
-      reader.seek(8 * exceptionTableLength, Reader::SeekCur);
-      uint16_t nba = reader.readU2();
-      for (uint16 att = 0; att < nba; ++att) {
-        const UTF8* attName = classDef->ctpInfo->UTF8At(reader.readU2());
-        uint32 attLen = reader.readU4();
-        if (attName->equals(Attribut::lineNumberTableAttribut)) {
-          uint16_t lineLength = reader.readU2();
-          uint16_t currentLine = 0;
-          for (uint16 j = 0; j < lineLength; ++j) {
-            uint16 pc = reader.readU2();
-            if (pc > codeInfo[i].bytecodeIndex + 1) return currentLine;
-            currentLine = reader.readU2();
-          }
-          return currentLine;
-        } else {
-          reader.seek(attLen, Reader::SeekCur);      
-        }
+uint16 JavaMethod::lookupLineNumber(mvm::FrameInfo* info) {
+  Attribut* codeAtt = lookupAttribut(Attribut::codeAttribut);      
+  if (codeAtt == NULL) return 0;
+  Reader reader(codeAtt, classDef->bytes);
+  reader.readU2(); // max_stack
+  reader.readU2(); // max_locals;
+  uint32_t codeLength = reader.readU4();
+  reader.seek(codeLength, Reader::SeekCur);
+  uint16_t exceptionTableLength = reader.readU2();
+  reader.seek(8 * exceptionTableLength, Reader::SeekCur);
+  uint16_t nba = reader.readU2();
+  for (uint16 att = 0; att < nba; ++att) {
+    const UTF8* attName = classDef->ctpInfo->UTF8At(reader.readU2());
+    uint32 attLen = reader.readU4();
+    if (attName->equals(Attribut::lineNumberTableAttribut)) {
+      uint16_t lineLength = reader.readU2();
+      uint16_t currentLine = 0;
+      for (uint16 j = 0; j < lineLength; ++j) {
+        uint16 pc = reader.readU2();
+        if (pc > info->SourceIndex + 1) return currentLine;
+        currentLine = reader.readU2();
       }
+      return currentLine;
+    } else {
+      reader.seek(attLen, Reader::SeekCur);      
     }
   }
   return 0;
 }
 
-uint16 JavaMethod::lookupCtpIndex(uintptr_t ip) {
-  for(uint16 i = 0; i < codeInfoLength; ++i) {
-    if (codeInfo[i].address == ip) {
-      Attribut* codeAtt = lookupAttribut(Attribut::codeAttribut);
-      Reader reader(codeAtt, classDef->bytes);
-      reader.cursor = reader.cursor + 2 + 2 + 4 + codeInfo[i].bytecodeIndex + 1;
-      return reader.readU2();
-    }
+uint16 JavaMethod::lookupCtpIndex(mvm::FrameInfo* FI) {
+  Attribut* codeAtt = lookupAttribut(Attribut::codeAttribut);
+  Reader reader(codeAtt, classDef->bytes);
+  reader.cursor = reader.cursor + 2 + 2 + 4 + FI->SourceIndex + 1;
+  return reader.readU2();
+}
+
+
+void JavaMethod::updateFrames() {
+  mvm::FrameIterator iterator(*frames);
+
+  while (iterator.hasNext()) {
+    mvm::FrameInfo* frame = iterator.next();
+    frame->Metadata = this;
   }
-  return 0;
 }
 
 void Class::acquire() {

Modified: vmkit/trunk/lib/J3/VMCore/JavaClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaClass.h?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaClass.h Thu Aug  4 15:29:08 2011
@@ -821,16 +821,6 @@
   
 };
 
-class CodeLineInfo : public mvm::PermanentObject {
-public:
-  uintptr_t address;
-  uint16 bytecodeIndex;
-  // TODO: Use these fields when inlining.
-  JavaMethod* executingMethod;
-  // The code where the inlined method starts.
-  CodeLineInfo* inlineLocation;
-};
-
 /// JavaMethod - This class represents Java methods.
 ///
 class JavaMethod : public mvm::PermanentObject {
@@ -899,11 +889,13 @@
   ///
   void* code;
  
-  /// codeInfo - Array of CodeLineInfo objects.
+  /// frames - Frames for this method.
+  /// TODO: Deprecate?
   ///
-  CodeLineInfo* codeInfo;
+  mvm::Frames* frames;
 
   /// codeInfoLength - Number of entries in the codeInfo field.
+  /// TODO: Deprecate.
   ///
   uint16 codeInfoLength;
 
@@ -911,26 +903,24 @@
   ///
   uint32 offset;
 
+  /// updateFrames - Set the meta information on frames.
+  ///
+  void updateFrames();
+
   /// lookupAttribut - Look up an attribut in the method's attributs. Returns
   /// null if the attribut is not found.
   ///
   Attribut* lookupAttribut(const UTF8* key);
 
-  /// lookupLineNumber - Find the line number based on the given instruction
-  /// pointer.
+  /// lookupLineNumber - Find the line number based on the given frame info.
   ///
-  uint16 lookupLineNumber(uintptr_t ip);
+  uint16 lookupLineNumber(mvm::FrameInfo* FI);
   
   /// lookupCtpIndex - Lookup the constant pool index pointed by the opcode
-  /// related to the given instruction pointer.
+  /// related to the given frame info.
   ///
-  uint16 lookupCtpIndex(uintptr_t ip);
+  uint16 lookupCtpIndex(mvm::FrameInfo* FI);
   
-  /// lookupCodeLineInfo - Lookup the code line info related to the given
-  /// instruction pointer.
-  ///
-  CodeLineInfo* lookupCodeLineInfo(uintptr_t ip);
-
   /// getSignature - Get the signature of thes method, resolving it if
   /// necessary.
   ///

Modified: vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaRuntimeJIT.cpp Thu Aug  4 15:29:08 2011
@@ -560,13 +560,12 @@
   // Lookup the caller of this class.
   mvm::StackWalker Walker(th);
   ++Walker; // Remove the stub.
-  mvm::MethodInfo* MI = Walker.get();
-  assert(MI->isHighLevelMethod() && "Wrong stack trace");
-  JavaMethod* meth = (JavaMethod*)MI->MetaInfo;
-  void* ip = *Walker;
+  mvm::FrameInfo* FI = Walker.get();
+  assert(FI->Metadata != NULL && "Wrong stack trace");
+  JavaMethod* meth = (JavaMethod*)FI->Metadata;
 
   // Lookup the method info in the constant pool of the caller.
-  uint16 ctpIndex = meth->lookupCtpIndex(reinterpret_cast<uintptr_t>(ip));
+  uint16 ctpIndex = meth->lookupCtpIndex(FI);
   assert(ctpIndex && "No constant pool index");
   JavaConstantPool* ctpInfo = meth->classDef->getConstantPool();
   CommonClass* ctpCl = 0;
@@ -621,13 +620,12 @@
   // Lookup the caller of this class.
   mvm::StackWalker Walker(th);
   ++Walker; // Remove the stub.
-  mvm::MethodInfo* MI = Walker.get();
-  assert(MI->isHighLevelMethod() && "Wrong stack trace");
-  JavaMethod* caller = (JavaMethod*)MI->MetaInfo;
-  void* ip = *Walker;
+  mvm::FrameInfo* FI = Walker.get();
+  assert(FI->Metadata != NULL && "Wrong stack trace");
+  JavaMethod* caller = (JavaMethod*)FI->Metadata;
 
   // Lookup the method info in the constant pool of the caller.
-  uint16 ctpIndex = caller->lookupCtpIndex(reinterpret_cast<uintptr_t>(ip));
+  uint16 ctpIndex = caller->lookupCtpIndex(FI);
   assert(ctpIndex && "No constant pool index");
   JavaConstantPool* ctpInfo = caller->classDef->getConstantPool();
   CommonClass* cl = 0;
@@ -659,13 +657,12 @@
   // Lookup the caller of this class.
   mvm::StackWalker Walker(th);
   ++Walker; // Remove the stub.
-  mvm::MethodInfo* MI = Walker.get();
-  assert(MI->isHighLevelMethod() && "Wrong stack trace");
-  JavaMethod* caller = (JavaMethod*)MI->MetaInfo;
-  void* ip = *Walker;
+  mvm::FrameInfo* FI = Walker.get();
+  assert(FI->Metadata != NULL && "Wrong stack trace");
+  JavaMethod* caller = (JavaMethod*)FI->Metadata;
 
   // Lookup the method info in the constant pool of the caller.
-  uint16 ctpIndex = caller->lookupCtpIndex(reinterpret_cast<uintptr_t>(ip));
+  uint16 ctpIndex = caller->lookupCtpIndex(FI);
   assert(ctpIndex && "No constant pool index");
   JavaConstantPool* ctpInfo = caller->classDef->getConstantPool();
   CommonClass* cl = 0;

Modified: vmkit/trunk/lib/J3/VMCore/JavaThread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JavaThread.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JavaThread.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JavaThread.cpp Thu Aug  4 15:29:08 2011
@@ -70,9 +70,9 @@
   mvm::StackWalker Walker(this);
   uint32 i = 0;
 
-  while (mvm::MethodInfo* MI = Walker.get()) {
-    if (MI->isHighLevelMethod()) {
-      JavaMethod* M = (JavaMethod*)MI->MetaInfo;
+  while (mvm::FrameInfo* FI = Walker.get()) {
+    if (FI->Metadata != NULL) {
+      JavaMethod* M = (JavaMethod*)FI->Metadata;
       buffer[i++] = M;
     }
     ++Walker;
@@ -84,10 +84,10 @@
   mvm::StackWalker Walker(this);
   uint32 index = 0;
 
-  while (mvm::MethodInfo* MI = Walker.get()) {
-    if (MI->isHighLevelMethod()) {
+  while (mvm::FrameInfo* FI = Walker.get()) {
+    if (FI->Metadata != NULL) {
       if (index == level) {
-        return (JavaMethod*)MI->MetaInfo;
+        return (JavaMethod*)FI->Metadata;
       }
       ++index;
     }
@@ -109,9 +109,9 @@
   
   mvm::StackWalker Walker(this);
 
-  while (mvm::MethodInfo* MI = Walker.get()) {
-    if (MI->isHighLevelMethod() == 1) {
-      JavaMethod* meth = (JavaMethod*)MI->MetaInfo;
+  while (mvm::FrameInfo* FI = Walker.get()) {
+    if (FI->Metadata != NULL) {
+      JavaMethod* meth = (JavaMethod*)FI->Metadata;
       JnjvmClassLoader* loader = meth->classDef->classLoader;
       obj = loader->getJavaClassLoader();
       if (obj) return obj;
@@ -125,9 +125,10 @@
 void JavaThread::printJavaBacktrace() {
   mvm::StackWalker Walker(this);
 
-  while (mvm::MethodInfo* MI = Walker.get()) {
-    if (MI->isHighLevelMethod())
-      MI->print(Walker.ip, Walker.addr);
+  while (mvm::FrameInfo* FI = Walker.get()) {
+    if (FI->Metadata != NULL) {
+      MyVM->printMethod(FI, Walker.ip, Walker.addr);
+    }
     ++Walker;
   }
 }

Modified: vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/Jnjvm.cpp Thu Aug  4 15:29:08 2011
@@ -1312,7 +1312,7 @@
 }
 
 Jnjvm::Jnjvm(mvm::BumpPtrAllocator& Alloc,
-             mvm::CamlFrames** frames,
+             mvm::CompiledFrames** frames,
              JnjvmBootstrapLoader* loader) : 
   VirtualMachine(Alloc, frames), lockSystem(Alloc) {
 
@@ -1444,3 +1444,22 @@
   
   return 0; 
 }
+
+void Jnjvm::printMethod(mvm::FrameInfo* FI, void* ip, void* addr) {
+  void* new_ip = NULL;
+  if (ip) new_ip = mvm::MethodInfoHelper::isStub(ip, addr);
+  if (FI->Metadata == NULL) {
+    mvm::MethodInfoHelper::print(ip, addr);
+    return;
+  }
+  JavaMethod* meth = (JavaMethod*)FI->Metadata;
+
+  fprintf(stderr, "; %p (%p) in %s.%s (line %d, bytecode %d, code start %p)", new_ip, addr,
+          UTF8Buffer(meth->classDef->name).cString(),
+          UTF8Buffer(meth->name).cString(),
+          meth->lookupLineNumber(FI),
+          FI->SourceIndex, meth->code);
+
+  if (ip != new_ip) fprintf(stderr, " (from stub)");
+  fprintf(stderr, "\n");
+}

Modified: vmkit/trunk/lib/J3/VMCore/Jnjvm.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Jnjvm.h?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/Jnjvm.h (original)
+++ vmkit/trunk/lib/J3/VMCore/Jnjvm.h Thu Aug  4 15:29:08 2011
@@ -131,6 +131,8 @@
   virtual void addFinalizationCandidate(gc* obj);
   virtual size_t getObjectSize(gc* obj);
   virtual const char* getObjectTypeName(gc* obj);
+  virtual void printMethod(mvm::FrameInfo* FI, void* ip, void* addr);
+
 
   /// CreateError - Creates a Java object of the specified exception class
   /// and calling its <init> function.
@@ -337,7 +339,7 @@
   /// Jnjvm - Allocates a new JVM.
   ///
   Jnjvm(mvm::BumpPtrAllocator& Alloc,
-        mvm::CamlFrames** frames,
+        mvm::CompiledFrames** frames,
         JnjvmBootstrapLoader* loader);
   
   /// runApplication - Runs the application with the given command line.

Modified: vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/JnjvmClassLoader.cpp Thu Aug  4 15:29:08 2011
@@ -843,7 +843,7 @@
 JnjvmClassLoader::~JnjvmClassLoader() {
 
   if (isolate) {
-    isolate->removeMethodInfos(TheCompiler);
+    isolate->removeFrameInfos(TheCompiler);
   }
 
   if (classes) {

Modified: vmkit/trunk/lib/J3/VMCore/Precompiled.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/J3/VMCore/Precompiled.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/J3/VMCore/Precompiled.cpp (original)
+++ vmkit/trunk/lib/J3/VMCore/Precompiled.cpp Thu Aug  4 15:29:08 2011
@@ -121,137 +121,6 @@
 }
 
 
-class StaticJ3Frame {
-public:
-  void* ReturnAddress;
-  uint16_t BytecodeIndex;
-  uint16_t FrameSize;
-  uint16_t NumLiveOffsets;
-  int16_t LiveOffsets[1];
-};
-
-class StaticJ3Frames {
-public:
-  void* FunctionAddress;
-  uint16_t NumDescriptors;
-  StaticJ3Frame* frames() const; 
-};
-
-class StaticJ3FrameDecoder {
-public:
-  StaticJ3Frames* frames ;
-  uint32 currentDescriptor;
-  StaticJ3Frame* currentFrame;
-
-  StaticJ3FrameDecoder(StaticJ3Frames* frames) {
-    this->frames = frames;
-    currentDescriptor = 0;
-    currentFrame = frames->frames();
-  }
-
-  bool hasNext() {
-    return currentDescriptor < frames->NumDescriptors;
-  }
-
-  void advance() {
-    ++currentDescriptor;
-    if (!hasNext()) return;
-    uintptr_t ptr = reinterpret_cast<uintptr_t>(currentFrame)
-      + currentFrame->NumLiveOffsets * sizeof(uint16_t)
-      + sizeof(void*)       // ReturnAddress
-      + sizeof(uint16_t)    // BytecodeIndex
-      + sizeof(uint16_t)    // FrameSize
-      + sizeof(uint16_t);   // NumLiveOffsets
-    if (ptr & 2) {
-      ptr += sizeof(uint16_t);
-    }
-    currentFrame = reinterpret_cast<StaticJ3Frame*>(ptr);
-  }
-
-  StaticJ3Frame* next() {
-    assert(hasNext());
-    StaticJ3Frame* result = currentFrame;
-    advance();
-    return result;
-  }
-};
-
-StaticJ3Frame* StaticJ3Frames::frames() const {
-  intptr_t ptr = reinterpret_cast<intptr_t>(this) + sizeof(void*) + sizeof(uint16_t);
-  // If the frames structure was not 4-aligned, manually do it here.
-  if (ptr & 2) {
-    ptr += sizeof(uint16_t);
-  }
-  return reinterpret_cast<StaticJ3Frame*>(ptr);
-}
-
-class JavaStaticMethodInfo : public mvm::MethodInfo {
-private:
-  StaticJ3Frame* frame;
-public:
-  virtual void print(void* ip, void* addr);
-  virtual bool isHighLevelMethod() {
-    return true;
-  }
-
-  virtual void scan(uintptr_t closure, void* ip, void* addr) {
-    assert(frame != NULL);
-    //uintptr_t spaddr = (uintptr_t)addr + CF->FrameSize + sizeof(void*);
-    uintptr_t spaddr = ((uintptr_t*)addr)[0];
-    for (uint16 i = 0; i < frame->NumLiveOffsets; ++i) {
-      mvm::Collector::scanObject((void**)(spaddr + frame->LiveOffsets[i]), closure);
-    }
-  }
-
-  JavaStaticMethodInfo(StaticJ3Frame* F, JavaMethod* M) {
-    frame = F;
-    MetaInfo = M;
-    Owner = M->classDef->classLoader->getCompiler();
-  }
-};
-
-
-void JavaStaticMethodInfo::print(void* ip, void* addr) {
-  JavaMethod* meth = (JavaMethod*)MetaInfo;
-  CodeLineInfo* info = meth->lookupCodeLineInfo((uintptr_t)ip);
-  if (info != NULL) {
-    fprintf(stderr, "; %p (%p) in %s.%s (AOT line %d, bytecode %d, code start %p)", ip, addr,
-            UTF8Buffer(meth->classDef->name).cString(),
-            UTF8Buffer(meth->name).cString(),
-            meth->lookupLineNumber((uintptr_t)ip),
-            info->bytecodeIndex, meth->code);
-  } else {
-    fprintf(stderr, "; %p (%p) in %s.%s (native method, code start %p)", ip, addr,
-            UTF8Buffer(meth->classDef->name).cString(),
-            UTF8Buffer(meth->name).cString(), meth->code);
-  }
-  fprintf(stderr, "\n");
-}
-
-
-static void ReadFrame(Jnjvm* vm, JnjvmClassLoader* loader, JavaMethod* meth) {
-  StaticJ3Frames* frames = reinterpret_cast<StaticJ3Frames*>(meth->codeInfo);
-  StaticJ3FrameDecoder decoder(frames);
-  mvm::BumpPtrAllocator& allocator = loader->allocator;
-  meth->codeInfoLength = frames->NumDescriptors;
-  if (frames->NumDescriptors > 0) {
-    meth->codeInfo = new(allocator, "CodeLineInfo") CodeLineInfo[frames->NumDescriptors];
-  } else {
-    meth->codeInfo = NULL;
-  }
-
-  int codeInfoIndex = 0;
-  while (decoder.hasNext()) {
-    StaticJ3Frame* frame = decoder.next();
-    mvm::MethodInfo* MI = new(allocator, "JavaStaticMethodInfo") JavaStaticMethodInfo(frame, meth);
-    assert(loader->bootstrapLoader == loader && "Can only add frame without lock for the bootstrap loader");
-    vm->FunctionsCache.addMethodInfoNoLock(MI, frame->ReturnAddress);
-    meth->codeInfo[codeInfoIndex].address = reinterpret_cast<uintptr_t>(frame->ReturnAddress);
-    meth->codeInfo[codeInfoIndex++].bytecodeIndex = frame->BytecodeIndex;
-  }
-}
-
-
 void Precompiled::ReadFrames(Jnjvm* vm, JnjvmClassLoader* loader) {
   for (ClassMap::iterator i = loader->getClasses()->map.begin(),
        e = loader->getClasses()->map.end(); i != e; ++i) {
@@ -261,14 +130,14 @@
       for (uint32 i = 0; i < C->nbVirtualMethods; ++i) {
         JavaMethod& meth = C->virtualMethods[i];
         if (meth.code != NULL) {
-          ReadFrame(vm, loader, &meth);
+          meth.updateFrames();
         }
       }
       
       for (uint32 i = 0; i < C->nbStaticMethods; ++i) {
         JavaMethod& meth = C->staticMethods[i];
         if (meth.code != NULL) {
-          ReadFrame(vm, loader, &meth);
+          meth.updateFrames();
         }
       }
     }

Modified: vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp (original)
+++ vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp Thu Aug  4 15:29:08 2011
@@ -104,8 +104,8 @@
 void Thread::printBacktrace() {
   StackWalker Walker(this);
 
-  while (MethodInfo* MI = Walker.get()) {
-    MI->print(Walker.ip, Walker.addr);
+  while (FrameInfo* FI = Walker.get()) {
+    MyVM->printMethod(FI, Walker.ip, Walker.addr);
     ++Walker;
   }
 }
@@ -131,12 +131,12 @@
   return i;
 }
 
-MethodInfo* StackWalker::get() {
+FrameInfo* StackWalker::get() {
   if (addr == thread->baseSP) return 0;
   ip = FRAME_IP(addr);
   bool isStub = ((unsigned char*)ip)[0] == 0xCE;
   if (isStub) ip = addr[2];
-  return thread->MyVM->IPToMethodInfo(ip);
+  return thread->MyVM->IPToFrameInfo(ip);
 }
 
 void* StackWalker::operator*() {
@@ -186,8 +186,8 @@
 
 void Thread::scanStack(uintptr_t closure) {
   StackWalker Walker(this);
-  while (MethodInfo* MI = Walker.get()) {
-    MI->scan(closure, Walker.ip, Walker.addr);
+  while (FrameInfo* MI = Walker.get()) {
+    MethodInfoHelper::scan(closure, MI, Walker.ip, Walker.addr);
     ++Walker;
   }
 }

Modified: vmkit/trunk/lib/Mvm/Compiler/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Compiler/JIT.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Compiler/JIT.cpp (original)
+++ vmkit/trunk/lib/Mvm/Compiler/JIT.cpp Thu Aug  4 15:29:08 2011
@@ -66,11 +66,6 @@
   return LLVM_HOSTTRIPLE;
 }
 
-void MvmJITMethodInfo::print(void* ip, void* addr) {
-  fprintf(stderr, "; %p (%p) in %s LLVM method\n", ip, addr,
-      ((llvm::Function*)MetaInfo)->getName().data());
-}
-
 class MvmJITListener : public llvm::JITEventListener {
 public:
   virtual void NotifyFunctionEmitted(const Function &F,
@@ -86,22 +81,53 @@
     assert(&(*I)->getFunction() == &F &&
         "GC Info and method do not correspond");
     llvm::GCFunctionInfo* GFI = *I;
-    JITMethodInfo* MI = new(*MvmModule::Allocator, "MvmJITMethodInfo")
-        MvmJITMethodInfo(GFI, &F, MvmModule::executionEngine);
-    MI->addToVM(mvm::Thread::get()->MyVM, (JIT*)MvmModule::executionEngine);
+    MvmModule::addToVM(mvm::Thread::get()->MyVM, GFI, (JIT*)MvmModule::executionEngine, *MvmModule::Allocator);
   }
 };
 
-void JITMethodInfo::addToVM(VirtualMachine* VM, JIT* jit) {
+Frames* MvmModule::addToVM(VirtualMachine* VM, GCFunctionInfo* FI, JIT* jit, BumpPtrAllocator& allocator) {
   JITCodeEmitter* JCE = jit->getCodeEmitter();
-  assert(GCInfo != NULL);
-  for (GCFunctionInfo::iterator I = GCInfo->begin(), E = GCInfo->end();
-       I != E;
-       I++) {
-    uintptr_t address = JCE->getLabelAddress(I->Label);
-    assert(address != 0);
-    VM->FunctionsCache.addMethodInfo(this, (void*)address);
+  int NumDescriptors = 0;
+  for (GCFunctionInfo::iterator J = FI->begin(), JE = FI->end(); J != JE; ++J) {
+    NumDescriptors++;
+  }
+  // Currently, all frames have the same number of stack offsets.
+  size_t LiveCount = FI->live_size(FI->begin());
+
+  Frames* frames = new (allocator, NumDescriptors, LiveCount) Frames();
+  frames->NumDescriptors = NumDescriptors;
+  FrameIterator iterator(*frames);
+
+  GCFunctionInfo::iterator I = FI->begin();
+  while (iterator.hasNext()) {
+    // Manually do the iteration, because NumLiveOffsets has not been set
+    // on the frames yet.
+    FrameInfo* frame = iterator.currentFrame;
+    iterator.advance(LiveCount);
+
+    frame->NumLiveOffsets = LiveCount;
+    frame->FrameSize = FI->getFrameSize();
+    frame->Metadata = NULL;
+    frame->SourceIndex = I->Loc.getLine();
+    frame->ReturnAddress = reinterpret_cast<void*>(JCE->getLabelAddress(I->Label));
+    int i = 0;
+    for (llvm::GCFunctionInfo::live_iterator KI = FI->live_begin(I),
+         KE = FI->live_end(I); KI != KE; ++KI) {
+      frame->LiveOffsets[i++] = KI->StackOffset;
+    }
+    VM->FunctionsCache.addFrameInfo(frame->ReturnAddress, frame);
+    I++;
+  }
+   {
+    FrameIterator iterator(*frames);
+    while (iterator.hasNext()) {
+      FrameInfo* frame = iterator.next();
+      FrameInfo* other = VM->IPToFrameInfo(frame->ReturnAddress);
+      assert(frame->ReturnAddress == other->ReturnAddress);
+    }
   }
+
+  return frames;
 }
 
 static MvmJITListener JITListener;
@@ -426,21 +452,3 @@
 void MvmModule::unprotectIR() {
   protectEngine.unlock();
 }
-
-void JITMethodInfo::scan(uintptr_t closure, void* ip, void* addr) {
-  if (GCInfo) {
-    DEBUG(llvm::errs() << GCInfo->getFunction().getName() << '\n');
-    // All safe points have the same informations currently in LLVM.
-    llvm::GCFunctionInfo::iterator J = GCInfo->begin();
-    //uintptr_t spaddr = (uintptr_t)addr + GFI->getFrameSize() + sizeof(void*);
-    uintptr_t spaddr = ((uintptr_t*)addr)[0];
-    for (llvm::GCFunctionInfo::live_iterator K = GCInfo->live_begin(J),
-         KE = GCInfo->live_end(J); K != KE; ++K) {
-      intptr_t obj = *(intptr_t*)(spaddr + K->StackOffset);
-      // Verify that obj does not come from a JSR bytecode.
-      if (!(obj & 1)) {
-        Collector::scanObject((void**)(spaddr + K->StackOffset), closure);
-      }
-    }
-  }
-}

Modified: vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp (original)
+++ vmkit/trunk/lib/Mvm/Runtime/MethodInfo.cpp Thu Aug  4 15:29:08 2011
@@ -20,125 +20,75 @@
 
 using namespace mvm;
 
-void CamlMethodInfo::scan(uintptr_t closure, void* ip, void* addr) {
-  assert(CF != NULL);
-  //uintptr_t spaddr = (uintptr_t)addr + CF->FrameSize + sizeof(void*);
+void MethodInfoHelper::scan(uintptr_t closure, FrameInfo* FI, void* ip, void* addr) {
+  //uintptr_t spaddr = (uintptr_t)addr + FI->FrameSize + sizeof(void*);
   uintptr_t spaddr = ((uintptr_t*)addr)[0];
-  for (uint16 i = 0; i < CF->NumLiveOffsets; ++i) {
-    Collector::scanObject((void**)(spaddr + CF->LiveOffsets[i]), closure);
+  for (uint16 i = 0; i < FI->NumLiveOffsets; ++i) {
+    intptr_t obj = *(intptr_t*)(spaddr + FI->LiveOffsets[i]);    
+    // Verify that obj does not come from a JSR bytecode.
+    if (!(obj & 1)) {
+      Collector::scanObject((void**)(spaddr + FI->LiveOffsets[i]), closure);
+    }
   }
 }
 
-void MethodInfo::print(void* ip, void* addr) {
+void MethodInfoHelper::print(void* ip, void* addr) {
   Dl_info info;
   int res = dladdr(ip, &info);
   if (res != 0 && info.dli_sname != NULL) {
     fprintf(stderr, "; %p (%p) in %s\n",  ip, addr, info.dli_sname);
   } else {
-    fprintf(stderr, "; %p in Unknown method\n",  ip);
-  }
-}
-
-DefaultMethodInfo DefaultMethodInfo::DM;
-
-void DefaultMethodInfo::scan(uintptr_t closure, void* ip, void* addr) {
-}
-
-struct CamlFrameDecoder {
-  CamlFrames* frames ;
-  uint32 currentDescriptor;
-  CamlFrame* currentFrame;
-
-  CamlFrameDecoder(CamlFrames* frames) {
-    this->frames = frames;
-    currentDescriptor = 0;
-    currentFrame = frames->frames();
-  }
-
-  bool hasNext() {
-    return currentDescriptor < frames->NumDescriptors;
-  }
-
-  void advance() {
-    ++currentDescriptor;
-    if (!hasNext()) return;
-    currentFrame = (CamlFrame*) ((char*)currentFrame + 
-      (currentFrame->NumLiveOffsets % 2) * sizeof(uint16_t) +
-      currentFrame->NumLiveOffsets * sizeof(uint16_t) +
-      sizeof(void*) + sizeof(uint16_t) + sizeof(uint16_t));
-  }
-
-  CamlFrame* next() {
-    assert(hasNext());
-    CamlFrame* result = currentFrame;
-    advance();
-    return result;
+    fprintf(stderr, "; %p in Unknown method\n", ip);
   }
-};
-
-CamlFrame* CamlFrames::frames() const {
-  intptr_t ptr = reinterpret_cast<intptr_t>(this) + sizeof(uint32_t);
-  // If the frames structure was not 4-aligned, manually do it here.
-  if (ptr & 2) {
-    ptr -= sizeof(uint16_t);
-  }
-  return reinterpret_cast<CamlFrame*>(ptr);
 }
 
-static BumpPtrAllocator* StaticAllocator = NULL;
 
-FunctionMap::FunctionMap(BumpPtrAllocator& allocator, CamlFrames** allFrames) {
+FunctionMap::FunctionMap(BumpPtrAllocator& allocator, CompiledFrames** allFrames) {
   if (allFrames == NULL) return;
   Functions.resize(40000); // Make sure the cache is big enough.
   int i = 0;
-  CamlFrames* frames = NULL;
-  while ((frames = allFrames[i++]) != NULL) {
-    CamlFrameDecoder decoder(frames);
-    while (decoder.hasNext()) {
-      CamlFrame* frame = decoder.next();
-      CamlMethodInfo* MI =
-          new(allocator, "CamlMethodInfo") CamlMethodInfo(frame);
-      addMethodInfoNoLock(MI, frame->ReturnAddress);
+  CompiledFrames* compiledFrames = NULL;
+  while ((compiledFrames = allFrames[i++]) != NULL) {
+    Frames* currentFrames = compiledFrames->frames();
+    for (uint32_t j = 0; j < compiledFrames->NumCompiledFrames; j++) {
+      FrameIterator iterator(*currentFrames);
+      FrameInfo* frame = NULL;
+      while (iterator.hasNext()) {
+        frame = iterator.next();
+        addFrameInfoNoLock(frame->ReturnAddress, frame);
+      }
+      if (frame != NULL) {
+        currentFrames = reinterpret_cast<Frames*>(
+            reinterpret_cast<uintptr_t>(frame) + MethodInfoHelper::FrameInfoSize(frame->NumLiveOffsets));
+      } else {
+        currentFrames = reinterpret_cast<Frames*>(
+            reinterpret_cast<uintptr_t>(currentFrames) + sizeof(Frames));
+      }
     }
   }
 }
 
-MethodInfo* FunctionMap::IPToMethodInfo(void* ip) {
+// Create a dummy FrameInfo, so that methods don't have to null check.
+static FrameInfo emptyInfo;
+
+FrameInfo* FunctionMap::IPToFrameInfo(void* ip) {
   FunctionMapLock.acquire();
-  llvm::DenseMap<void*, MethodInfo*>::iterator I = Functions.find(ip);
-  MethodInfo* res = NULL;
+  llvm::DenseMap<void*, FrameInfo*>::iterator I = Functions.find(ip);
+  FrameInfo* res = NULL;
   if (I != Functions.end()) {
     res = I->second;
   } else {
-    res = &DefaultMethodInfo::DM;
+    assert(emptyInfo.Metadata == NULL);
+    assert(emptyInfo.NumLiveOffsets == 0);
+    res = &emptyInfo;
   }
   FunctionMapLock.release();
   return res;
 }
 
 
-void FunctionMap::addMethodInfo(MethodInfo* meth, void* ip) {
+void FunctionMap::addFrameInfo(void* ip, FrameInfo* meth) {
   FunctionMapLock.acquire();
-  addMethodInfoNoLock(meth, ip);
-  FunctionMapLock.release();
-}
-
-
-void FunctionMap::removeMethodInfos(void* owner) {
-  FunctionMapLock.acquire();
-  llvm::DenseSet<void*> toRemove;
-  for (llvm::DenseMap<void*, MethodInfo*>::iterator i = Functions.begin(),
-       e = Functions.end(); i != e;) {
-    mvm::MethodInfo* MI = i->second;
-    if (MI->Owner == owner) {
-      toRemove.insert(i->first);
-    }
-  }
-
-  for (llvm::DenseSet<void*>::iterator i = toRemove.begin(),
-       e = toRemove.end(); i != e;) {
-    Functions.erase(*i);
-  }
-
+  addFrameInfoNoLock(ip, meth);
   FunctionMapLock.release();
 }

Modified: vmkit/trunk/lib/Mvm/StaticGCPrinter/VmkitGCPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/StaticGCPrinter/VmkitGCPrinter.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/StaticGCPrinter/VmkitGCPrinter.cpp (original)
+++ vmkit/trunk/lib/Mvm/StaticGCPrinter/VmkitGCPrinter.cpp Thu Aug  4 15:29:08 2011
@@ -1,20 +1,16 @@
-//===-- VmkitGCPrinter.cpp - Vmkit frametable emitter ---------------------===//
+//===----- VmkitAOTGC.cpp - Support for Ahead of Time Compiler GC -------===//
 //
-//                     The LLVM Compiler Infrastructure
+//                            The Vmkit project
 //
 // This file is distributed under the University of Illinois Open Source
 // License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
-//
-// This file implements printing the assembly code for a Vmkit frametable.
-//
-//===----------------------------------------------------------------------===//
 
 #include "llvm/CodeGen/GCs.h"
+#include "llvm/CodeGen/GCStrategy.h"
 #include "llvm/CodeGen/AsmPrinter.h"
 #include "llvm/CodeGen/GCMetadataPrinter.h"
-#include "llvm/CodeGen/GCStrategy.h"
 #include "llvm/Module.h"
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCContext.h"
@@ -25,18 +21,31 @@
 #include "llvm/Target/TargetLoweringObjectFile.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormattedStream.h"
 #include <cctype>
+
 using namespace llvm;
 
 namespace {
-  class VmkitGC : public GCStrategy {
+  class VmkitAOTGC : public GCStrategy {
   public:
-    VmkitGC();
+    VmkitAOTGC();
   };
+}
+
+static GCRegistry::Add<VmkitAOTGC>
+X("vmkit", "Vmkit GC for AOT-generated functions");
 
-  class VmkitGCMetadataPrinter : public GCMetadataPrinter {
+VmkitAOTGC::VmkitAOTGC() {
+  NeededSafePoints = 1 << GC::PostCall;
+  UsesMetadata = true;
+}
+
+namespace {
+
+  class VmkitAOTGCMetadataPrinter : public GCMetadataPrinter {
   public:
     void beginAssembly(AsmPrinter &AP);
     void finishAssembly(AsmPrinter &AP);
@@ -44,21 +53,12 @@
 
 }
 
+static GCMetadataPrinterRegistry::Add<VmkitAOTGCMetadataPrinter>
+Y("vmkit", "Vmkit GC for AOT-generated functions");
 
-static GCRegistry::Add<VmkitGC>
-X("vmkit", "VMKit GC for AOT-generated functions");
-
-
-static GCMetadataPrinterRegistry::Add<VmkitGCMetadataPrinter>
-Y("vmkit", "VMKit GC for AOT-generated functions");
-
-
-VmkitGC::VmkitGC() {
-  NeededSafePoints = 1 << GC::PostCall;
-  UsesMetadata = true;
+void VmkitAOTGCMetadataPrinter::beginAssembly(AsmPrinter &AP) {
 }
 
-
 static bool isAcceptableChar(char C) {
   if ((C < 'a' || C > 'z') &&
       (C < 'A' || C > 'Z') &&
@@ -112,15 +112,14 @@
   AP.OutStreamer.EmitLabel(Sym);
 }
 
-void VmkitGCMetadataPrinter::beginAssembly(AsmPrinter &AP) {
-}
-
 /// emitAssembly - Print the frametable. The ocaml frametable format is thus:
 ///
 ///   extern "C" struct align(sizeof(intptr_t)) {
-///     uint16_t NumDescriptors;
+///     uint32_t NumDescriptors;
 ///     struct align(sizeof(intptr_t)) {
 ///       void *ReturnAddress;
+///       void *Metadata;
+///       uint16_t BytecodeIndex; 
 ///       uint16_t FrameSize;
 ///       uint16_t NumLiveOffsets;
 ///       uint16_t LiveOffsets[NumLiveOffsets];
@@ -131,34 +130,45 @@
 /// (FrameSize and LiveOffsets would overflow). FrameTablePrinter will abort if
 /// either condition is detected in a function which uses the GC.
 ///
-void VmkitGCMetadataPrinter::finishAssembly(AsmPrinter &AP) {
+void VmkitAOTGCMetadataPrinter::finishAssembly(AsmPrinter &AP) {
   unsigned IntPtrSize = AP.TM.getTargetData()->getPointerSize();
+
   AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection());
+
+  AP.EmitAlignment(IntPtrSize == 4 ? 2 : 3);
   EmitVmkitGlobal(getModule(), AP, "frametable");
+  int NumMethodFrames = 0;
+  for (iterator I = begin(), IE = end(); I != IE; ++I) {
+    NumMethodFrames++;
+  }
+  AP.EmitInt32(NumMethodFrames);
 
-  int NumDescriptors = 0;
   for (iterator I = begin(), IE = end(); I != IE; ++I) {
     GCFunctionInfo &FI = **I;
+
+    // Emit the frame symbol
+    SmallString<128> TmpStr;
+    AP.Mang->getNameWithPrefix(TmpStr, FI.getFunction().getName() + "_frame");
+    MCSymbol *Sym = AP.OutContext.GetOrCreateSymbol(TmpStr);
+    AP.OutStreamer.EmitSymbolAttribute(Sym, MCSA_Global);
+    AP.OutStreamer.EmitLabel(Sym);
+
+    int NumDescriptors = 0;
     for (GCFunctionInfo::iterator J = FI.begin(), JE = FI.end(); J != JE; ++J) {
       NumDescriptors++;
     }
-  }
-
-  if (NumDescriptors >= 1<<16) {
-    // Very rude!
-    report_fatal_error(" Too much descriptor for vmkit GC");
-  }
-  AP.EmitInt16(NumDescriptors);
-  AP.EmitAlignment(IntPtrSize == 4 ? 2 : 3);
-
-  for (iterator I = begin(), IE = end(); I != IE; ++I) {
-    GCFunctionInfo &FI = **I;
+    if (NumDescriptors >= 1<<16) {
+      // Very rude!
+      report_fatal_error(" Too much descriptor for J3 AOT GC");
+    }
+    AP.EmitInt32(NumDescriptors);
+    AP.EmitAlignment(IntPtrSize == 4 ? 2 : 3);
 
     uint64_t FrameSize = FI.getFrameSize();
     if (FrameSize >= 1<<16) {
       // Very rude!
       report_fatal_error("Function '" + FI.getFunction().getName() +
-                         "' is too large for the vmkit GC! "
+                         "' is too large for the Vmkit AOT GC! "
                          "Frame size " + Twine(FrameSize) + ">= 65536.\n"
                          "(" + Twine(uintptr_t(&FI)) + ")");
     }
@@ -172,11 +182,21 @@
       if (LiveCount >= 1<<16) {
         // Very rude!
         report_fatal_error("Function '" + FI.getFunction().getName() +
-                           "' is too large for the vmkit GC! "
+                           "' is too large for the Vmkit AOT GC! "
                            "Live root count "+Twine(LiveCount)+" >= 65536.");
       }
 
+      DebugLoc DL = J->Loc;
+      uint32_t sourceIndex = DL.getLine();
+
+      // Metada
+      AP.EmitInt32(0);
+      if (IntPtrSize == 8) {
+        AP.EmitInt32(0);
+      }
+      // Return address
       AP.OutStreamer.EmitSymbolValue(J->Label, IntPtrSize, 0);
+      AP.EmitInt16(sourceIndex);
       AP.EmitInt16(FrameSize);
       AP.EmitInt16(LiveCount);
 
@@ -186,7 +206,7 @@
           // Very rude!
           report_fatal_error(
                  "GC root stack offset is outside of fixed stack frame and out "
-                 "of range for vmkit GC!");
+                 "of range for ocaml GC!");
         }
         AP.EmitInt16(K->StackOffset);
       }

Modified: vmkit/trunk/tools/j3/Main.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/j3/Main.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/tools/j3/Main.cpp (original)
+++ vmkit/trunk/tools/j3/Main.cpp Thu Aug  4 15:29:08 2011
@@ -28,8 +28,9 @@
 
 #include "FrametablesExterns.inc"
 
-CamlFrames* frametables[] = {
+CompiledFrames* frametables[] = {
   #include "FrametablesSymbols.inc"
+  NULL
 };
 
 int main(int argc, char **argv, char **envp) {
@@ -47,7 +48,7 @@
   JavaJITCompiler* Comp = JavaJITCompiler::CreateCompiler("JITModule");
   JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader")
     JnjvmBootstrapLoader(Allocator, Comp, true);
-  Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, (CamlFrames**)frametables, loader);
+  Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, frametables, loader);
  
   // Run the application. 
   vm->runApplication(argc, argv);

Modified: vmkit/trunk/tools/precompiler/Precompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/precompiler/Precompiler.cpp?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/tools/precompiler/Precompiler.cpp (original)
+++ vmkit/trunk/tools/precompiler/Precompiler.cpp Thu Aug  4 15:29:08 2011
@@ -37,8 +37,9 @@
 
 #include "FrametablesExterns.inc"
 
-CamlFrames* frametables[] = {
+CompiledFrames* frametables[] = {
   #include "FrametablesSymbols.inc"
+  NULL
 };
 
 
@@ -66,7 +67,7 @@
   JavaJITCompiler* JIT = JavaJITCompiler::CreateCompiler("JIT");
   JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader")
     JnjvmBootstrapLoader(Allocator, JIT, true);
-  Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, (CamlFrames**)frametables, loader);
+  Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, frametables, loader);
  
   // Run the application. 
   vm->runApplication(argc, argv);

Modified: vmkit/trunk/tools/precompiler/trainer/Makefile
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/tools/precompiler/trainer/Makefile?rev=136914&r1=136913&r2=136914&view=diff
==============================================================================
--- vmkit/trunk/tools/precompiler/trainer/Makefile (original)
+++ vmkit/trunk/tools/precompiler/trainer/Makefile Thu Aug  4 15:29:08 2011
@@ -20,13 +20,13 @@
   J3.Flags := > /dev/null
 endif
 
-Precompiled.bc: $(PRECOMPILER) HelloWorld.java $(LibDir)/StaticJ3GC$(SHLIBEXT) $(LibDir)/StaticGCPass$(SHLIBEXT) $(LibDir)/StaticGCPrinter$(SHLIBEXT)
+Precompiled.bc: $(PRECOMPILER) HelloWorld.java $(LibDir)/StaticGCPass$(SHLIBEXT) $(LibDir)/StaticGCPrinter$(SHLIBEXT)
 	$(Echo) "Building precompiled bootstrap code"
 	$(Verb) javac HelloWorld.java
 	$(Verb) $(PRECOMPILER) -cp $$PWD HelloWorld $(J3.Flags)
 	$(Verb) $(MKDIR) $(ObjDir)
 	$(Verb) $(LOPT) generated.bc -load=$(LibDir)/StaticGCPass$(SHLIBEXT) -StaticGCPass -o $(LibDir)/Precompiled.bc
-	$(Verb) $(LLC) -O0 -fast-isel=false -load=$(LibDir)/StaticJ3GC$(SHLIBEXT) -load=$(LibDir)/StaticGCPrinter$(SHLIBEXT) -disable-fp-elim $(LibDir)/Precompiled.bc -o $(ObjDir)/Precompiled.s
+	$(Verb) $(LLC) -O0 -fast-isel=false -load=$(LibDir)/StaticGCPrinter$(SHLIBEXT) -disable-fp-elim $(LibDir)/Precompiled.bc -o $(ObjDir)/Precompiled.s
 	$(Verb) $(LLVMCC) -c $(ObjDir)/Precompiled.s -o $(ObjDir)/Precompiled.o
 	$(Verb) $(Archive) $(LibDir)/libPrecompiled.a $(ObjDir)/Precompiled.o
 	$(Verb) $(Ranlib) $(LibDir)/libPrecompiled.a





More information about the vmkit-commits mailing list