From: Stefan Ring Date: Mon, 18 Apr 2011 19:57:47 +0000 (+0200) Subject: * src/threads/thread.hpp (thread_set_object, thread_get_object): Removed. X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=cacao.git;a=commitdiff_plain;h=a99db5e76512c854ef3800d53797ee54f3cd900f * src/threads/thread.hpp (thread_set_object, thread_get_object): Removed. * src/native/vm/openjdk/jvm.cpp: Adapted (hand-inlined). * src/threads/posix/thread-posix.cpp, src/threads/thread-openjdk.cpp, src/threads/thread.cpp, src/vm/exceptions.cpp, src/vm/javaobjects.hpp: Likewise. --- diff --git a/src/native/vm/openjdk/jvm.cpp b/src/native/vm/openjdk/jvm.cpp index 6a98636ff..0d365146f 100644 --- a/src/native/vm/openjdk/jvm.cpp +++ b/src/native/vm/openjdk/jvm.cpp @@ -1,6 +1,6 @@ /* src/native/vm/openjdk/jvm.cpp - HotSpot VM interface functions - Copyright (C) 2007, 2008, 2009 + Copyright (C) 1996-2011 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO Copyright (C) 2009 Theobroma Systems Ltd. @@ -3250,7 +3250,7 @@ jobjectArray JVM_GetAllThreads(JNIEnv *env, jclass dummy) for (List::iterator it = active_threads.begin(); it != active_threads.end(); it++) { threadobject* t = *it; - java_handle_t* h = thread_get_object(t); + java_handle_t* h = LLNI_WRAP(t->object); assert(h != NULL); oa.set_element(index, h); diff --git a/src/threads/posix/thread-posix.cpp b/src/threads/posix/thread-posix.cpp index 058a3bda9..9b238ce41 100644 --- a/src/threads/posix/thread-posix.cpp +++ b/src/threads/posix/thread-posix.cpp @@ -741,7 +741,7 @@ static void *threads_startup_thread(void *arg) #endif // Get the java.lang.Thread object for this thread. - java_handle_t* object = thread_get_object(t); + java_handle_t* object = LLNI_WRAP(t->object); java_lang_Thread jlt(object); /* set our priority */ @@ -926,7 +926,7 @@ bool thread_detach_current_thread(void) DEBUGTHREADS("detaching", t); - java_handle_t* object = thread_get_object(t); + java_handle_t* object = LLNI_WRAP(t->object); java_lang_Thread jlt(object); #if defined(ENABLE_JAVASE) diff --git a/src/threads/thread-openjdk.cpp b/src/threads/thread-openjdk.cpp index ff46e9d6f..fecda2fc2 100644 --- a/src/threads/thread-openjdk.cpp +++ b/src/threads/thread-openjdk.cpp @@ -87,7 +87,7 @@ void ThreadRuntimeOpenjdk::print_thread_name(const java_lang_Thread& jlt, FILE * void ThreadRuntimeOpenjdk::set_javathread_state(threadobject *t, int state) { // Set the state of the java.lang.Thread object. - java_lang_Thread thread(thread_get_object(t)); + java_lang_Thread thread(LLNI_WRAP(t->object)); assert(thread.is_non_null()); thread.set_threadStatus(state); } diff --git a/src/threads/thread.cpp b/src/threads/thread.cpp index 4520da859..98945a5db 100644 --- a/src/threads/thread.cpp +++ b/src/threads/thread.cpp @@ -213,7 +213,7 @@ static bool thread_create_object(threadobject *t, java_handle_t *name, java_hand // Set the Java object in the thread data-structure. This // indicates that the thread is attached to the VM. - thread_set_object(t, jlt.get_handle()); + t->object = LLNI_DIRECT(jlt.get_handle()); return ThreadRuntime::invoke_thread_initializer(jlt, t, thread_method_init, name, group); } @@ -371,7 +371,7 @@ void thread_free(threadobject *t) { /* Set the reference to the Java object to NULL. */ - thread_set_object(t, NULL); + t->object = 0; ThreadList::deactivate_thread(t); } @@ -424,7 +424,7 @@ bool threads_thread_start_internal(utf *name, functionptr f) return false; } - Finalizer::attach_custom_finalizer(thread_get_object(t), thread_cleanup_finalizer, t); + Finalizer::attach_custom_finalizer(LLNI_WRAP(t->object), thread_cleanup_finalizer, t); /* Start the thread. */ @@ -469,7 +469,7 @@ void threads_thread_start(java_handle_t *object) /* Link the two objects together. */ - thread_set_object(t, object); + t->object = LLNI_DIRECT(object); /* Add the thread to the thread list. */ @@ -479,7 +479,7 @@ void threads_thread_start(java_handle_t *object) ThreadRuntime::setup_thread_vmdata(jlt, t); - Finalizer::attach_custom_finalizer(thread_get_object(t), thread_cleanup_finalizer, t); + Finalizer::attach_custom_finalizer(LLNI_WRAP(t->object), thread_cleanup_finalizer, t); /* Start the thread. Don't pass a function pointer (NULL) since we want Thread.run()V here. */ @@ -675,10 +675,10 @@ bool thread_detach_current_external_thread(void) void thread_fprint_name(threadobject *t, FILE *stream) { - if (thread_get_object(t) == NULL) + if (LLNI_WRAP(t->object) == NULL) vm_abort(""); - java_lang_Thread jlt(thread_get_object(t)); + java_lang_Thread jlt(LLNI_WRAP(t->object)); ThreadRuntime::print_thread_name(jlt, stream); } @@ -695,7 +695,7 @@ void thread_fprint_name(threadobject *t, FILE *stream) void thread_print_info(threadobject *t) { - java_lang_Thread jlt(thread_get_object(t)); + java_lang_Thread jlt(LLNI_WRAP(t->object)); /* Print as much as we can when we are in state NEW. */ diff --git a/src/threads/thread.hpp b/src/threads/thread.hpp index 7124b4cf8..0804b81f7 100644 --- a/src/threads/thread.hpp +++ b/src/threads/thread.hpp @@ -100,40 +100,6 @@ extern "C" { /* inline functions ***********************************************************/ -/* thread_get_object *********************************************************** - - Return the Java for the given thread. - - ARGUMENTS: - t ... thread - - RETURN: - the Java object - -*******************************************************************************/ - -inline static java_handle_t *thread_get_object(threadobject *t) -{ - return LLNI_WRAP(t->object); -} - - -/* threads_thread_set_object *************************************************** - - Set the Java object for the given thread. - - ARGUMENTS: - t ... thread - o ... Java object - -*******************************************************************************/ - -inline static void thread_set_object(threadobject *t, java_handle_t *o) -{ - t->object = LLNI_DIRECT(o); -} - - /* thread_get_current_object ************************************************** Return the Java object of the current thread. @@ -149,7 +115,7 @@ inline static java_handle_t *thread_get_current_object(void) java_handle_t *o; t = THREADOBJECT; - o = thread_get_object(t); + o = LLNI_WRAP(t->object); return o; } @@ -190,7 +156,7 @@ inline static bool thread_is_attached(threadobject *t) { java_handle_t *o; - o = thread_get_object(t); + o = LLNI_WRAP(t->object); return o != NULL; } diff --git a/src/vm/exceptions.cpp b/src/vm/exceptions.cpp index 69a748feb..707efa4c3 100644 --- a/src/vm/exceptions.cpp +++ b/src/vm/exceptions.cpp @@ -1,6 +1,6 @@ /* src/vm/exceptions.cpp - exception related functions - Copyright (C) 1996-2005, 2006, 2007, 2008 + Copyright (C) 1996-2011 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -2021,7 +2021,7 @@ void exceptions_print_stacktrace(void) need it afterwards. */ t = thread_get_current(); - to = (java_lang_Thread *) thread_get_object(t); + to = (java_lang_Thread *) LLNI_WRAP(t->object); if (to != NULL) { fprintf(stderr, "in thread \""); diff --git a/src/vm/javaobjects.hpp b/src/vm/javaobjects.hpp index 0aaa29504..29329f380 100644 --- a/src/vm/javaobjects.hpp +++ b/src/vm/javaobjects.hpp @@ -1,6 +1,6 @@ /* src/vm/javaobjects.hpp - functions to create and access Java objects - Copyright (C) 2010, 2011 + Copyright (C) 1996-2011 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO Copyright (C) 2008, 2009 Theobroma Systems Ltd. @@ -2765,12 +2765,6 @@ public: }; -// inline java_lang_Thread::java_lang_Thread(threadobject* t) : java_lang_Object(h) -// { -// java_lang_Thread(thread_get_object(t)); -// } - - inline int32_t java_lang_Thread::get_priority() const { return get(_handle, offset_priority);