[vmkit-commits] [vmkit] r117229 - in /vmkit/branches/precise: include/j3/JavaCompiler.h include/j3/JavaJITCompiler.h include/mvm/CompilationUnit.h include/mvm/VirtualMachine.h lib/J3/VMCore/Jnjvm.cpp lib/Mvm/GCMmap2/gccollector.cpp mmtk/mmtk-j3/Scanning.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sun Oct 24 08:50:13 PDT 2010


Author: geoffray
Date: Sun Oct 24 10:50:13 2010
New Revision: 117229

URL: http://llvm.org/viewvc/llvm-project?rev=117229&view=rev
Log:
Continue the cleanup.


Removed:
    vmkit/branches/precise/include/mvm/CompilationUnit.h
Modified:
    vmkit/branches/precise/include/j3/JavaCompiler.h
    vmkit/branches/precise/include/j3/JavaJITCompiler.h
    vmkit/branches/precise/include/mvm/VirtualMachine.h
    vmkit/branches/precise/lib/J3/VMCore/Jnjvm.cpp
    vmkit/branches/precise/lib/Mvm/GCMmap2/gccollector.cpp
    vmkit/branches/precise/mmtk/mmtk-j3/Scanning.cpp

Modified: vmkit/branches/precise/include/j3/JavaCompiler.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/include/j3/JavaCompiler.h?rev=117229&r1=117228&r2=117229&view=diff
==============================================================================
--- vmkit/branches/precise/include/j3/JavaCompiler.h (original)
+++ vmkit/branches/precise/include/j3/JavaCompiler.h Sun Oct 24 10:50:13 2010
@@ -102,10 +102,6 @@
 
   virtual ~JavaCompiler() {}
 
-  virtual mvm::StackScanner* createStackScanner() {
-    return new mvm::UnpreciseStackScanner();
-  }
-
   virtual void* loadMethod(void* handle, const char* symbol) {
     return dlsym(handle, symbol);
   }

Modified: vmkit/branches/precise/include/j3/JavaJITCompiler.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/include/j3/JavaJITCompiler.h?rev=117229&r1=117228&r2=117229&view=diff
==============================================================================
--- vmkit/branches/precise/include/j3/JavaJITCompiler.h (original)
+++ vmkit/branches/precise/include/j3/JavaJITCompiler.h Sun Oct 24 10:50:13 2010
@@ -74,26 +74,11 @@
   
   virtual void setMethod(llvm::Function* func, void* ptr, const char* name);
   
-
-#ifdef SERVICE
-  virtual llvm::Value* getIsolate(Jnjvm* vm, llvm::Value* Where);
-#endif
- 
   virtual llvm::Value* addCallback(Class* cl, uint16 index, Signdef* sign,
                                    bool stat, llvm::BasicBlock* insert) = 0;
   virtual uintptr_t getPointerOrStub(JavaMethod& meth, int type) = 0;
 
-#ifdef WITH_LLVM_GCC
-  virtual mvm::StackScanner* createStackScanner() {
-    if (useCooperativeGC())
-      return new mvm::PreciseStackScanner();
-    
-    return new mvm::UnpreciseStackScanner();
-  }
-#endif
-  
   static JavaJITCompiler* CreateCompiler(const std::string& ModuleID);
-
 };
 
 class JavaJ3LazyJITCompiler : public JavaJITCompiler {

Removed: vmkit/branches/precise/include/mvm/CompilationUnit.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/include/mvm/CompilationUnit.h?rev=117228&view=auto
==============================================================================
--- vmkit/branches/precise/include/mvm/CompilationUnit.h (original)
+++ vmkit/branches/precise/include/mvm/CompilationUnit.h (removed)
@@ -1,33 +0,0 @@
-//===---- CompilingUnit.h - A compilation unit to compile source files ----===//
-//
-//                            The VMKit project
-//
-// This file is distributed under the University of Pierre et Marie Curie 
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// A compilation unit contains a module and a module provider to compile source
-// files of a virtual machine, e.g .java files in Java.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef MVM_COMPILATION_UNIT_H
-#define MVM_COMPILATION_UNIT_H
-
-#include "mvm/Object.h"
-
-namespace mvm {
-
-class MvmModule;
-
-class CompilationUnit : public mvm::Object {
-public:
-  MvmModule* TheModule;
-
-  void AddStandardCompilePasses();
-};
-}
-
-
-#endif

Modified: vmkit/branches/precise/include/mvm/VirtualMachine.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/include/mvm/VirtualMachine.h?rev=117229&r1=117228&r2=117229&view=diff
==============================================================================
--- vmkit/branches/precise/include/mvm/VirtualMachine.h (original)
+++ vmkit/branches/precise/include/mvm/VirtualMachine.h Sun Oct 24 10:50:13 2010
@@ -62,7 +62,6 @@
   }
 
   virtual ~VirtualMachine() {
-    if (scanner) delete scanner;
   }
 
 public:
@@ -161,20 +160,16 @@
   ///
   virtual void tracer(uintptr_t closure) {}
 
