[vmkit-commits] [vmkit] r120067 - in /vmkit/branches/multi-vm: include/mvm/Threads/Thread.h lib/J3/Compiler/JavaAOTCompiler.cpp lib/J3/LLVMRuntime/runtime-default.ll lib/J3/VMCore/JavaThread.cpp lib/J3/VMCore/JavaThread.h lib/J3/VMCore/Jnjvm.h mmtk/mmtk-j3/ActivePlan.cpp
Gael Thomas
gael.thomas at lip6.fr
Tue Nov 23 15:12:30 PST 2010
Author: gthomas
Date: Tue Nov 23 17:12:30 2010
New Revision: 120067
URL: http://llvm.org/viewvc/llvm-project?rev=120067&view=rev
Log:
The mutator thead is now independant from the vm. It contains a pointer to the specific thread local storage of a vm (JavaThread for J3). JavaThread inherits VMThreadData.
Modified:
vmkit/branches/multi-vm/include/mvm/Threads/Thread.h
vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp
vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll
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.h
vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp
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=120067&r1=120066&r2=120067&view=diff
==============================================================================
--- vmkit/branches/multi-vm/include/mvm/Threads/Thread.h (original)
+++ vmkit/branches/multi-vm/include/mvm/Threads/Thread.h Tue Nov 23 17:12:30 2010
@@ -148,7 +148,7 @@
this->mut = m;
}
- ~VMThreadData() {} // force the construction of a VT
+ virtual ~VMThreadData() {} // force the construction of a VT
};
/// Thread - This class is the base of custom virtual machines' Thread classes.
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=120067&r1=120066&r2=120067&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/Compiler/JavaAOTCompiler.cpp Tue Nov 23 17:12:30 2010
@@ -1941,8 +1941,8 @@
static const char* name;
-void mainCompilerStart(JavaThread* th) {
-
+void mainCompilerStart(mvm::Thread* mut) {
+ JavaThread* th = JavaThread::j3Thread(mut);
Jnjvm* vm = th->getJVM();
JnjvmBootstrapLoader* bootstrapLoader = vm->bootstrapLoader;
JavaAOTCompiler* M = (JavaAOTCompiler*)bootstrapLoader->getCompiler();
@@ -2132,7 +2132,7 @@
name = n;
mvm::Thread* th = JavaThread::create(0, 0, vm);
vm->setMainThread(th);
- th->start((void (*)(mvm::Thread*))mainCompilerStart);
+ th->start(mainCompilerStart);
vm->waitForExit();
}
Modified: vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll?rev=120067&r1=120066&r2=120067&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll (original)
+++ vmkit/branches/multi-vm/lib/J3/LLVMRuntime/runtime-default.ll Tue Nov 23 17:12:30 2010
@@ -24,7 +24,7 @@
;;; Field 3: The static instance
%TaskClassMirror = type { i8, i1, i8* }
-%JavaThread = type { %MutatorThread, i8*, %JavaObject* }
+%JavaThread = type { %VMThreadData, i8*, %JavaObject* }
%Attribut = type { %UTF8*, i32, i32 }
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=120067&r1=120066&r2=120067&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp Tue Nov 23 17:12:30 2010
@@ -23,8 +23,8 @@
const unsigned int JavaThread::StateWaiting = 1;
const unsigned int JavaThread::StateInterrupted = 2;
-JavaThread::JavaThread(JavaObject* thread, JavaObject* vmth, Jnjvm* isolate)
- : ZZZ() {
+JavaThread::JavaThread(mvm::Thread* mut, JavaObject* thread, JavaObject* vmth, Jnjvm* isolate)
+ : mvm::VMThreadData(mut) {
llvm_gcroot(thread, 0);
llvm_gcroot(vmth, 0);
@@ -52,11 +52,10 @@
}
mvm::Thread *JavaThread::create(JavaObject* thread, JavaObject* vmth, Jnjvm* isolate) {
- JavaThread *th = new JavaThread(thread, vmth, isolate);
- mvm::Thread *mut = (mvm::Thread*)th;
+ mvm::Thread *mut = new mvm::MutatorThread();
+ JavaThread *th = new JavaThread(mut, thread, vmth, isolate);
mut->MyVM = isolate;
- mut->vmData = (mvm::VMThreadData*)th;
- th->mut = mut;
+ mut->vmData = th;
return mut;
}
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=120067&r1=120066&r2=120067&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h Tue Nov 23 17:12:30 2010
@@ -60,23 +60,11 @@
mut->enterUncooperativeCode(SP); \
return; } \
-
-class ZZZ : private mvm::MutatorThread {
-public:
- void* operator new(size_t sz) {
- return mvm::MutatorThread::operator new(sz);
- }
-
- void operator delete(void* th) {
- mvm::MutatorThread::operator delete(th);
- }
-};
-
/// JavaThread - This class is the internal representation of a Java thread.
/// It maintains thread-specific information such as its state, the current
/// exception if there is one, the layout of the stack, etc.
///
-class JavaThread : public ZZZ {
+class JavaThread : public mvm::VMThreadData {
public:
/// jniEnv - The JNI environment of the thread.
@@ -91,9 +79,6 @@
///
JavaObject* javaThread;
- /// mut - The associated mutator. Should be removed
- mvm::Thread* mut;
-
/// vmThread - The VMThread object of this thread.
///
JavaObject* vmThread;
@@ -153,7 +138,7 @@
/// JavaThread - Empty constructor, used to get the VT.
///
- JavaThread() {
+ JavaThread() : mvm::VMThreadData(0) {
#ifdef SERVICE
replacedEIPs = 0;
#endif
@@ -163,13 +148,16 @@
///
~JavaThread();
-private:
- /// JavaThread - Creates a Java thread.
+ /// JavaThread - Creates a Java thread. Link the JavaThread to the mutator thread.
///
- JavaThread(JavaObject* thread, JavaObject* vmThread, Jnjvm* isolate);
+ JavaThread(mvm::Thread* mut, JavaObject* thread, JavaObject* vmThread, Jnjvm* isolate);
-public:
+ /// create - Creates a Java thread and a mutator thread.
+ ///
static mvm::Thread* create(JavaObject* thread, JavaObject* vmThread, Jnjvm* isolate);
+
+ /// j3Thread - gives the JavaThread associated with the mutator thread
+ ///
static JavaThread* j3Thread(mvm::Thread* mut);
/// get - Get the current thread as a JnJVM object.
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=120067&r1=120066&r2=120067&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/Jnjvm.h Tue Nov 23 17:12:30 2010
@@ -166,11 +166,6 @@
///
static void mainJavaStart(mvm::Thread* thread);
- /// mainCompileStart - Starts the static compilation of classes in a Java
- /// thread.
- ///
- static void mainCompilerStart(mvm::Thread* thread);
-
public:
/// tracer - Traces instances of this class.
Modified: vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp?rev=120067&r1=120066&r2=120067&view=diff
==============================================================================
--- vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp (original)
+++ vmkit/branches/multi-vm/mmtk/mmtk-j3/ActivePlan.cpp Tue Nov 23 17:12:30 2010
@@ -26,8 +26,8 @@
assert(A && "No active plan");
if (A->current == NULL) {
- A->current = (mvm::MutatorThread*)JavaThread::get()->MyVM->mainThread;
- } else if (A->current->next() == JavaThread::get()->MyVM->mainThread) {
+ A->current = (mvm::MutatorThread*)mvm::Thread::get()->MyVM->mainThread;
+ } else if (A->current->next() == mvm::Thread::get()->MyVM->mainThread) {
A->current = NULL;
return NULL;
} else {
More information about the vmkit-commits
mailing list