[llvm-commits] [vmkit] r49722 - in /vmkit/trunk/lib/N3/VMCore: BackTrace.cpp CLIJit.cpp N3.cpp PNetLib.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue Apr 15 03:53:36 PDT 2008


Author: geoffray
Date: Tue Apr 15 05:53:25 2008
New Revision: 49722

URL: http://llvm.org/viewvc/llvm-project?rev=49722&view=rev
Log:
Cooperate with multiple GCs.


Modified:
    vmkit/trunk/lib/N3/VMCore/BackTrace.cpp
    vmkit/trunk/lib/N3/VMCore/CLIJit.cpp
    vmkit/trunk/lib/N3/VMCore/N3.cpp
    vmkit/trunk/lib/N3/VMCore/PNetLib.cpp

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

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/BackTrace.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/BackTrace.cpp Tue Apr 15 05:53:25 2008
@@ -35,7 +35,11 @@
   int real_size = backtrace((void**)(void*)ips, 100);
   int n = 0;
   while (n < real_size) {
+#ifdef MULTIPLE_GC
+    int *begIp = (int*)mvm::Thread::get()->GC->begOf(ips[n++]);
+#else
     int *begIp = (int*)Collector::begOf(ips[n++]);
+#endif
     if (begIp) {
       unsigned char* val = (unsigned char*)begIp + sizeof(mvm::Code);
       const llvm::GlobalValue * glob = 
@@ -72,7 +76,11 @@
   int n = 0;
   int i = 0;
   while (n < real_size) {
+#ifdef MULTIPLE_GC
+    int *begIp = (int*)mvm::Thread::get()->GC->begOf(ips[n++]);
+#else
     int *begIp = (int*)Collector::begOf(ips[n++]);
+#endif
     if (begIp) {
       unsigned char* val = (unsigned char*)begIp + sizeof(mvm::Code);
       const llvm::GlobalValue * glob = 
@@ -102,7 +110,11 @@
   int n = 0;
   int i = 0;
   while (n < real_size) {
+#ifdef MULTIPLE_GC
+    int *begIp = (int*)mvm::Thread::get()->GC->begOf(ips[n++]);
+#else
     int *begIp = (int*)Collector::begOf(ips[n++]);
+#endif
     if (begIp) {
       unsigned char* val = (unsigned char*)begIp + sizeof(mvm::Code);
       const llvm::GlobalValue * glob = 

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

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/CLIJit.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/CLIJit.cpp Tue Apr 15 05:53:25 2008
@@ -1443,7 +1443,11 @@
 
 
 extern "C" bool isInCode(void* value) {
+#ifdef MULTIPLE_GC
+  mvm::Object* obj = (mvm::Object*)mvm::Thread::get()->GC->begOf(value);
+#else
   mvm::Object* obj = (mvm::Object*)Collector::begOf(value);
+#endif
   if (obj && obj->getVirtualTable() == mvm::Code::VT) {
     return true;
   } else {

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

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/N3.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/N3.cpp Tue Apr 15 05:53:25 2008
@@ -11,6 +11,8 @@
 #include "llvm/Module.h"
 #include "llvm/Support/CommandLine.h"
 
+#include "mvm/JIT.h"
+
 #include "types.h"
 #include "Assembly.h"
 #include "CLIJit.h"
@@ -56,6 +58,10 @@
 
 N3* N3::allocateBootstrap() {
   N3 *vm= gc_new(N3)();
+
+#ifdef MULTIPLE_GC
+  Collector* GC = Collector::allocate();
+#endif 
   
   vm->module = new llvm::Module("Bootstrap N3");
   vm->protectModule = mvm::Lock::allocNormal();
@@ -63,9 +69,13 @@
   vm->TheModuleProvider = new N3ModuleProvider(vm->module, vm->functions);
   CLIJit::initialiseBootstrapVM(vm);
   
-  
   vm->bootstrapThread = VMThread::allocate(0, vm);
+#ifdef MULTIPLE_GC
+  vm->bootstrapThread->GC = GC;
+  mvm::jit::memoryManager->addGCForModule(vm->module, GC);
+#endif
   VMThread::threadKey->set(vm->bootstrapThread);
+
   vm->name = "bootstrapN3";
   vm->hashUTF8 = UTF8Map::allocate();
   vm->hashStr = StringMap::allocate();
@@ -79,6 +89,10 @@
 N3* N3::allocate(char* name, N3* parent) {
   N3 *vm= gc_new(N3)();
   
+#ifdef MULTIPLE_GC
+  Collector* GC = Collector::allocate();
+#endif 
+  
   vm->module = new llvm::Module("App Domain");
   vm->protectModule = mvm::Lock::allocNormal();
   vm->functions = FunctionMap::allocate();
@@ -86,7 +100,12 @@
   CLIJit::initialiseAppDomain(vm);
 
   vm->bootstrapThread = VMThread::allocate(0, vm);
+#ifdef MULTIPLE_GC
+  vm->bootstrapThread->GC = GC;
+  mvm::jit::memoryManager->addGCForModule(vm->module, GC);
+#endif
   VMThread::threadKey->set(vm->bootstrapThread);
+  
   vm->threadSystem = ThreadSystem::allocateThreadSystem();
   vm->name = name;
   vm->hashUTF8 = parent->hashUTF8;
@@ -96,7 +115,6 @@
   vm->coreAssembly = parent->coreAssembly;
   vm->loadedAssemblies->hash(parent->coreAssembly->name, parent->coreAssembly);
   
-  
   return vm; 
 }
 

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

==============================================================================
--- vmkit/trunk/lib/N3/VMCore/PNetLib.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/PNetLib.cpp Tue Apr 15 05:53:25 2008
@@ -1021,13 +1021,7 @@
   return vm->UTF8ToStr(res);
 }
 
-// LLVM Bug
-#if defined (__PPC__) && !defined (__MACH__)
-extern "C" uint32 System_Reflection_ClrResourceStream_ResourceRead(Assembly* assembly, uint32 position1, uint32 position2, ArrayUInt8* buffer, uint32 offset, uint32 count) {
-  uint64 position = position1 << 32 + position2;
-#else
 extern "C" uint32 System_Reflection_ClrResourceStream_ResourceRead(Assembly* assembly, uint64 position, ArrayUInt8* buffer, uint32 offset, uint32 count) {
-#endif
   uint32 resRva = assembly->resRva;
   ArrayUInt8* bytes = assembly->bytes;
   Section* textSection = assembly->textSection;
@@ -1146,7 +1140,11 @@
 }
 
 extern "C" void System_GC_Collect() {
+#ifdef MULTIPLE_GC
+  mvm::Thread::get()->GC->collect();
+#else
   Collector::collect();
+#endif
 }
 
 





More information about the llvm-commits mailing list