[vmkit-commits] [vmkit] r83829 - in /vmkit/trunk: lib/N3/PNetLib/PNetLib.cpp lib/N3/VMCore/Assembly.cpp lib/N3/VMCore/CLIJit.cpp lib/N3/VMCore/CLIJit.h lib/N3/VMCore/N3Debug.h lib/N3/VMCore/N3Initialise.cpp lib/N3/VMCore/Opcodes.cpp lib/N3/VMCore/VMClass.h lib/N3/VMCore/VirtualTables.cpp mmtk/magic/ mmtk/mmtk-j3/

Gael Thomas gael.thomas at lip6.fr
Mon Oct 12 00:56:47 PDT 2009


Author: gthomas
Date: Mon Oct 12 02:56:45 2009
New Revision: 83829

URL: http://llvm.org/viewvc/llvm-project?rev=83829&view=rev
Log:
Add a N3Debug.h file. Rename Exception to ExceptionBlockDesc to avoid any confusion. 
ExceptionBlockDesc is now allocated with the CLIJit (and deleted after a compilation).
Property is now allocated in the Assembly BumpPtrAllocator.


Added:
    vmkit/trunk/lib/N3/VMCore/N3Debug.h
Modified:
    vmkit/trunk/lib/N3/PNetLib/PNetLib.cpp
    vmkit/trunk/lib/N3/VMCore/Assembly.cpp
    vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
    vmkit/trunk/lib/N3/VMCore/CLIJit.h
    vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp
    vmkit/trunk/lib/N3/VMCore/Opcodes.cpp
    vmkit/trunk/lib/N3/VMCore/VMClass.h
    vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp
    vmkit/trunk/mmtk/magic/   (props changed)
    vmkit/trunk/mmtk/mmtk-j3/   (props changed)

Modified: vmkit/trunk/lib/N3/PNetLib/PNetLib.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/PNetLib/PNetLib.cpp?rev=83829&r1=83828&r2=83829&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/PNetLib/PNetLib.cpp (original)
+++ vmkit/trunk/lib/N3/PNetLib/PNetLib.cpp Mon Oct 12 02:56:45 2009
@@ -308,14 +308,11 @@
 }
 
 extern "C" void System_Threading_Monitor_Enter(VMObject* obj) {
-	//	printf("Take lock on: %p\n", (void *)obj);
-  obj->aquire();
+	obj->aquire();
 }
 
 extern "C" void System_Threading_Monitor_Exit(VMObject* obj) {
-	//	printf("Release lock on: %p\n", (void *)obj);
-  obj->unlock();
-	//	printf("Release lock on: %p done\n", (void *)obj);
+	obj->unlock();
 }
 
 
@@ -683,21 +680,22 @@
 }
 
 extern "C" VMObject* System_Reflection_ClrHelpers_GetSemantics(mvm::Object* item, uint32 attributes, bool nonPublic) {
-  if (item->getVirtualTable() == Property::VT) {
-    Property* prop = (Property*)item;
-    if (attributes == METHOD_SEMANTIC_ATTRIBUTES_GETTER) {
-			mvm::PrintBuffer _asciiz(prop->name);
-      const char* asciiz = _asciiz.cString();
-      char* buf = (char*)alloca(strlen(asciiz) + 5);
-      sprintf(buf, "get_%s", asciiz);
-      N3* vm = VMThread::get()->vm;
-      VMMethod* meth = prop->type->lookupMethod(vm->asciizToUTF8(buf), prop->parameters, true, false);
-      assert(meth);
-      return meth->getMethodDelegatee();
-    }
-  } else {
-    VMThread::get()->vm->error("implement me");
-  }
+	VMThread::get()->vm->error("implement me: System_Reflection_ClrHelpers_GetSemantics");
+//   if (item->getVirtualTable() == Property::VT) {
+//     Property* prop = (Property*)item;
+//     if (attributes == METHOD_SEMANTIC_ATTRIBUTES_GETTER) {
+// 			mvm::PrintBuffer _asciiz(prop->name);
+//       const char* asciiz = _asciiz.cString();
+//       char* buf = (char*)alloca(strlen(asciiz) + 5);
+//       sprintf(buf, "get_%s", asciiz);
+//       N3* vm = VMThread::get()->vm;
+//       VMMethod* meth = prop->type->lookupMethod(vm->asciizToUTF8(buf), prop->parameters, true, false);
+//       assert(meth);
+//       return meth->getMethodDelegatee();
+//     }
+//   } else {
+//     VMThread::get()->vm->error("implement me");
+//   }
   return 0;
 }
 

