[vmkit-commits] [vmkit] r120018 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h lib/J3/Classpath/ClasspathVMThread.inc lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/Compiler/JavaJIT.cpp lib/J3/Compiler/LLVMInfo.cpp lib/J3/VMCore/JavaThread.cpp lib/J3/VMCore/JavaThread.h lib/J3/VMCore/Jnjvm.cpp lib/J3/VMCore/Jnjvm.h lib/Mvm/Compiler/mvm-runtime.ll

Gael Thomas gael.thomas at lip6.fr
Tue Nov 23 03:28:22 PST 2010


Author: gthomas
Date: Tue Nov 23 05:28:22 2010
New Revision: 120018

URL: http://llvm.org/viewvc/llvm-project?rev=120018&view=rev
Log:
store directly a mvm::Thread in Jnjvm

Modified:
    vmkit/branches/multi-vm/include/mvm/Threads/Thread.h
    vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc
    vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp
    vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp
    vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp
    vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp
    vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h
    vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp
    vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h
    vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll

Modified: vmkit/branches/multi-vm/include/mvm/Threads/Thread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/include/mvm/Threads/Thread.h?rev=120018&r1=120017&r2=120018&view=diff
==============================================================================
--- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original)
+++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Tue Nov 23 05:28:22 2010
@@ -137,8 +137,18 @@
 
 
 class ExceptionBuffer;
+class Thread;
 
-class VMThreadData {};
+class VMThreadData {
+public:
+	Thread* mut;
+
+	VMThreadData(Thread* m) {
+		this->mut = m;
+	}
+
+	~VMThreadData() {} // force the construction of a VT
+};
 
 /// Thread - This class is the base of custom virtual machines' Thread classes.
 /// It provides static functions to manage threads. An instance of this class

Modified: vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc?rev=120018&r1=120017&r2=120018&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc (original)
+++ vmkit/branches/multi-vm/lib/J3/Classpath/ClasspathVMThread.inc Tue Nov 23 05:28:22 2010
@@ -86,7 +86,7 @@
   javaThread = vm->upcalls->assocThread->getInstanceObjectField(vmThread);
   assert(javaThread && "VMThread with no Java equivalent");
  