-  /// scanner - Scanner of threads' stacks.
-  ///
-  mvm::StackScanner* scanner;
-
-  mvm::StackScanner* getScanner() {
-    return scanner;
-  }
-
   /// rendezvous - The rendezvous implementation for garbage collection.
   ///
+  /// scanner - Scanner of threads' stacks.
+  ///
 #ifdef WITH_LLVM_GCC
   CooperativeCollectionRV rendezvous;
+  PreciseStackScanner scanner;
 #else
   UncooperativeCollectionRV rendezvous;
+  UnpreciseStackScanner scanner;
 #endif
 
 //===----------------------------------------------------------------------===//

Modified: vmkit/branches/precise/lib/J3/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/J3/VMCore/Jnjvm.cpp?rev=117229&r1=117228&r2=117229&view=diff
==============================================================================
--- vmkit/branches/precise/lib/J3/VMCore/Jnjvm.cpp (original)
+++ vmkit/branches/precise/lib/J3/VMCore/Jnjvm.cpp Sun Oct 24 10:50:13 2010
@@ -43,12 +43,6 @@
 const char* Jnjvm::envSeparator = ":";
 const unsigned int Jnjvm::Magic = 0xcafebabe;
 
-#ifdef ISOLATE
-Jnjvm* Jnjvm::RunningIsolates[NR_ISOLATES];
-mvm::LockNormal Jnjvm::IsolateLock;
-#endif
-
-
 /// initialiseClass - Java class initialisation. Java specification §2.17.5.
 
 void UserClass::initialiseClass(Jnjvm* vm) {
@@ -124,16 +118,12 @@
     bool vmjced = (getInitializationState() == vmjc);
     setInitializationState(inClinit);
     UserClass* cl = (UserClass*)this;
-#if defined(ISOLATE) || defined(ISOLATE_SHARING)
-    // Isolate environments allocate the static instance on their own, not when
-    // the class is being resolved.
-    cl->allocateStaticInstance(vm);
-#else
+    
     // Single environment allocates the static instance during resolution, so
     // that compiled code can access it directly (with an initialization
     // check just before the access)
     if (!cl->getStaticInstance()) cl->allocateStaticInstance(vm);
-#endif
+
     release();
   
 
@@ -162,11 +152,6 @@
       }
     }
  
-#ifdef SERVICE
-    if (classLoader == classLoader->bootstrapLoader || 
-        classLoader->getIsolate() == vm) {
-#endif
-
     // 8. Next, execute either the class variable initializers and static
     //    initializers of the class or the field initializers of the interface,
     //    in textual order, as though they were a single block, except that
@@ -201,9 +186,6 @@
         self->clearException();
       } END_CATCH;
     }
-#ifdef SERVICE
-    }
-#endif
 
     // 9. If the execution of the initializers completes normally, then lock
     //    this Class object, label it fully initialized, notify all waiting 
@@ -1130,9 +1112,6 @@
   }
   upcalls->newString->initialiseClass(this);
 
-#ifdef SERVICE
-  if (!IsolateID)
-#endif
   // The initialization code of the classes initialized below may require
   // to get the Java thread, so we create the Java thread object first.
   upcalls->InitializeThreading(this);
@@ -1191,9 +1170,6 @@
   obj = JavaThread::get()->currentThread();
   javaLoader = appClassLoader->getJavaClassLoader();
 
-#ifdef SERVICE
-  if (!IsolateID)
-#endif
   upcalls->setContextClassLoader->invokeIntSpecial(this, upcalls->newThread,
                                                    obj, &javaLoader);
   // load and initialise math since it is responsible for dlopen'ing 
@@ -1321,10 +1297,6 @@
     fprintf(stderr, "Exception %s while bootstrapping VM.",
         UTF8Buffer(JavaObject::getClass(exc)->name).cString());
   } else {
-#ifdef SERVICE
-    thread->ServiceException = vm->upcalls->newThrowable->doNew(vm);
-#endif
-
     ClArgumentsInfo& info = vm->argumentsInfo;
   
     if (info.agents.size()) {
@@ -1361,45 +1333,9 @@
   nonDaemonLock.unlock();  
 }
 
-#ifdef SERVICE
-
-#include <signal.h>
-
-extern void terminationHandler(int);
-
-static void serviceCPUMonitor(mvm::Thread* th) {
-  while (true) {
-    sleep(1);
-    for(JavaThread* cur = (Java*)th->next(); cur != th;
-        cur = (JavaThread*)cur->next()) {
-        JavaThread* th = (JavaThread*)cur;
-        if (!(th->StateWaiting)) {
-          mvm::VirtualMachine* executingVM = cur->MyVM;
-          assert(executingVM && "Thread with no VM!");
-          ++executingVM->executionTime;
-      }
-    }
-  }
-}
-#endif
-
 void Jnjvm::runApplication(int argc, char** argv) {
   argumentsInfo.argc = argc;
   argumentsInfo.argv = argv;
-#ifdef SERVICE
-  struct sigaction sa;
-  sigset_t mask;
-  sigfillset(&mask);
-  sigaction(SIGUSR1, 0, &sa);
-  sa.sa_mask = mask;
-  sa.sa_handler = terminationHandler;
-  sa.sa_flags |= SA_RESTART;
-  sigaction(SIGUSR1, &sa, NULL);
-
-  mvm::Thread* th = new JavaThread(0, 0, this);
-  th->start(serviceCPUMonitor);
-#endif
-   
   mainThread = new JavaThread(0, 0, this);
   mainThread->start((void (*)(mvm::Thread*))mainJavaStart);
 }
@@ -1414,7 +1350,6 @@
   jniEnv = &JNI_JNIEnvTable;
   javavmEnv = &JNI_JavaVMTable;
   
-
   bootstrapLoader = loader;
   upcalls = bootstrapLoader->upcalls;
 
@@ -1430,26 +1365,9 @@
   }
 
   bootstrapLoader->insertAllMethodsInVM(this);  
