[vmkit-commits] [vmkit] r120023 - in /vmkit/branches/multi-vm/lib/J3/VMCore: JavaThread.cpp JavaThread.h
Gael Thomas
gael.thomas at lip6.fr
Tue Nov 23 05:46:15 PST 2010
Author: gthomas
Date: Tue Nov 23 07:46:15 2010
New Revision: 120023
URL: http://llvm.org/viewvc/llvm-project?rev=120023&view=rev
Log:
split the JavaThread and the mvm::Thread (in progress) - 4
Modified:
vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp
vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h
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=120023&r1=120022&r2=120023&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.cpp Tue Nov 23 07:46:15 2010
@@ -24,13 +24,12 @@
const unsigned int JavaThread::StateInterrupted = 2;
JavaThread::JavaThread(JavaObject* thread, JavaObject* vmth, Jnjvm* isolate)
- : MutatorThread() {
+ : ZZZ() {
llvm_gcroot(thread, 0);
llvm_gcroot(vmth, 0);
javaThread = thread;
vmThread = vmth;
- MyVM = isolate;
interruptFlag = 0;
state = StateRunning;
pendingException = 0;
@@ -53,10 +52,12 @@
}
mvm::Thread *JavaThread::create(JavaObject* thread, JavaObject* vmth, Jnjvm* isolate) {
- JavaThread *res = new JavaThread(thread, vmth, isolate);
- res->vmData = (mvm::VMThreadData*)res;
- res->mut = res;
- return res;
+ JavaThread *th = new JavaThread(thread, vmth, isolate);
+ mvm::Thread *mut = (mvm::Thread*)th;
+ mut->MyVM = isolate;
+ mut->vmData = (mvm::VMThreadData*)th;
+ th->mut = mut;
+ return mut;
}
JavaThread::~JavaThread() {
@@ -68,25 +69,24 @@
void JavaThread::throwException(JavaObject* obj) {
llvm_gcroot(obj, 0);
- JavaThread* th = JavaThread::get();
- assert(th->pendingException == 0 && "pending exception already there?");
- th->pendingException = obj;
- th->internalThrowException();
+ assert(JavaThread::get()->pendingException == 0 && "pending exception already there?");
+ mvm::Thread* mut = mvm::Thread::get();
+ j3Thread(mut)->pendingException = obj;
+ mut->internalThrowException();
}
void JavaThread::throwPendingException() {
- JavaThread* th = JavaThread::get();
- assert(th->pendingException);
- th->internalThrowException();
+ assert(JavaThread::get()->pendingException);
+ mvm::Thread::get()->internalThrowException();
}
void JavaThread::startJNI(int level) {
// Start uncooperative mode.
- enterUncooperativeCode(level);
+ mut->enterUncooperativeCode(level);
}
uint32 JavaThread::getJavaFrameContext(void** buffer) {
- mvm::StackWalker Walker(this);
+ mvm::StackWalker Walker(mut);
uint32 i = 0;
while (mvm::MethodInfo* MI = Walker.get()) {
@@ -100,7 +100,7 @@
}
JavaMethod* JavaThread::getCallingMethodLevel(uint32 level) {
- mvm::StackWalker Walker(this);
+ mvm::StackWalker Walker(mut);
uint32 index = 0;
while (mvm::MethodInfo* MI = Walker.get()) {
@@ -126,7 +126,7 @@
JavaObject* obj = 0;
llvm_gcroot(obj, 0);
- mvm::StackWalker Walker(this);
+ mvm::StackWalker Walker(mut);
while (mvm::MethodInfo* MI = Walker.get()) {
if (MI->MethodType == 1) {
@@ -142,7 +142,7 @@
void JavaThread::printJavaBacktrace() {
- mvm::StackWalker Walker(this);
+ mvm::StackWalker Walker(mut);
while (mvm::MethodInfo* MI = Walker.get()) {
if (MI->MethodType == 1)
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=120023&r1=120022&r2=120023&view=diff
==============================================================================
--- vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h (original)
+++ vmkit/branches/multi-vm/lib/J3/VMCore/JavaThread.h Tue Nov 23 07:46:15 2010
@@ -61,11 +61,22 @@
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 : private mvm::MutatorThread {
+class JavaThread : public ZZZ {
public:
/// jniEnv - The JNI environment of the thread.
@@ -196,8 +207,8 @@
/// throwFromJNI - Throw an exception after executing JNI code.
///
void throwFromJNI(void* SP) {
- endKnownFrame();
- enterUncooperativeCode(SP);
+ mut->endKnownFrame();
+ mut->enterUncooperativeCode(SP);
}
/// throwFromNative - Throw an exception after executing Native code.
@@ -228,9 +239,8 @@
localJNIRefs->removeJNIReferences(this, *currentAddedReferences);
// Go back to cooperative mode.
- leaveUncooperativeCode();
-
- endKnownFrame();
+ mut->leaveUncooperativeCode();
+ mut->endKnownFrame();
}
/// getCallingMethod - Get the Java method in the stack at the specified
More information about the vmkit-commits
mailing list