Modified: vmkit/trunk/lib/N3/VMCore/Assembly.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Assembly.cpp?rev=83829&r1=83828&r2=83829&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/Assembly.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/Assembly.cpp Mon Oct 12 02:56:45 2009
@@ -1354,7 +1354,7 @@
   uint32 nameIndex  = propArray[CONSTANT_PROPERTY_NAME];
   uint32 type       = propArray[CONSTANT_PROPERTY_TYPE];
 
-  Property* prop = gc_new(Property)();
+  Property* prop = new(allocator, "Property") Property();
   prop->name = readString(VMThread::get()->vm, stringOffset + nameIndex);
   prop->flags = flags;
   prop->type = cl;

Modified: vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJit.cpp?rev=83829&r1=83828&r2=83829&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIJit.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIJit.cpp Mon Oct 12 02:56:45 2009
@@ -41,7 +41,7 @@
 using namespace llvm;
 using namespace n3;
 
-void Exception::print(mvm::PrintBuffer* buf) const {
+void ExceptionBlockDesc::print(mvm::PrintBuffer* buf) const {
   buf->write("Exception<>");
 }
 
@@ -447,9 +447,9 @@
 }
 
 Instruction* CLIJit::invokeInline(VMMethod* meth, 
-                                  std::vector<Value*>& args, VMGenericClass* genClass, VMGenericMethod* genMethod) {
-  
-  CLIJit* jit = new CLIJit();
+                                  std::vector<Value*>& args, VMGenericClass* genClass, VMGenericMethod* genMethod) {  
+	mvm::BumpPtrAllocator *a = new mvm::BumpPtrAllocator();
+  CLIJit* jit = new(*a, "CLIJit") CLIJit(*a);
   jit->module = meth->classDef->vm->module;
   jit->compilingClass = meth->classDef; 
   jit->compilingMethod = meth;
@@ -461,7 +461,7 @@
                                         currentExceptionBlock, args, dynamic_cast<VMGenericClass*>(jit->compilingClass), genMethod);
   inlineMethods[meth] = false;
 
-	delete jit;
+	delete a;
   return ret;
 }
 