-
-#ifdef ISOLATE
-  IsolateLock.lock();
-  for (uint32 i = 0; i < NR_ISOLATES; ++i) {
-    if (RunningIsolates[i] == 0) {
-      RunningIsolates[i] = this;
-      IsolateID = i;
-      break;
-    }
-  }
-  IsolateLock.unlock();
-#endif
-
-  scanner = loader->getCompiler()->createStackScanner();
 }
 
 Jnjvm::~Jnjvm() {
-#ifdef ISOLATE
-  RunningIsolates[IsolateID] = 0;
-#endif
 }
 
 ArrayUInt16* Jnjvm::asciizToArray(const char* asciiz) {
@@ -1533,18 +1451,6 @@
   finalizerThread->addFinalizationCandidate(object);
 }
 
-/// JavaStaticCompiler - Compiler for AOT-compiled programs that
-/// do not use the JIT.
-class JavaStaticCompiler : public JavaCompiler {
-public:
-#ifdef WITH_LLVM_GCC
-  virtual mvm::StackScanner* createStackScanner() {
-    return new mvm::PreciseStackScanner();
-  }
-#endif
-};
-
-
 // Helper function to run J3 without JIT.
 extern "C" int StartJnjvmWithoutJIT(int argc, char** argv, char* mainClass) {
   mvm::Collector::initialise();
@@ -1556,7 +1462,7 @@
   newArgv[1] = mainClass;
  
   mvm::BumpPtrAllocator Allocator;
-  JavaCompiler* Comp = new JavaStaticCompiler();
+  JavaCompiler* Comp = new JavaCompiler();
   JnjvmBootstrapLoader* loader = new(Allocator, "Bootstrap loader")
     JnjvmBootstrapLoader(Allocator, Comp, true);
   Jnjvm* vm = new(Allocator, "VM") Jnjvm(Allocator, loader);

Modified: vmkit/branches/precise/lib/Mvm/GCMmap2/gccollector.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/lib/Mvm/GCMmap2/gccollector.cpp?rev=117229&r1=117228&r2=117229&view=diff
==============================================================================
--- vmkit/branches/precise/lib/Mvm/GCMmap2/gccollector.cpp (original)
+++ vmkit/branches/precise/lib/Mvm/GCMmap2/gccollector.cpp Sun Oct 24 10:50:13 2010
@@ -33,18 +33,14 @@
 
 void Collector::do_collect() {
   GCChunkNode  *cur;
-#ifdef SERVICE
-  mvm::Thread::get()->MyVM->_since_last_collection = _collect_freq_auto;
-#else
   _since_last_collection = _collect_freq_auto;
-#endif
 
   current_mark++;
 
   unused_nodes->attrape(used_nodes);
 
   mvm::Thread* th = mvm::Thread::get();
-  mvm::StackScanner* sc = th->MyVM->getScanner();
+  mvm::StackScanner& sc = th->MyVM->scanner;
   th->MyVM->rendezvous.startRV();
   th->MyVM->startCollection();
 
@@ -57,7 +53,7 @@
 
   // (2) Trace the threads.
   do {
-    sc->scanStack(tcur, 0);
+    sc.scanStack(tcur, 0);
     tcur->tracer(0);
     tcur = (mvm::Thread*)tcur->next();
   } while (tcur != th);

Modified: vmkit/branches/precise/mmtk/mmtk-j3/Scanning.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/precise/mmtk/mmtk-j3/Scanning.cpp?rev=117229&r1=117228&r2=117229&view=diff
==============================================================================
--- vmkit/branches/precise/mmtk/mmtk-j3/Scanning.cpp (original)
+++ vmkit/branches/precise/mmtk/mmtk-j3/Scanning.cpp Sun Oct 24 10:50:13 2010
@@ -20,11 +20,11 @@
   // When entering this function, all threads are waiting on the rendezvous to
   // finish.
   mvm::Thread* th = mvm::Thread::get();
-  mvm::StackScanner* sc = th->MyVM->getScanner();  
+  mvm::StackScanner& sc = th->MyVM->scanner;
   mvm::Thread* tcur = th;
   
   do {
-    sc->scanStack(tcur, reinterpret_cast<uintptr_t>(TL));
+    sc.scanStack(tcur, reinterpret_cast<uintptr_t>(TL));
     tcur = (mvm::Thread*)tcur->next();
   } while (tcur != th);
 }





More information about the vmkit-commits mailing list