[vmkit-commits] [vmkit] r58919 - in /vmkit/trunk: include/mvm/Threads/Locks.h include/mvm/Threads/Thread.h lib/JnJVM/Classpath/ClasspathVMThrowable.cpp lib/JnJVM/VMCore/JavaRuntimeJIT.cpp lib/Mvm/CommonThread/ctlock.cpp lib/Mvm/CommonThread/ctthread.cpp lib/N3/VMCore/VMThread.cpp lib/N3/VMCore/VMThread.h
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Sat Nov 8 09:44:50 PST 2008
Author: geoffray
Date: Sat Nov 8 11:44:49 2008
New Revision: 58919
URL: http://llvm.org/viewvc/llvm-project?rev=58919&view=rev
Log:
Remove all uses of pthread_self and use mvm::Thread::get instead.
Modified:
vmkit/trunk/include/mvm/Threads/Locks.h
vmkit/trunk/include/mvm/Threads/Thread.h
vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp
vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp
vmkit/trunk/lib/N3/VMCore/VMThread.cpp
vmkit/trunk/lib/N3/VMCore/VMThread.h
Modified: vmkit/trunk/include/mvm/Threads/Locks.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/Locks.h?rev=58919&r1=58918&r2=58919&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/Threads/Locks.h (original)
+++ vmkit/trunk/include/mvm/Threads/Locks.h Sat Nov 8 11:44:49 2008
@@ -17,11 +17,12 @@
class Cond;
class LockNormal;
class LockRecursive;
+class Thread;
class Lock {
friend class Cond;
protected:
- int owner;
+ mvm::Thread* owner;
pthread_mutex_t internalLock;
public:
@@ -33,7 +34,7 @@
virtual void unlock() = 0;
bool selfOwner();
- int getOwner();
+ mvm::Thread* getOwner();
};
Modified: vmkit/trunk/include/mvm/Threads/Thread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/include/mvm/Threads/Thread.h?rev=58919&r1=58918&r2=58919&view=diff
==============================================================================
--- vmkit/trunk/include/mvm/Threads/Thread.h (original)
+++ vmkit/trunk/include/mvm/Threads/Thread.h Sat Nov 8 11:44:49 2008
@@ -69,11 +69,6 @@
///
static void yield(unsigned int* n);
- /// self - The thread id of the current thread, which is specific to the
- /// underlying implementation.
- ///
- static int self(void);
-
/// kill - Kill the thread with the given pid by sending it a signal.
///
static int kill(int tid, int signo);
Modified: vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp?rev=58919&r1=58918&r2=58919&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Classpath/ClasspathVMThrowable.cpp Sat Nov 8 11:44:49 2008
@@ -71,7 +71,8 @@
JavaObject* res = newS->doNew(vm);
vm->upcalls->initStackTraceElement->invokeIntSpecial(vm, newS, res,
sourceName,
- (uint32)ip, className,
+ 0, // source line
+ className,
methodName, native);
return res;
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=58919&r1=58918&r2=58919&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Sat Nov 8 11:44:49 2008
@@ -253,17 +253,17 @@
extern "C" void printMethodStart(JavaMethod* meth) {
- printf("[%d] executing %s\n", mvm::Thread::self(), meth->printString());
+ printf("[%d] executing %s\n", mvm::Thread::get(), meth->printString());
fflush(stdout);
}
extern "C" void printMethodEnd(JavaMethod* meth) {
- printf("[%d] return from %s\n", mvm::Thread::self(), meth->printString());
+ printf("[%d] return from %s\n", mvm::Thread::get(), meth->printString());
fflush(stdout);
}
extern "C" void printExecution(char* opcode, uint32 index, JavaMethod* meth) {
- printf("[%d] executing %s %s at %d\n", mvm::Thread::self(), meth->printString(),
+ printf("[%d] executing %s %s at %d\n", mvm::Thread::get(), meth->printString(),
opcode, index);
fflush(stdout);
}
Modified: vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp?rev=58919&r1=58918&r2=58919&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp (original)
+++ vmkit/trunk/lib/Mvm/CommonThread/ctlock.cpp Sat Nov 8 11:44:49 2008
@@ -51,16 +51,16 @@
}
bool Lock::selfOwner() {
- return owner == Thread::self();
+ return owner == mvm::Thread::get();
}
-int Lock::getOwner() {
+mvm::Thread* Lock::getOwner() {
return owner;
}
void LockNormal::lock() {
pthread_mutex_lock((pthread_mutex_t*)&internalLock);
- owner = (int)pthread_self();
+ owner = mvm::Thread::get();
}
void LockNormal::unlock() {
@@ -70,7 +70,7 @@
void LockRecursive::lock() {
pthread_mutex_lock((pthread_mutex_t*)&internalLock);
- if (!owner) owner = (int)pthread_self();
+ if (!owner) owner = mvm::Thread::get();
++n;
}
Modified: vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp?rev=58919&r1=58918&r2=58919&view=diff
==============================================================================
--- vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp (original)
+++ vmkit/trunk/lib/Mvm/CommonThread/ctthread.cpp Sat Nov 8 11:44:49 2008
@@ -31,10 +31,6 @@
}
}
-int Thread::self() {
- return (int)pthread_self();
-}
-
int Thread::kill(int tid, int signo) {
return pthread_kill((pthread_t)tid, signo);
}
@@ -135,7 +131,6 @@
/// given routine of th.
///
void Thread::internalThreadStart(mvm::Thread* th) {
- th->internalThreadID = (void*)pthread_self();
th->threadID = (int)th & mvm::Thread::IDMask;
th->baseSP = &th;
@@ -163,11 +158,10 @@
pthread_attr_t attributs;
pthread_attr_init(&attributs);
pthread_attr_setstack(&attributs, this, STACK_SIZE);
- pthread_t tid;
routine = fct;
- int res = pthread_create(&tid, &attributs,
+ int res = pthread_create((pthread_t*)(void*)(&internalThreadID), &attributs,
(void* (*)(void *))internalThreadStart, this);
- pthread_detach(*(pthread_t *)tid);
+ pthread_detach((pthread_t)internalThreadID);
pthread_attr_destroy(&attributs);
return res;
}
Modified: vmkit/trunk/lib/N3/VMCore/VMThread.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMThread.cpp?rev=58919&r1=58918&r2=58919&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMThread.cpp (original)
+++ vmkit/trunk/lib/N3/VMCore/VMThread.cpp Sat Nov 8 11:44:49 2008
@@ -51,7 +51,6 @@
key->varcond = new mvm::Cond();
key->interruptFlag = 0;
key->state = StateRunning;
- key->self = mvm::Thread::self();
key->pendingException = 0;
key->perFunctionPasses = new llvm::FunctionPassManager(vm->TheModuleProvider);
key->perFunctionPasses->add(new llvm::TargetData(vm->module));
Modified: vmkit/trunk/lib/N3/VMCore/VMThread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/N3/VMCore/VMThread.h?rev=58919&r1=58918&r2=58919&view=diff
==============================================================================
--- vmkit/trunk/lib/N3/VMCore/VMThread.h (original)
+++ vmkit/trunk/lib/N3/VMCore/VMThread.h Sat Nov 8 11:44:49 2008
@@ -36,7 +36,6 @@
mvm::Cond* varcond;
VMObject* pendingException;
void* internalPendingException;
- unsigned int self;
unsigned int interruptFlag;
unsigned int state;
More information about the vmkit-commits
mailing list