@@ -979,7 +979,7 @@
   // TODO synchronized
 
   for (uint32 i = 0; i < nbe; ++i) {
-    Exception* ex = gc_new(Exception)();
+    ExceptionBlockDesc* ex = new(allocator, "ExceptionBlockDesc") ExceptionBlockDesc();
     uint32 flags = 0;
     uint32 classToken = 0;
     if (fat) {
@@ -1031,11 +1031,11 @@
   }
   
   bool first = true;
-  for (std::vector<Exception*>::iterator i = exceptions.begin(),
+  for (std::vector<ExceptionBlockDesc*>::iterator i = exceptions.begin(),
     e = exceptions.end(); i!= e; ++i) {
 
-    Exception* cur = *i;
-    Exception* next = 0;
+    ExceptionBlockDesc* cur = *i;
+    ExceptionBlockDesc* next = 0;
     if (i + 1 != e) {
       next = *(i + 1);
     }
@@ -1054,11 +1054,11 @@
       
   }
 
-  for (std::vector<Exception*>::iterator i = exceptions.begin(),
+  for (std::vector<ExceptionBlockDesc*>::iterator i = exceptions.begin(),
     e = exceptions.end(); i!= e; ++i) {
 
-    Exception* cur = *i;
-    Exception* next = 0;
+    ExceptionBlockDesc* cur = *i;
+    ExceptionBlockDesc* next = 0;
     BasicBlock* bbNext = 0;
     if (i + 1 != e) {
       next = *(i + 1);
@@ -1442,7 +1442,8 @@
 
 
 Function* CLIJit::compile(VMClass* cl, VMMethod* meth) {
-  CLIJit* jit = new CLIJit();
+	mvm::BumpPtrAllocator *a = new mvm::BumpPtrAllocator();
+  CLIJit* jit = new(*a, "CLIJit") CLIJit(*a);
   jit->compilingClass = cl; 
   jit->compilingMethod = meth;
   jit->module = cl->vm->module;
@@ -1457,7 +1458,7 @@
     func = jit->compileFatOrTiny(dynamic_cast<VMGenericClass*>(cl), dynamic_cast<VMGenericMethod*>(meth));
   }
 
-	delete jit;
+	delete a;
 	//	printf("Compiling: %s\n", mvm::PrintBuffer(meth).cString());
   return func;
 }

Modified: vmkit/trunk/lib/N3/VMCore/CLIJit.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/CLIJit.h?rev=83829&r1=83828&r2=83829&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIJit.h (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIJit.h Mon Oct 12 02:56:45 2009
@@ -40,20 +40,19 @@
 class VMGenericClass;
 class VMGenericMethod;
 
-class Exception : public mvm::Object {
+class ExceptionBlockDesc : public mvm::PermanentObject {
 public:
-  static VirtualTable* VT;
-  uint32 tryOffset;
-  uint32 tryLength;
-  uint32 handlerOffset;
-  uint32 handlerLength;
-  VMCommonClass* catchClass;
-  llvm::BasicBlock* test;
-  llvm::BasicBlock* realTest;
-  llvm::BasicBlock* handler;
+	static VirtualTable* VT;
+	uint32 tryOffset;
+	uint32 tryLength;
+	uint32 handlerOffset;
+	uint32 handlerLength;
+	VMCommonClass* catchClass;
+	llvm::BasicBlock* test;
+	llvm::BasicBlock* realTest;
+	llvm::BasicBlock* handler;
 
-  virtual void print(mvm::PrintBuffer* buf) const;
-  virtual void TRACER;
+	virtual void print(mvm::PrintBuffer* buf) const;
 };
 
 class Opinfo {
@@ -69,8 +68,12 @@
 };
 
 
-class CLIJit {
+class CLIJit : public mvm::PermanentObject {
 public:
+	mvm::BumpPtrAllocator &allocator;
+
+	CLIJit(mvm::BumpPtrAllocator &a) : allocator(a) {}
+
   virtual void print(mvm::PrintBuffer* buf) const {
     buf->write("CLIJit");
   }
@@ -115,13 +118,14 @@
   llvm::Value* top();
   
   // exceptions
-  llvm::BasicBlock* endExceptionBlock;
-  llvm::BasicBlock* currentExceptionBlock;
-  llvm::BasicBlock* unifiedUnreachable;
-  std::vector<Exception*> exceptions;
-  std::vector<Exception*> finallyHandlers;
+  llvm::BasicBlock*                endExceptionBlock;
+  llvm::BasicBlock*                currentExceptionBlock;
+  llvm::BasicBlock*                unifiedUnreachable;
+  std::vector<ExceptionBlockDesc*> exceptions;
+  std::vector<ExceptionBlockDesc*> finallyHandlers;
+
   uint32 readExceptionTable(uint32 offset, bool fat, VMGenericClass* genClass, VMGenericMethod* genMethod);
-  std::vector<llvm::BasicBlock*> leaves; 
+  std::vector<llvm::BasicBlock*>   leaves; 
   llvm::Value* supplLocal;
 
   // calls

Added: vmkit/trunk/lib/N3/VMCore/N3Debug.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/N3Debug.h?rev=83829&view=auto

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/N3Debug.h (added)
+++ vmkit/trunk/lib/N3/VMCore/N3Debug.h Mon Oct 12 02:56:45 2009
@@ -0,0 +1,20 @@
+#ifndef _N3_DEBUG_H_
+#define _N3_DEBUG_H_
+
+#if 0
+#define DEBUG         1
+#define WITH_COLOR    1
+#define N3_COMPILE    2
+#define N3_EXECUTE    2
+#define N3_LOAD       1
+#else
+#define DEBUG         0
+#define WITH_COLOR    0
+#define N3_COMPILE    0
+#define N3_EXECUTE    0
+#define N3_LOAD       0
+#endif
+
+#include "debug.h"
+
+#endif

Modified: vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp?rev=83829&r1=83828&r2=83829&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/N3Initialise.cpp Mon Oct 12 02:56:45 2009
@@ -173,7 +173,6 @@
 	}
 #endif
   
-  INIT(Property);
   INIT(VMCond);
   INIT(LockObj);
 
@@ -189,7 +188,6 @@
   INIT(ArrayFloat);
   INIT(ArrayDouble);
   INIT(ArrayObject);
-  INIT(Exception);
   INIT(CLIString);
   INIT(ThreadSystem);
 

Modified: vmkit/trunk/lib/N3/VMCore/Opcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/Opcodes.cpp?rev=83829&r1=83828&r2=83829&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/Opcodes.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/Opcodes.cpp Mon Oct 12 02:56:45 2009
@@ -937,10 +937,10 @@
         assert(bb);
         stack.clear();
         if (finallyHandlers.size()) {
-          Exception* res = 0;
-          for (std::vector<Exception*>::iterator i = finallyHandlers.begin(), 
+          ExceptionBlockDesc* res = 0;
+          for (std::vector<ExceptionBlockDesc*>::iterator i = finallyHandlers.begin(), 
                e = finallyHandlers.end(); i!= e; ++i) {
-            Exception* ex = (*i);
+            ExceptionBlockDesc* ex = (*i);
             if (tmp >= ex->tryOffset && tmp < ex->tryOffset + ex->tryLength) {
               res = ex;
               break;
@@ -969,10 +969,10 @@
         assert(bb);
         stack.clear();
         if (finallyHandlers.size()) {
-          Exception* res = 0;
-          for (std::vector<Exception*>::iterator i = finallyHandlers.begin(), 
+          ExceptionBlockDesc* res = 0;
+          for (std::vector<ExceptionBlockDesc*>::iterator i = finallyHandlers.begin(), 
                e = finallyHandlers.end(); i!= e; ++i) {
-            Exception* ex = (*i);
+            ExceptionBlockDesc* ex = (*i);
             if (tmp >= ex->tryOffset && tmp < ex->tryOffset + ex->tryLength) {
               res = ex;
               break;

Modified: vmkit/trunk/lib/N3/VMCore/VMClass.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMClass.h?rev=83829&r1=83828&r2=83829&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMClass.h (original)
+++ vmkit/trunk/lib/N3/VMCore/VMClass.h Mon Oct 12 02:56:45 2009
@@ -291,9 +291,8 @@
   const UTF8* name;
 };
 
-class Property : public mvm::Object {
+class Property : public mvm::PermanentObject {
 public:
-  static VirtualTable* VT;
   virtual void print(mvm::PrintBuffer* buf) const;
   virtual void TRACER;
   

Modified: vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp?rev=83829&r1=83828&r2=83829&view=diff

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VirtualTables.cpp Mon Oct 12 02:56:45 2009
@@ -41,8 +41,6 @@
   INIT(VMObject);
   INIT(ThreadSystem);
   INIT(CLIString);
-  INIT(Property);
-  INIT(Exception);
   
 #undef INIT
 
@@ -123,7 +121,7 @@
 
   assembly->CALL_TRACER;
   //funcs->MARK_AND_TRACE;
-  TRACE_VECTOR(Property*, properties, gc_allocator);
+  CALL_TRACER_VECTOR(Property*, properties, gc_allocator);
 }
 
 void VMClass::TRACER {
@@ -229,10 +227,6 @@
 void CLIString::TRACER {
 }
 
-void Exception::TRACER {
-  catchClass->CALL_TRACER;
-}
-
 #ifdef MULTIPLE_GC
 extern "C" void CLIObjectTracer(VMObject* obj, Collector* GC) {
 #else

Propchange: vmkit/trunk/mmtk/magic/

------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Oct 12 02:56:45 2009
@@ -0,0 +1 @@
+Release

Propchange: vmkit/trunk/mmtk/mmtk-j3/

------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Oct 12 02:56:45 2009
@@ -0,0 +1 @@
+Release





More information about the vmkit-commits mailing list