[vmkit-commits] [vmkit] r198110 - remove the useless vmkit::BumpAllocator from vmkit::Thread
Gael Thomas
gael.thomas at lip6.fr
Sat Dec 28 02:28:11 PST 2013
Author: gthomas
Date: Sat Dec 28 04:28:11 2013
New Revision: 198110
URL: http://llvm.org/viewvc/llvm-project?rev=198110&view=rev
Log:
remove the useless vmkit::BumpAllocator from vmkit::Thread
Modified:
vmkit/branches/mcjit/include/j3/j3thread.h
vmkit/branches/mcjit/include/vmkit/thread.h
vmkit/branches/mcjit/lib/j3/vm/j3.cc
vmkit/branches/mcjit/lib/j3/vm/j3thread.cc
vmkit/branches/mcjit/lib/vmkit/thread.cc
Modified: vmkit/branches/mcjit/include/j3/j3thread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3thread.h?rev=198110&r1=198109&r2=198110&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3thread.h (original)
+++ vmkit/branches/mcjit/include/j3/j3thread.h Sat Dec 28 04:28:11 2013
@@ -29,7 +29,8 @@ namespace j3 {
static void doRun();
public:
- J3Thread(J3* vm, vmkit::BumpAllocator* allocator);
+ J3Thread(J3* vm);
+ ~J3Thread();
void assocJavaThread(J3ObjectHandle* javaThread);
J3ObjectHandle* javaThread() { return _javaThread; }
@@ -60,7 +61,7 @@ namespace j3 {
class J3ThreadBootstrap : public J3Thread {
public:
- J3ThreadBootstrap(J3* j3, vmkit::BumpAllocator* allocator);
+ J3ThreadBootstrap(J3* j3);
void run();
};
Modified: vmkit/branches/mcjit/include/vmkit/thread.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/vmkit/thread.h?rev=198110&r1=198109&r2=198110&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/vmkit/thread.h (original)
+++ vmkit/branches/mcjit/include/vmkit/thread.h Sat Dec 28 04:28:11 2013
@@ -19,7 +19,7 @@ namespace vmkit {
Thread(VMKit* vm);
virtual ~Thread() {}
- void* operator new(size_t n, BumpAllocator* allocator);
+ void* operator new(size_t n);
void operator delete(void* p);
virtual void run() {}
Modified: vmkit/branches/mcjit/lib/j3/vm/j3.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3.cc?rev=198110&r1=198109&r2=198110&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3.cc Sat Dec 28 04:28:11 2013
@@ -66,9 +66,7 @@ void J3::start(int argc, char** argv) {
vmkit::ThreadAllocator::initialize(sizeof(J3Thread), options()->stackSize);
- vmkit::BumpAllocator* threadAllocator = vmkit::BumpAllocator::create();
- J3Thread* thread = new(threadAllocator) J3ThreadBootstrap(this, threadAllocator);
-
+ J3Thread* thread = new J3ThreadBootstrap(this);
vmkitBootstrap(thread, options()->selfBitCodePath);
}
Modified: vmkit/branches/mcjit/lib/j3/vm/j3thread.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3thread.cc?rev=198110&r1=198109&r2=198110&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3thread.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3thread.cc Sat Dec 28 04:28:11 2013
@@ -8,13 +8,17 @@
using namespace j3;
-J3Thread::J3Thread(J3* vm, vmkit::BumpAllocator* allocator) :
+J3Thread::J3Thread(J3* vm) :
Thread(vm),
- _allocator(allocator),
+ _allocator(vmkit::BumpAllocator::create()),
_localReferences(_allocator) {
_jniEnv.functions = &jniEnvTable;
}
+J3Thread::~J3Thread() {
+ vmkit::BumpAllocator::destroy(_allocator);
+}
+
void J3Thread::doRun() {
J3ObjectHandle* handle = get()->javaThread();
get()->vm()->threadRun->invokeVirtual(handle);
@@ -27,7 +31,7 @@ void J3Thread::run() {
void J3Thread::start(J3ObjectHandle* handle) {
vmkit::BumpAllocator* allocator = vmkit::BumpAllocator::create();
- J3Thread* thread = new(allocator) J3Thread(get()->vm(), allocator);
+ J3Thread* thread = new J3Thread(get()->vm());
thread->assocJavaThread(handle);
thread->Thread::start();
while(1);
@@ -87,7 +91,7 @@ J3Thread* J3Thread::get() {
return (J3Thread*)Thread::get();
}
-J3ThreadBootstrap::J3ThreadBootstrap(J3* vm, vmkit::BumpAllocator* allocator) : J3Thread(vm, allocator) {
+J3ThreadBootstrap::J3ThreadBootstrap(J3* vm) : J3Thread(vm) {
}
void J3ThreadBootstrap::run() {
Modified: vmkit/branches/mcjit/lib/vmkit/thread.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/vmkit/thread.cc?rev=198110&r1=198109&r2=198110&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/vmkit/thread.cc (original)
+++ vmkit/branches/mcjit/lib/vmkit/thread.cc Sat Dec 28 04:28:11 2013
@@ -10,12 +10,12 @@ Thread::Thread(VMKit* vm) {
_vm = vm;
}
-void* Thread::operator new(size_t n, BumpAllocator* allocator) {
+void* Thread::operator new(size_t n) {
return ThreadAllocator::allocator()->allocate();
}
void Thread::operator delete(void* p) {
- VMKit::internalError(L"not yet implemented");
+ ThreadAllocator::allocator()->release(p);
}
void* Thread::doRun(void* _thread) {
More information about the vmkit-commits
mailing list