-	mvm::MutatorThread* th = JavaThread::create(javaThread, vmThread, vm);
+	mvm::Thread* th = JavaThread::create(javaThread, vmThread, vm);
   if (!th) vm->outOfMemoryError();
   th->start((void (*)(mvm::Thread*))start);
 

Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp?rev=120018&r1=120017&r2=120018&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Tue Nov 23 05:28:22 2010
@@ -2130,7 +2130,7 @@
 
 void JavaAOTCompiler::compileFile(Jnjvm* vm, const char* n) {
   name = n;
-	mvm::MutatorThread* th = JavaThread::create(0, 0, vm);
+	mvm::Thread* th = JavaThread::create(0, 0, vm);
   vm->setMainThread(th);
   th->start((void (*)(mvm::Thread*))mainCompilerStart);
   vm->waitForExit();

Modified: vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp?rev=120018&r1=120017&r2=120018&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaJIT.cpp Tue Nov 23 05:28:22 2010
@@ -320,7 +320,8 @@
 	Value* GEP[2] = { intrinsics->constantZero,
 										intrinsics->OffsetJNIInJavaThreadConstant };
     
-	return GetElementPtrInst::Create(javaThreadPtr, GEP, GEP + 2, "", currentBlock);
+	Value* res = GetElementPtrInst::Create(javaThreadPtr, GEP, GEP + 2, "", currentBlock);
+	return new BitCastInst(res, intrinsics->ptrType, "", currentBlock);
 }
 
 llvm::Value* JavaJIT::getJavaExceptionPtr(llvm::Value* javaThreadPtr) { 
@@ -410,8 +411,6 @@
   
   Value* jniEnv = getJNIEnvPtr(getJavaThreadPtr(getMutatorThreadPtr()));
  
-  jniEnv = new BitCastInst(jniEnv, intrinsics->ptrType, "", currentBlock);
-
   nativeArgs.push_back(jniEnv);
 
   uint32 index = 0;

Modified: vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp?rev=120018&r1=120017&r2=120018&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/Compiler/LLVMInfo.cpp Tue Nov 23 05:28:22 2010
@@ -289,7 +289,7 @@
     const llvm::Type* Ty =
       PointerType::getUnqual(Compiler->getIntrinsics()->JavaObjectType);
 
-    llvmArgs.push_back(Compiler->getIntrinsics()->ptrType); // JNIEnv
+    llvmArgs.push_back(Compiler->getIntrinsics()->ptrType);
     llvmArgs.push_back(Ty); // Class
 
     for (uint32 i = 0; i < size; ++i) {

Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp?rev=120018&r1=120017&r2=120018&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp Tue Nov 23 05:28:22 2010
@@ -52,7 +52,7 @@
 	return (JavaThread*)mut->vmData;
 }
 
-mvm::MutatorThread *JavaThread::create(JavaObject* thread, JavaObject* vmth, Jnjvm* isolate) {
+mvm::Thread *JavaThread::create(JavaObject* thread, JavaObject* vmth, Jnjvm* isolate) {
 	mvm::MutatorThread *res = (mvm::MutatorThread*)new JavaThread(thread, vmth, isolate);
 	res->vmData = (mvm::VMThreadData*)res;
 	return res;

Modified: vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h?rev=120018&r1=120017&r2=120018&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h Tue Nov 23 05:28:22 2010
@@ -155,8 +155,8 @@
   JavaThread(JavaObject* thread, JavaObject* vmThread, Jnjvm* isolate);
 
 public:
-	static mvm::MutatorThread* create(JavaObject* thread, JavaObject* vmThread, Jnjvm* isolate);
-	static JavaThread* j3Thread(mvm::Thread* mut);
+	static mvm::Thread* create(JavaObject* thread, JavaObject* vmThread, Jnjvm* isolate);
+	static JavaThread*  j3Thread(mvm::Thread* mut);
 
   /// get - Get the current thread as a JnJVM object.
   ///

Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp?rev=120018&r1=120017&r2=120018&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.cpp Tue Nov 23 05:28:22 2010
@@ -1398,7 +1398,6 @@
 #endif
    
 	mainThread = JavaThread::create(0, 0, this);
-	mainJ3Thread = JavaThread::j3Thread(mainThread);
   mainThread->start(mainJavaStart);
 }
 

Modified: vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h?rev=120018&r1=120017&r2=120018&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Tue Nov 23 05:28:22 2010
@@ -124,11 +124,11 @@
   
   /// finalizerThread - The thread that finalizes Java objects.
   ///
-	JavaThread* finalizerThread;
+	mvm::Thread* finalizerThread;
  
   /// enqueueThread - The thread that enqueue Java references.
   ///
-	JavaThread* enqueueThread;
+	mvm::Thread* enqueueThread;
 
   /// CreateError - Creates a Java object of the specified exception class
   /// and calling its <init> function.
@@ -169,7 +169,7 @@
   /// mainCompileStart - Starts the static compilation of classes in a Java
   /// thread.
   ///
-  static void mainCompilerStart(JavaThread* thread);
+  static void mainCompilerStart(mvm::Thread* thread);
 
 public:
   
@@ -243,12 +243,6 @@
   /// hashStr - Hash map of java/lang/String objects allocated by this JVM.
   ///
   StringMap hashStr;
-
-  /// hashStr - Hash map of java/lang/String objects allocated by this JVM.
-	/// mainJ3Thread - the main j3 thread
-	JavaThread* mainJ3Thread;
-
-	JavaThread *getMainJ3Thread() { return mainJ3Thread; }
  
 public:
   
@@ -310,19 +304,19 @@
   
   /// setFinalizerThread - Set the finalizer thread of this VM.
   ///
-  void setFinalizerThread(JavaThread* th) { finalizerThread = th; }
+  void setFinalizerThread(mvm::Thread* th) { finalizerThread = th; }
   
   /// getFinalizerThread - Get the finalizer thread of this VM.
   ///
-	JavaThread* getFinalizerThread() const { return finalizerThread; }
+	mvm::Thread* getFinalizerThread() const { return finalizerThread; }
   
   /// setEnqueueThread - Set the enqueue thread of this VM.
   ///
-  void setEnqueueThread(JavaThread* th) { enqueueThread = th; }
+  void setEnqueueThread(mvm::Thread* th) { enqueueThread = th; }
   
   /// getEnqueueThread - Get the enqueue thread of this VM.
   ///
-	JavaThread* getEnqueueThread() const { return enqueueThread; }
+	mvm::Thread* getEnqueueThread() const { return enqueueThread; }
 
   /// ~Jnjvm - Destroy the JVM.
   ///

Modified: vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll?rev=120018&r1=120017&r2=120018&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll (original)
+++ vmkit/branches/multi-vm/lib/Mvm/Compiler/mvm-runtime.ll Tue Nov 23 05:28:22 2010
@@ -20,7 +20,8 @@
 ;;; field 10: void*  lastKnownFrame
 ;;; field 11: void*  lastExceptionBuffer
 ;;; field 12: void*  vmData
-%Thread = type { %CircularBase, i32, i8*, i8*, i8, i8, i8, i8*, i8*, i8*, i8*, i8*, i8* }
+%Thread       = type { %CircularBase, i32, i8*, i8*, i8, i8, i8, i8*, i8*, i8*, i8*, i8*, i8* }
+%VMThreadData = type { %VT*, %Thread* }
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Printing functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;





More information about the vmkit-commits mailing list