/* set the object in the internal data structure */
- mainthread->object = t;
+ mainthread->object = LLNI_DIRECT(t);
#if defined(ENABLE_INTRP)
/* create interpreter stack */
{
startupinfo *startup;
threadobject *thread;
+ java_lang_Thread *object;
#if defined(WITH_CLASSPATH_GNU)
java_lang_VMThread *vmt;
#endif
threads_set_current_threadobject(thread);
+ /* get the java.lang.Thread object for this thread */
+
+ object = (java_lang_Thread *) LLNI_WRAP(thread->object);
+
/* set our priority */
- threads_set_thread_priority(thread->tid, LLNI_field_direct(thread->object, priority));
+ threads_set_thread_priority(thread->tid, LLNI_field_direct(object, priority));
/* thread is completely initialized */
c = class_java_lang_VMThread;
#elif defined(WITH_CLASSPATH_SUN) || defined(WITH_CLASSPATH_CLDC1_1)
- c = thread->object->header.vftbl->class;
+ LLNI_class_get(object, c);
#else
# error unknown classpath configuration
#endif
#if defined(WITH_CLASSPATH_GNU)
/* we need to start the run method of java.lang.VMThread */
- vmt = (java_lang_VMThread *) LLNI_field_direct(thread->object, vmThread);
+ LLNI_field_get_ref(object, vmThread, vmt);
o = (java_handle_t *) vmt;
#elif defined(WITH_CLASSPATH_SUN) || defined(WITH_CLASSPATH_CLDC1_1)
- o = (java_handle_t *) thread->object;
+ o = (java_handle_t *) object;
#else
# error unknown classpath configuration
#endif
#if defined(ENABLE_JAVASE)
java_lang_ThreadGroup *group;
threadobject *mainthread;
+ java_lang_Thread *mainthreado;
classinfo *c;
methodinfo *m;
#endif
if (t == NULL)
return false;
- thread->object = t;
+ thread->object = LLNI_DIRECT(t);
/* thread is completely initialized */
/* get the main thread */
mainthread = threads_list_first();
- group = LLNI_field_direct(mainthread->object, group);
+ mainthreado = (java_lang_Thread *) LLNI_WRAP(mainthread->object);
+ group = LLNI_field_direct(mainthreado, group);
#endif
}
/* for convenience */
- o = (java_handle_t *) thread->object;
+ o = (java_handle_t *) t;
#if defined(WITH_CLASSPATH_GNU)
(void) vm_call_method(method_thread_init, o, vmt, s, NORM_PRIORITY,
#if defined(ENABLE_JAVASE)
/* store the thread group in the object */
- LLNI_field_direct(thread->object, group) = group;
+ LLNI_field_set_ref(t, group, group);
/* add thread to given thread-group */
#endif
#if defined(ENABLE_JAVASE)
- object = t->object;
+ object = (java_lang_Thread *) LLNI_WRAP(t->object);
- group = LLNI_field_direct(object, group);
+ LLNI_field_get_ref(object, group, group);
/* If there's an uncaught exception, call uncaughtException on the
thread's exception handler, or the thread's group if this is
file. */
# if defined(WITH_CLASSPATH_GNU)
- handler = (java_lang_Object *) LLNI_field_direct(object, exceptionHandler);
+ LLNI_field_get_ref(object, exceptionHandler, handler);
# elif defined(WITH_CLASSPATH_SUN)
- handler = (java_lang_Object *) LLNI_field_direct(object, uncaughtExceptionHandler);
+ LLNI_field_get_ref(object, uncaughtExceptionHandler, handler);
# endif
if (handler != NULL) {
/* thread is a Java thread and running */
- mainthread->flags = THREAD_FLAG_JAVA;
+ mainthread->flags |= THREAD_FLAG_JAVA;
mainthread->state = THREAD_STATE_RUNNABLE;
/* store the internal thread data-structure in the TSD */
LLNI_field_set_val(object, vm_thread, (java_lang_Object *) t);
#endif
- t->object = object;
+ t->object = LLNI_DIRECT(object);
/* set java.lang.Thread fields */
*******************************************************************************/
-void threads_thread_start(java_lang_Thread *object)
+void threads_thread_start(java_handle_t *object)
{
- threadobject *thread;
+ java_lang_Thread *o;
+ threadobject *thread;
#if defined(WITH_CLASSPATH_GNU)
java_lang_VMThread *vmt;
#endif
+ o = (java_lang_Thread *) object;
+
/* Enter the join-mutex, so if the main-thread is currently
waiting to join all threads, the number of non-daemon threads
is correct. */
#if defined(ENABLE_JAVASE)
/* is this a daemon thread? */
- if (LLNI_field_direct(object, daemon) == true)
+ if (LLNI_field_direct(o, daemon) == true)
thread->flags |= THREAD_FLAG_DAEMON;
#endif
/* link the two objects together */
- thread->object = object;
+ thread->object = LLNI_DIRECT(object);
#if defined(WITH_CLASSPATH_GNU)
- LLNI_field_get_ref(object, vmThread, vmt);
+ LLNI_field_get_ref(o, vmThread, vmt);
assert(vmt);
assert(LLNI_field_direct(vmt, vmdata) == NULL);
LLNI_field_set_val(vmt, vmdata, (java_lang_Object *) thread);
#elif defined(WITH_CLASSPATH_CLDC1_1)
- LLNI_field_set_val(object, vm_thread, (java_lang_Object *) thread);
+ LLNI_field_set_val(o, vm_thread, (java_lang_Object *) thread);
#endif
/* Start the thread. Don't pass a function pointer (NULL) since
/* the thread may be currently in initalization, don't print it */
- object = t->object;
+ object = (java_lang_Thread *) LLNI_WRAP(t->object);
if (object != NULL) {
/* get thread name */