* src/vm/class.c [ENABLE_JAVASE] (arrayclass_java_lang_Object): Added
authortwisti <none@none>
Wed, 27 Dec 2006 23:15:56 +0000 (23:15 +0000)
committertwisti <none@none>
Wed, 27 Dec 2006 23:15:56 +0000 (23:15 +0000)
#ifdef.
* src/vm/class.h: Likewise.

* src/vm/loader.c: Java ME changes.

* src/vm/finalizer.c (finalizer_start_thread): Set flags.
* src/vm/jit/optimizing/recompile.c (recompile_start_thread):
Likewise.

* src/vm/jit/stacktrace.c [ENABLE_JAVASE] (stacktrace_getStack): Added
#ifdef.

* src/vm/jit/codegen-common.c (codegen_start_native_call)
[ENABLE_JAVASE]: #ifdef'ed the local references table stuff (maybe we
need to change that for cacao-gc).
(codegen_finish_native_call): Likewise.

* src/vm/exceptions.c (exceptions_asm_new_abstractmethoderror)
[!ENABLE_JAVASE]: In the meantime we throw a VirtualMachineError.
* src/vm/exceptions.h: Likewise.

* src/vm/linker.c: Java ME changes.

* src/native/native.c: Likewise.
* src/native/native.h: Likewise.

* src/threads/native/threads.h (THREAD_FLAG_DAEMON): Added.
(threadobject): Changed flags to u4.
* src/threads/native/threads.c: A lot of Java ME changes.

14 files changed:
src/native/native.c
src/native/native.h
src/threads/native/threads.c
src/threads/native/threads.h
src/vm/class.c
src/vm/class.h
src/vm/exceptions.c
src/vm/exceptions.h
src/vm/finalizer.c
src/vm/jit/codegen-common.c
src/vm/jit/optimizing/recompile.c
src/vm/jit/stacktrace.c
src/vm/linker.c
src/vm/loader.c

index 3ff96f2d842cc26eb2e1095f5b6ff96d3c4ea640..a0eca3e788c6590f2d3a94ffc700f28a84572520 100644 (file)
@@ -29,7 +29,7 @@
             Andreas Krall
             Christian Thalinger
 
             Andreas Krall
             Christian Thalinger
 
-   $Id: native.c 6213 2006-12-18 17:36:06Z twisti $
+   $Id: native.c 6251 2006-12-27 23:15:56Z twisti $
 
 */
 
 
 */
 
 
 /* include table of native functions ******************************************/
 
 
 /* include table of native functions ******************************************/
 
-#include "native/include/java_lang_Cloneable.h"
-#include "native/include/java_util_Properties.h"
+#if defined(ENABLE_JAVASE)
+
 #include "native/include/java_io_InputStream.h"
 #include "native/include/java_io_PrintStream.h"
 
 #include "native/include/java_io_InputStream.h"
 #include "native/include/java_io_PrintStream.h"
 
+#include "native/include/java_lang_Cloneable.h"
+#include "native/include/java_util_Properties.h"
+
+#include "native/include/java_lang_Object.h"
+
 #include "native/include/gnu_classpath_VMStackWalker.h"
 #include "native/include/gnu_classpath_VMSystemProperties.h"
 #include "native/include/gnu_java_lang_management_VMClassLoadingMXBeanImpl.h"
 #include "native/include/gnu_java_lang_management_VMMemoryMXBeanImpl.h"
 #include "native/include/gnu_java_lang_management_VMRuntimeMXBeanImpl.h"
 #include "native/include/gnu_classpath_VMStackWalker.h"
 #include "native/include/gnu_classpath_VMSystemProperties.h"
 #include "native/include/gnu_java_lang_management_VMClassLoadingMXBeanImpl.h"
 #include "native/include/gnu_java_lang_management_VMMemoryMXBeanImpl.h"
 #include "native/include/gnu_java_lang_management_VMRuntimeMXBeanImpl.h"
-#include "native/include/java_lang_Class.h"
-#include "native/include/java_lang_Object.h"
 #include "native/include/java_lang_VMClass.h"
 #include "native/include/java_lang_VMClassLoader.h"
 #include "native/include/java_lang_VMObject.h"
 #include "native/include/java_lang_VMClass.h"
 #include "native/include/java_lang_VMClassLoader.h"
 #include "native/include/java_lang_VMObject.h"
 #include "native/include/gnu_classpath_jdwp_VMMethod.h"
 #endif
 
 #include "native/include/gnu_classpath_jdwp_VMMethod.h"
 #endif
 
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+
+#include "native/include/com_sun_cldchi_io_ConsoleOutputStream.h"
+#include "native/include/java_lang_Class.h"
+#include "native/include/java_lang_Double.h"
+#include "native/include/java_lang_Float.h"
+#include "native/include/java_lang_Math.h"
+#include "native/include/java_lang_Runtime.h"
+#include "native/include/java_lang_System.h"
+#include "native/include/java_lang_Thread.h"
+
+#endif
+
 #if defined(WITH_STATIC_CLASSPATH)
 
 /* these are required to prevent compiler warnings */
 #if defined(WITH_STATIC_CLASSPATH)
 
 /* these are required to prevent compiler warnings */
 *******************************************************************************/
 
 functionptr dummynativetable[] = {
 *******************************************************************************/
 
 functionptr dummynativetable[] = {
+#if defined(ENABLE_JAVASE)
        (functionptr) Java_gnu_classpath_VMStackWalker_getClassContext,
        (functionptr) Java_gnu_classpath_VMStackWalker_getCallingClass,
        (functionptr) Java_gnu_classpath_VMStackWalker_getCallingClassLoader,
        (functionptr) Java_gnu_classpath_VMStackWalker_getClassContext,
        (functionptr) Java_gnu_classpath_VMStackWalker_getCallingClass,
        (functionptr) Java_gnu_classpath_VMStackWalker_getCallingClassLoader,
@@ -301,6 +318,36 @@ functionptr dummynativetable[] = {
        (functionptr) Java_gnu_classpath_jdwp_VMMethod_getVariableTable
 #endif
 
        (functionptr) Java_gnu_classpath_jdwp_VMMethod_getVariableTable
 #endif
 
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+       (functionptr) Java_com_sun_cldchi_io_ConsoleOutputStream_write,
+
+       (functionptr) Java_java_lang_Class_forName,
+       (functionptr) Java_java_lang_Class_newInstance,
+       (functionptr) Java_java_lang_Class_getName,
+
+       (functionptr) Java_java_lang_Double_doubleToLongBits,
+
+       (functionptr) Java_java_lang_Float_floatToIntBits,
+
+       (functionptr) Java_java_lang_Math_ceil,
+       (functionptr) Java_java_lang_Math_cos,
+       (functionptr) Java_java_lang_Math_floor,
+       (functionptr) Java_java_lang_Math_sin,
+       (functionptr) Java_java_lang_Math_sqrt,
+       (functionptr) Java_java_lang_Math_tan,
+
+       (functionptr) Java_java_lang_Runtime_exitInternal,
+
+       (functionptr) Java_java_lang_System_getProperty0,
+
+       (functionptr) Java_java_lang_Thread_currentThread,
+       (functionptr) Java_java_lang_Thread_setPriority0,
+       (functionptr) Java_java_lang_Thread_start0,
+       (functionptr) Java_java_lang_Thread_yield,
+
+       (functionptr) Java_java_lang_Throwable_printStackTrace,
+       (functionptr) Java_java_lang_Throwable_fillInStackTrace
+#endif
 };
 
 #endif /* defined(ENABLE_LIBJVM) */
 };
 
 #endif /* defined(ENABLE_LIBJVM) */
@@ -552,7 +599,6 @@ functionptr native_findfunction(utf *cname, utf *mname, utf *desc,
                        return n->func;
        }
 
                        return n->func;
        }
 
-               
        /* no function was found, throw exception */
 
        *exceptionptr =
        /* no function was found, throw exception */
 
        *exceptionptr =
@@ -876,9 +922,17 @@ functionptr native_resolve_function(methodinfo *m)
                if (opt_verbosejni)
                        printf("failed ]\n");
 
                if (opt_verbosejni)
                        printf("failed ]\n");
 
+#if defined(ENABLE_JAVASE)
                *exceptionptr =
                        new_exception_utfmessage(string_java_lang_UnsatisfiedLinkError,
                                                                         m->name);
                *exceptionptr =
                        new_exception_utfmessage(string_java_lang_UnsatisfiedLinkError,
                                                                         m->name);
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+               *exceptionptr =
+                       new_exception_utfmessage(string_java_lang_VirtualMachineError,
+                                                                        m->name);
+#else
+#error IMPLEMENT ME!
+#endif
        }
 
        /* release memory */
        }
 
        /* release memory */
@@ -1037,6 +1091,7 @@ java_objectheader *native_new_and_init_throwable(classinfo *c, java_lang_Throwab
 
 *******************************************************************************/
 
 
 *******************************************************************************/
 
+#if defined(ENABLE_JAVASE)
 java_objectarray *native_class_getdeclaredannotations(classinfo *c)
 {
        java_objectarray *oa;
 java_objectarray *native_class_getdeclaredannotations(classinfo *c)
 {
        java_objectarray *oa;
@@ -1066,6 +1121,7 @@ java_objectarray *native_class_getdeclaredannotations(classinfo *c)
 
        return oa;
 }
 
        return oa;
 }
+#endif
 
 
 /* native_get_parametertypes ***************************************************
 
 
 /* native_get_parametertypes ***************************************************
index 78b7d3980c3f7b1dd0a2fc71c147bedd686bfb48..c05429957fc95c1411b0f93648b49fd93a872577 100644 (file)
    Contact: cacao@cacaojvm.org
 
    Authors: Reinhard Grafl
    Contact: cacao@cacaojvm.org
 
    Authors: Reinhard Grafl
+            Christian Thalinger
 
 
-   Changes: Christian Thalinger
-
-   $Id: native.h 6213 2006-12-18 17:36:06Z twisti $
+   $Id: native.h 6251 2006-12-27 23:15:56Z twisti $
 
 */
 
 
 */
 
 # include <ltdl.h>
 #endif
 
 # include <ltdl.h>
 #endif
 
+#include "native/jni.h"
+#include "native/include/java_lang_String.h"
+#include "native/include/java_lang_Throwable.h"
 #include "vm/class.h"
 #include "vm/global.h"
 #include "vm/method.h"
 #include "vm/utf8.h"
 #include "vm/class.h"
 #include "vm/global.h"
 #include "vm/method.h"
 #include "vm/utf8.h"
-#include "native/jni.h"
-#include "native/include/java_lang_String.h"
-#include "native/include/java_lang_ClassLoader.h"
-#include "native/include/java_lang_Throwable.h"
 
 
 /* table for locating native methods */
 
 
 /* table for locating native methods */
index daa171bf8be8f1996597765c516fdefd9b3696e2..47053cfeebb42918c9b99c4edeb1a57283db1ce8 100644 (file)
@@ -28,7 +28,7 @@
             Christian Thalinger
             Edwin Steiner
 
             Christian Thalinger
             Edwin Steiner
 
-   $Id: threads.c 6228 2006-12-26 19:56:58Z twisti $
+   $Id: threads.c 6251 2006-12-27 23:15:56Z twisti $
 
 */
 
 
 */
 
 #include "native/include/java_lang_Object.h"
 #include "native/include/java_lang_Throwable.h"
 #include "native/include/java_lang_Thread.h"
 #include "native/include/java_lang_Object.h"
 #include "native/include/java_lang_Throwable.h"
 #include "native/include/java_lang_Thread.h"
-#include "native/include/java_lang_ThreadGroup.h"
-#include "native/include/java_lang_VMThread.h"
+
+#if defined(ENABLE_JAVASE)
+# include "native/include/java_lang_ThreadGroup.h"
+#endif
+
+#if defined(WITH_CLASSPATH_GNU)
+# include "native/include/java_lang_VMThread.h"
+#endif
+
 #include "threads/native/threads.h"
 #include "toolbox/avl.h"
 #include "toolbox/logging.h"
 #include "threads/native/threads.h"
 #include "toolbox/avl.h"
 #include "toolbox/logging.h"
@@ -695,12 +702,18 @@ void threads_preinit(void)
 bool threads_init(void)
 {
        java_lang_String      *threadname;
 bool threads_init(void)
 {
        java_lang_String      *threadname;
-       java_lang_VMThread    *vmt;
-       java_lang_ThreadGroup *threadgroup;
        threadobject          *tempthread;
        threadobject          *tempthread;
-       methodinfo            *m;
        java_objectheader     *o;
        java_objectheader     *o;
+
+#if defined(ENABLE_JAVSE)
+       java_lang_ThreadGroup *threadgroup;
+       methodinfo            *m;
        java_lang_Thread      *t;
        java_lang_Thread      *t;
+#endif
+
+#if defined(WITH_CLASSPATH_GNU)
+       java_lang_VMThread    *vmt;
+#endif
 
        tempthread = mainthreadobj;
 
 
        tempthread = mainthreadobj;
 
@@ -716,12 +729,21 @@ bool threads_init(void)
 
        /* get methods we need in this file */
 
 
        /* get methods we need in this file */
 
+#if defined(WITH_CLASSPATH_GNU)
        method_thread_init =
                class_resolveclassmethod(class_java_lang_Thread,
                                                                 utf_init,
                                                                 utf_new_char("(Ljava/lang/VMThread;Ljava/lang/String;IZ)V"),
                                                                 class_java_lang_Thread,
                                                                 true);
        method_thread_init =
                class_resolveclassmethod(class_java_lang_Thread,
                                                                 utf_init,
                                                                 utf_new_char("(Ljava/lang/VMThread;Ljava/lang/String;IZ)V"),
                                                                 class_java_lang_Thread,
                                                                 true);
+#else
+       method_thread_init =
+               class_resolveclassmethod(class_java_lang_Thread,
+                                                                utf_init,
+                                                                utf_new_char("(Ljava/lang/String;)V"),
+                                                                class_java_lang_Thread,
+                                                                true);
+#endif
 
        if (method_thread_init == NULL)
                return false;
 
        if (method_thread_init == NULL)
                return false;
@@ -761,6 +783,7 @@ bool threads_init(void)
 
        threadname = javastring_new(utf_new_char("main"));
 
 
        threadname = javastring_new(utf_new_char("main"));
 
+#if defined(ENABLE_JAVSE)
        /* allocate and init ThreadGroup */
 
        threadgroup = (java_lang_ThreadGroup *)
        /* allocate and init ThreadGroup */
 
        threadgroup = (java_lang_ThreadGroup *)
@@ -768,6 +791,7 @@ bool threads_init(void)
 
        if (threadgroup == NULL)
                throw_exception_exit();
 
        if (threadgroup == NULL)
                throw_exception_exit();
+#endif
 
 #if defined(WITH_CLASSPATH_GNU)
        /* create a java.lang.VMThread for the main thread */
 
 #if defined(WITH_CLASSPATH_GNU)
        /* create a java.lang.VMThread for the main thread */
@@ -787,13 +811,18 @@ bool threads_init(void)
 
        (void) vm_call_method(method_thread_init, o, vmt, threadname, NORM_PRIORITY,
                                                  false);
 
        (void) vm_call_method(method_thread_init, o, vmt, threadname, NORM_PRIORITY,
                                                  false);
-#else
-#error IMPLEMENT ME!
+#elif defined(WITH_CLASSPATH_CLDC1_1)
+       /* call public Thread(String name) */
+
+       o = (java_objectheader *) mainthreadobj;
+
+       (void) vm_call_method(method_thread_init, o, threadname);
 #endif
 
        if (*exceptionptr)
                return false;
 
 #endif
 
        if (*exceptionptr)
                return false;
 
+#if defined(ENABLE_JAVASE)
        mainthreadobj->o.group = threadgroup;
 
        /* add main thread to java.lang.ThreadGroup */
        mainthreadobj->o.group = threadgroup;
 
        /* add main thread to java.lang.ThreadGroup */
@@ -812,6 +841,8 @@ bool threads_init(void)
        if (*exceptionptr)
                return false;
 
        if (*exceptionptr)
                return false;
 
+#endif
+
        threads_set_thread_priority(pthread_self(), NORM_PRIORITY);
 
        /* initialize the thread attribute object */
        threads_set_thread_priority(pthread_self(), NORM_PRIORITY);
 
        /* initialize the thread attribute object */
@@ -1215,6 +1246,14 @@ void threads_set_thread_priority(pthread_t tid, int priority)
        struct sched_param schedp;
        int policy;
 
        struct sched_param schedp;
        int policy;
 
+#if defined(ENABLE_JAVAME_CLDC1_1)
+       /* The thread id is zero when a thread is created in Java.  The
+          priority is set later during startup. */
+
+       if (tid == NULL)
+               return;
+#endif
+
        pthread_getschedparam(tid, &policy, &schedp);
        schedp.sched_priority = priority;
        pthread_setschedparam(tid, policy, &schedp);
        pthread_getschedparam(tid, &policy, &schedp);
        schedp.sched_priority = priority;
        pthread_setschedparam(tid, policy, &schedp);
@@ -1230,14 +1269,20 @@ void threads_set_thread_priority(pthread_t tid, int priority)
 bool threads_attach_current_thread(JavaVMAttachArgs *vm_aargs, bool isdaemon)
 {
        threadobject          *thread;
 bool threads_attach_current_thread(JavaVMAttachArgs *vm_aargs, bool isdaemon)
 {
        threadobject          *thread;
-       java_lang_VMThread    *vmt;
        utf                   *u;
        java_lang_String      *s;
        utf                   *u;
        java_lang_String      *s;
-       java_lang_ThreadGroup *group;
        methodinfo            *m;
        java_objectheader     *o;
        java_lang_Thread      *t;
 
        methodinfo            *m;
        java_objectheader     *o;
        java_lang_Thread      *t;
 
+#if defined(ENABLE_JAVASE)
+       java_lang_ThreadGroup *group;
+#endif
+
+#if defined(WITH_CLASSPATH_GNU)
+       java_lang_VMThread    *vmt;
+#endif
+
        /* create a java.lang.Thread object */
 
        thread = (threadobject *) builtin_new(class_java_lang_Thread);
        /* create a java.lang.Thread object */
 
        thread = (threadobject *) builtin_new(class_java_lang_Thread);
@@ -1266,10 +1311,13 @@ bool threads_attach_current_thread(JavaVMAttachArgs *vm_aargs, bool isdaemon)
 
        pthread_mutex_unlock(&threadlistlock);
 
 
        pthread_mutex_unlock(&threadlistlock);
 
-       /* mark main thread as Java thread */
+       /* mark thread as Java thread */
 
        thread->flags = THREAD_FLAG_JAVA;
 
 
        thread->flags = THREAD_FLAG_JAVA;
 
+       if (isdaemon)
+               thread->flags |= THREAD_FLAG_DAEMON;
+
 #if defined(ENABLE_INTRP)
        /* create interpreter stack */
 
 #if defined(ENABLE_INTRP)
        /* create interpreter stack */
 
@@ -1294,11 +1342,15 @@ bool threads_attach_current_thread(JavaVMAttachArgs *vm_aargs, bool isdaemon)
 
        if (vm_aargs != NULL) {
                u     = utf_new_char(vm_aargs->name);
 
        if (vm_aargs != NULL) {
                u     = utf_new_char(vm_aargs->name);
+#if defined(ENABLE_JAVASE)
                group = (java_lang_ThreadGroup *) vm_aargs->group;
                group = (java_lang_ThreadGroup *) vm_aargs->group;
+#endif
        }
        else {
                u     = utf_null;
        }
        else {
                u     = utf_null;
+#if defined(ENABLE_JAVASE)
                group = mainthreadobj->o.group;
                group = mainthreadobj->o.group;
+#endif
        }
 
        s = javastring_new(u);
        }
 
        s = javastring_new(u);
@@ -1308,12 +1360,14 @@ bool threads_attach_current_thread(JavaVMAttachArgs *vm_aargs, bool isdaemon)
 #if defined(WITH_CLASSPATH_GNU)
        (void) vm_call_method(method_thread_init, o, vmt, s, NORM_PRIORITY,
                                                  isdaemon);
 #if defined(WITH_CLASSPATH_GNU)
        (void) vm_call_method(method_thread_init, o, vmt, s, NORM_PRIORITY,
                                                  isdaemon);
-#else
+#elif defined(WITH_CLASSPATH_CLDC1_1)
+       (void) vm_call_method(method_thread_init, o, s);
 #endif
 
        if (*exceptionptr)
                return false;
 
 #endif
 
        if (*exceptionptr)
                return false;
 
+#if defined(ENABLE_JAVASE)
        /* store the thread group in the object */
 
        thread->o.group = group;
        /* store the thread group in the object */
 
        thread->o.group = group;
@@ -1332,6 +1386,7 @@ bool threads_attach_current_thread(JavaVMAttachArgs *vm_aargs, bool isdaemon)
 
        if (*exceptionptr)
                return false;
 
        if (*exceptionptr)
                return false;
+#endif
 
        return true;
 }
 
        return true;
 }
@@ -1345,11 +1400,14 @@ bool threads_attach_current_thread(JavaVMAttachArgs *vm_aargs, bool isdaemon)
 
 bool threads_detach_thread(threadobject *thread)
 {
 
 bool threads_detach_thread(threadobject *thread)
 {
-       java_lang_ThreadGroup *group;
        methodinfo            *m;
        java_objectheader     *o;
        java_lang_Thread      *t;
 
        methodinfo            *m;
        java_objectheader     *o;
        java_lang_Thread      *t;
 
+#if defined(ENABLE_JAVASE)
+       java_lang_ThreadGroup *group;
+#endif
+
        /* Allow lock record pools to be used by other threads. They
           cannot be deleted so we'd better not waste them. */
 
        /* Allow lock record pools to be used by other threads. They
           cannot be deleted so we'd better not waste them. */
 
@@ -1359,6 +1417,7 @@ bool threads_detach_thread(threadobject *thread)
 
        /* XXX implement uncaught exception stuff (like JamVM does) */
 
 
        /* XXX implement uncaught exception stuff (like JamVM does) */
 
+#if defined(ENABLE_JAVASE)
        /* remove thread from the thread group */
 
        group = thread->o.group;
        /* remove thread from the thread group */
 
        group = thread->o.group;
@@ -1383,6 +1442,7 @@ bool threads_detach_thread(threadobject *thread)
                if (*exceptionptr)
                        return false;
        }
                if (*exceptionptr)
                        return false;
        }
+#endif
 
        /* remove thread from thread list and threads table, do this
           inside a lock */
 
        /* remove thread from thread list and threads table, do this
           inside a lock */
@@ -1423,7 +1483,7 @@ bool threads_detach_thread(threadobject *thread)
 static threadobject *threads_find_non_daemon_thread(threadobject *thread)
 {
        while (thread != mainthreadobj) {
 static threadobject *threads_find_non_daemon_thread(threadobject *thread)
 {
        while (thread != mainthreadobj) {
-               if (!thread->o.daemon)
+               if (thread->flags & THREAD_FLAG_DAEMON)
                        return thread;
 
                thread = thread->prev;
                        return thread;
 
                thread = thread->prev;
@@ -1790,13 +1850,17 @@ void threads_dump(void)
                if (t != NULL) {
                        /* get thread name */
 
                if (t != NULL) {
                        /* get thread name */
 
+#if defined(ENABLE_JAVASE)
                        name = javastring_toutf(t->name, false);
                        name = javastring_toutf(t->name, false);
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+                       name = t->name;
+#endif
 
                        printf("\n\"");
                        utf_display_printable_ascii(name);
                        printf("\" ");
 
 
                        printf("\n\"");
                        utf_display_printable_ascii(name);
                        printf("\" ");
 
-                       if (t->daemon)
+                       if (thread->flags & THREAD_FLAG_DAEMON)
                                printf("daemon ");
 
 #if SIZEOF_VOID_P == 8
                                printf("daemon ");
 
 #if SIZEOF_VOID_P == 8
index 023fc7050f156ef79f8dcd6b7c22be80f58b8b28..e1b8f038437bbf278ac3d4f057324eb13150e374 100644 (file)
@@ -28,7 +28,7 @@
             Edwin Steiner
             Christian Thalinger
 
             Edwin Steiner
             Christian Thalinger
 
-   $Id: threads.h 6228 2006-12-26 19:56:58Z twisti $
+   $Id: threads.h 6251 2006-12-27 23:15:56Z twisti $
 
 */
 
 
 */
 
@@ -137,6 +137,7 @@ struct threads_table_t {
 
 #define THREAD_FLAG_JAVA        0x01    /* a normal Java thread               */
 #define THREAD_FLAG_INTERNAL    0x02    /* CACAO internal thread              */
 
 #define THREAD_FLAG_JAVA        0x01    /* a normal Java thread               */
 #define THREAD_FLAG_INTERNAL    0x02    /* CACAO internal thread              */
+#define THREAD_FLAG_DAEMON      0x04    /* daemon thread                      */
 
 
 struct threadobject {
 
 
 struct threadobject {
@@ -150,7 +151,7 @@ struct threadobject {
        ptrint                thinlock;     /* pre-computed thin lock value       */
 
        s4                    index;        /* thread index, starting with 1      */
        ptrint                thinlock;     /* pre-computed thin lock value       */
 
        s4                    index;        /* thread index, starting with 1      */
-       u1                    flags;        /* flag field                         */
+       u4                    flags;        /* flag field                         */
 
        pthread_t             tid;          /* pthread id                         */
 
 
        pthread_t             tid;          /* pthread id                         */
 
index 5be38103d443c314bbcf863bc90b6663d2a5f858..1e50710a1c28cfc1881ada6328fa6844c1f2223b 100644 (file)
@@ -30,7 +30,7 @@
             Christian Thalinger
             Edwin Steiner
 
             Christian Thalinger
             Edwin Steiner
 
-   $Id: class.c 6244 2006-12-27 15:15:31Z twisti $
+   $Id: class.c 6251 2006-12-27 23:15:56Z twisti $
 
 */
 
 
 */
 
@@ -139,9 +139,9 @@ classinfo *class_java_lang_reflect_Field;
 classinfo *class_java_lang_reflect_Method;
 classinfo *class_java_security_PrivilegedAction;
 classinfo *class_java_util_Vector;
 classinfo *class_java_lang_reflect_Method;
 classinfo *class_java_security_PrivilegedAction;
 classinfo *class_java_util_Vector;
-#endif
 
 classinfo *arrayclass_java_lang_Object;
 
 classinfo *arrayclass_java_lang_Object;
+#endif
 
 
 /* pseudo classes for the typechecker */
 
 
 /* pseudo classes for the typechecker */
index 82a4053acf2941c7d794c52186135ef2f40b2f94..323a080e7bafe73ee42cc2b3a8b8a5f87752e86a 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Christian Thalinger
 
 
    Authors: Christian Thalinger
 
-   $Id: class.h 6244 2006-12-27 15:15:31Z twisti $
+   $Id: class.h 6251 2006-12-27 23:15:56Z twisti $
 
 */
 
 
 */
 
@@ -244,9 +244,9 @@ extern classinfo *class_java_lang_reflect_Field;
 extern classinfo *class_java_lang_reflect_Method;
 extern classinfo *class_java_security_PrivilegedAction;
 extern classinfo *class_java_util_Vector;
 extern classinfo *class_java_lang_reflect_Method;
 extern classinfo *class_java_security_PrivilegedAction;
 extern classinfo *class_java_util_Vector;
-#endif
 
 extern classinfo *arrayclass_java_lang_Object;
 
 extern classinfo *arrayclass_java_lang_Object;
+#endif
 
 
 /* pseudo classes for the type checker ****************************************/
 
 
 /* pseudo classes for the type checker ****************************************/
index 19be6b1cfeb7bd1a4e65b67b68304f502f6a8504..ae418d72077e5f1f882c1976e451e40acdfe5d62 100644 (file)
@@ -27,7 +27,7 @@
    Authors: Christian Thalinger
             Edwin Steiner
 
    Authors: Christian Thalinger
             Edwin Steiner
 
-   $Id: exceptions.c 6244 2006-12-27 15:15:31Z twisti $
+   $Id: exceptions.c 6251 2006-12-27 23:15:56Z twisti $
 
 */
 
 
 */
 
@@ -539,6 +539,20 @@ java_objectheader *exceptions_new_abstractmethoderror(void)
 #endif
 
 
 #endif
 
 
+/* exceptions_throw_abstractmethoderror ****************************************
+
+   Generates a java.lang.AbstractMethodError for the VM and throws it.
+
+*******************************************************************************/
+
+#if defined(ENABLE_JAVASE)
+void exceptions_throw_abstractmethoderror(void)
+{
+       *exceptionptr = exceptions_new_abstractmethoderror();
+}
+#endif
+
+
 /* exceptions_asm_new_abstractmethoderror **************************************
 
    Generates a java.lang.AbstractMethodError for
 /* exceptions_asm_new_abstractmethoderror **************************************
 
    Generates a java.lang.AbstractMethodError for
@@ -546,7 +560,6 @@ java_objectheader *exceptions_new_abstractmethoderror(void)
 
 *******************************************************************************/
 
 
 *******************************************************************************/
 
-#if defined(ENABLE_JAVASE)
 java_objectheader *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra)
 {
        stackframeinfo     sfi;
 java_objectheader *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra)
 {
        stackframeinfo     sfi;
@@ -558,7 +571,13 @@ java_objectheader *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra)
 
        /* create the exception */
 
 
        /* create the exception */
 
+#if defined(ENABLE_JAVASE)
        e = exceptions_new_abstractmethoderror();
        e = exceptions_new_abstractmethoderror();
+#else
+       /* in the meantime we do this */
+
+       e = exceptions_new_virtualmachineerror();
+#endif
 
        /* remove the stackframeinfo */
 
 
        /* remove the stackframeinfo */
 
@@ -566,21 +585,6 @@ java_objectheader *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra)
 
        return e;
 }
 
        return e;
 }
-#endif
-
-
-/* exceptions_throw_abstractmethoderror ****************************************
-
-   Generates a java.lang.AbstractMethodError for the VM and throws it.
-
-*******************************************************************************/
-
-#if defined(ENABLE_JAVASE)
-void exceptions_throw_abstractmethoderror(void)
-{
-       *exceptionptr = exceptions_new_abstractmethoderror();
-}
-#endif
 
 
 /* new_classformaterror ********************************************************
 
 
 /* new_classformaterror ********************************************************
index a489889c9ca75cd9c0e2cc71db7c15a1abd563ef..2996d7105a2c5e617ed73e0abd9a6857365e1800 100644 (file)
@@ -27,7 +27,7 @@
    Authors: Christian Thalinger
             Edwin Steiner
 
    Authors: Christian Thalinger
             Edwin Steiner
 
-   $Id: exceptions.h 6244 2006-12-27 15:15:31Z twisti $
+   $Id: exceptions.h 6251 2006-12-27 23:15:56Z twisti $
 
 */
 
 
 */
 
@@ -124,10 +124,11 @@ java_objectheader *new_exception_int(const char *classname, s4 i);
 
 #if defined(ENABLE_JAVASE)
 java_objectheader *exceptions_new_abstractmethoderror(void);
 
 #if defined(ENABLE_JAVASE)
 java_objectheader *exceptions_new_abstractmethoderror(void);
-java_objectheader *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra);
-void exceptions_throw_abstractmethoderror(void);
+void               exceptions_throw_abstractmethoderror(void);
 #endif
 
 #endif
 
+java_objectheader *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra);
+
 java_objectheader *new_classformaterror(classinfo *c, const char *message, ...);
 void exceptions_throw_classformaterror(classinfo *c, const char *message, ...);
 
 java_objectheader *new_classformaterror(classinfo *c, const char *message, ...);
 void exceptions_throw_classformaterror(classinfo *c, const char *message, ...);
 
index 175b05cbc8a5b0733808b05b610935fdf205b17f..7f9632bd89792b42109f0115cdd6499aee900bec 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Christian Thalinger
 
 
    Authors: Christian Thalinger
 
-   $Id: finalizer.c 6228 2006-12-26 19:56:58Z twisti $
+   $Id: finalizer.c 6251 2006-12-27 23:15:56Z twisti $
 
 */
 
 
 */
 
 #include "mm/memory.h"
 #include "native/jni.h"
 #include "native/include/java_lang_Thread.h"
 #include "mm/memory.h"
 #include "native/jni.h"
 #include "native/include/java_lang_Thread.h"
-#include "native/include/java_lang_VMThread.h"
+
+#if defined(WITH_CLASSPATH_GNU)
+# include "native/include/java_lang_VMThread.h"
+#endif
 
 #if defined(ENABLE_THREADS)
 # include "threads/native/lock.h"
 
 #if defined(ENABLE_THREADS)
 # include "threads/native/lock.h"
@@ -143,8 +146,12 @@ bool finalizer_start_thread(void)
        thread_finalizer->o.vmThread = vmt;
 #endif
 
        thread_finalizer->o.vmThread = vmt;
 #endif
 
+       thread_finalizer->flags      = THREAD_FLAG_DAEMON;
+
        thread_finalizer->o.name     = javastring_new_from_ascii("Finalizer");
        thread_finalizer->o.name     = javastring_new_from_ascii("Finalizer");
+#if defined(ENABLE_JAVASE)
        thread_finalizer->o.daemon   = true;
        thread_finalizer->o.daemon   = true;
+#endif
        thread_finalizer->o.priority = 5;
 
        /* actually start the finalizer thread */
        thread_finalizer->o.priority = 5;
 
        /* actually start the finalizer thread */
index 279cb1587c1f1991356b565140ca85783726b1a0..221ab72f0a511df6731f4bdaad357a3adc9c9cd7 100644 (file)
@@ -47,7 +47,7 @@
    memory. All functions writing values into the data area return the offset
    relative the begin of the code area (start of procedure).   
 
    memory. All functions writing values into the data area return the offset
    relative the begin of the code area (start of procedure).   
 
-   $Id: codegen-common.c 6143 2006-12-07 23:13:25Z edwin $
+   $Id: codegen-common.c 6251 2006-12-27 23:15:56Z twisti $
 
 */
 
 
 */
 
@@ -1054,6 +1054,7 @@ void codegen_start_native_call(u1 *datasp, u1 *pv, u1 *sp, u1 *ra)
 
        stacktrace_create_native_stackframeinfo(sfi, pv, sp, ra);
 
 
        stacktrace_create_native_stackframeinfo(sfi, pv, sp, ra);
 
+#if defined(ENABLE_JAVASE)
        /* add current JNI local references table to this thread */
 
        lrt->capacity    = LOCALREFTABLE_CAPACITY;
        /* add current JNI local references table to this thread */
 
        lrt->capacity    = LOCALREFTABLE_CAPACITY;
@@ -1066,6 +1067,7 @@ void codegen_start_native_call(u1 *datasp, u1 *pv, u1 *sp, u1 *ra)
        MSET(lrt->refs, 0, java_objectheader*, LOCALREFTABLE_CAPACITY);
 
        LOCALREFTABLE = lrt;
        MSET(lrt->refs, 0, java_objectheader*, LOCALREFTABLE_CAPACITY);
 
        LOCALREFTABLE = lrt;
+#endif
 }
 
 
 }
 
 
@@ -1098,6 +1100,7 @@ java_objectheader *codegen_finish_native_call(u1 *datasp)
 
        *psfi = sfi->prev;
 
 
        *psfi = sfi->prev;
 
+#if defined(ENABLE_JAVASE)
        /* release JNI local references tables for this thread */
 
        lrt = LOCALREFTABLE;
        /* release JNI local references tables for this thread */
 
        lrt = LOCALREFTABLE;
@@ -1125,6 +1128,7 @@ java_objectheader *codegen_finish_native_call(u1 *datasp)
        /* now store the previous local frames in the thread structure */
 
        LOCALREFTABLE = lrt;
        /* now store the previous local frames in the thread structure */
 
        LOCALREFTABLE = lrt;
+#endif
 
        /* get the exception and return it */
 
 
        /* get the exception and return it */
 
index 87e04ad13a231865dec06b07ac4bd895ae02e191..ad9517743b8a0bf99f53fabf260988b63d5c03b8 100644 (file)
 #include "mm/memory.h"
 #include "native/jni.h"
 #include "native/include/java_lang_Thread.h"
 #include "mm/memory.h"
 #include "native/jni.h"
 #include "native/include/java_lang_Thread.h"
-#include "native/include/java_lang_VMThread.h"
+
+#if defined(WITH_CLASSPATH_GNU)
+# include "native/include/java_lang_VMThread.h"
+#endif
 
 #if defined(ENABLE_THREADS)
 # include "threads/native/lock.h"
 
 #if defined(ENABLE_THREADS)
 # include "threads/native/lock.h"
@@ -235,8 +238,12 @@ bool recompile_start_thread(void)
        thread_recompile->o.vmThread = vmt;
 #endif
 
        thread_recompile->o.vmThread = vmt;
 #endif
 
+       thread_recompile->flags      = THREAD_FLAG_DAEMON;
+
        thread_recompile->o.name     = javastring_new_from_ascii("Recompiler");
        thread_recompile->o.name     = javastring_new_from_ascii("Recompiler");
+#if defined(ENABLE_JAVASE)
        thread_recompile->o.daemon   = true;
        thread_recompile->o.daemon   = true;
+#endif
        thread_recompile->o.priority = 5;
 
        /* actually start the recompilation thread */
        thread_recompile->o.priority = 5;
 
        /* actually start the recompilation thread */
index ef25fbd566e8b4daec87bb561e6869627c96f787..beaae0c7716fec52f9a7d2ee8d01309758daa8d7 100644 (file)
@@ -28,7 +28,7 @@
             Christian Thalinger
             Edwin Steiner
 
             Christian Thalinger
             Edwin Steiner
 
-   $Id: stacktrace.c 6248 2006-12-27 22:39:39Z twisti $
+   $Id: stacktrace.c 6251 2006-12-27 23:15:56Z twisti $
 
 */
 
 
 */
 
@@ -1164,6 +1164,7 @@ return_NULL:
 
 *******************************************************************************/
 
 
 *******************************************************************************/
 
+#if defined(ENABLE_JAVASE)
 java_objectarray *stacktrace_getStack(void)
 {
        stacktracebuffer *stb;
 java_objectarray *stacktrace_getStack(void)
 {
        stacktracebuffer *stb;
@@ -1184,7 +1185,8 @@ java_objectarray *stacktrace_getStack(void)
        /* create a stacktrace for the current thread */
 
        stb = stacktrace_create(THREADOBJECT);
        /* create a stacktrace for the current thread */
 
        stb = stacktrace_create(THREADOBJECT);
-       if (!stb)
+
+       if (stb == NULL)
                goto return_NULL;
 
        /* get the first stacktrace entry */
                goto return_NULL;
 
        /* get the first stacktrace entry */
@@ -1195,17 +1197,17 @@ java_objectarray *stacktrace_getStack(void)
 
        oa = builtin_anewarray(2, arrayclass_java_lang_Object);
 
 
        oa = builtin_anewarray(2, arrayclass_java_lang_Object);
 
-       if (!oa)
+       if (oa == NULL)
                goto return_NULL;
 
        classes = builtin_anewarray(stb->used, class_java_lang_Class);
 
                goto return_NULL;
 
        classes = builtin_anewarray(stb->used, class_java_lang_Class);
 
-       if (!classes)
+       if (classes == NULL)
                goto return_NULL;
 
        methodnames = builtin_anewarray(stb->used, class_java_lang_String);
 
                goto return_NULL;
 
        methodnames = builtin_anewarray(stb->used, class_java_lang_String);
 
-       if (!methodnames)
+       if (methodnames == NULL)
                goto return_NULL;
 
        /* set up the 2-dimensional array */
                goto return_NULL;
 
        /* set up the 2-dimensional array */
@@ -1221,7 +1223,7 @@ java_objectarray *stacktrace_getStack(void)
                classes->data[i] = (java_objectheader *) c;
                str = javastring_new(ste->method->name);
 
                classes->data[i] = (java_objectheader *) c;
                str = javastring_new(ste->method->name);
 
-               if (!str)
+               if (str == NULL)
                        goto return_NULL;
 
                methodnames->data[i] = (java_objectheader *) str;
                        goto return_NULL;
 
                methodnames->data[i] = (java_objectheader *) str;
@@ -1242,6 +1244,7 @@ return_NULL:
 
        return NULL;
 }
 
        return NULL;
 }
+#endif /* ENABLE_JAVASE */
 
 
 /* stacktrace_print_trace_from_buffer ******************************************
 
 
 /* stacktrace_print_trace_from_buffer ******************************************
index 215ff5df0de99747da02975449419c014cfdc989..1755fc16b37c50d44fda766e7af081b57766afef 100644 (file)
@@ -32,7 +32,7 @@
             Edwin Steiner
             Christian Thalinger
 
             Edwin Steiner
             Christian Thalinger
 
-   $Id: linker.c 5975 2006-11-12 15:33:16Z edwin $
+   $Id: linker.c 6251 2006-12-27 23:15:56Z twisti $
 
 */
 
 
 */
 
@@ -103,7 +103,11 @@ primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT] = {
        { NULL, NULL, "java/lang/Short",     'S', "short"   , "[S", NULL, NULL },
        { NULL, NULL, "java/lang/Boolean",   'Z', "boolean" , "[Z", NULL, NULL },
        { NULL, NULL, NULL,                   0 , NULL      , NULL, NULL, NULL },
        { NULL, NULL, "java/lang/Short",     'S', "short"   , "[S", NULL, NULL },
        { NULL, NULL, "java/lang/Boolean",   'Z', "boolean" , "[Z", NULL, NULL },
        { NULL, NULL, NULL,                   0 , NULL      , NULL, NULL, NULL },
-       { NULL, NULL, "java/lang/Void",      'V', "void"    , NULL, NULL, NULL }
+#if defined(ENABLE_JAVASE)
+       { NULL, NULL, "java/lang/Void",      'V', "void"    , NULL, NULL, NULL }
+#else
+       { NULL, NULL, NULL,                   0 , NULL      , NULL, NULL, NULL },
+#endif
 };
 
 
 };
 
 
@@ -151,17 +155,21 @@ bool linker_init(void)
        if (!link_class(class_java_lang_String))
                return false;
 
        if (!link_class(class_java_lang_String))
                return false;
 
+#if defined(ENABLE_JAVASE)
        if (!link_class(class_java_lang_Cloneable))
                return false;
 
        if (!link_class(class_java_io_Serializable))
                return false;
        if (!link_class(class_java_lang_Cloneable))
                return false;
 
        if (!link_class(class_java_io_Serializable))
                return false;
+#endif
 
 
        /* link classes for wrapping primitive types */
 
 
 
        /* link classes for wrapping primitive types */
 
+#if defined(ENABLE_JAVASE)
        if (!link_class(class_java_lang_Void))
                return false;
        if (!link_class(class_java_lang_Void))
                return false;
+#endif
 
        if (!link_class(class_java_lang_Boolean))
                return false;
 
        if (!link_class(class_java_lang_Boolean))
                return false;
@@ -190,11 +198,13 @@ bool linker_init(void)
 
        /* load some other important classes */
 
 
        /* load some other important classes */
 
+#if defined(ENABLE_JAVASE)
        if (!link_class(class_java_lang_ClassLoader))
                return false;
 
        if (!link_class(class_java_lang_SecurityManager))
                return false;
        if (!link_class(class_java_lang_ClassLoader))
                return false;
 
        if (!link_class(class_java_lang_SecurityManager))
                return false;
+#endif
 
        if (!link_class(class_java_lang_System))
                return false;
 
        if (!link_class(class_java_lang_System))
                return false;
@@ -202,18 +212,23 @@ bool linker_init(void)
        if (!link_class(class_java_lang_Thread))
                return false;
 
        if (!link_class(class_java_lang_Thread))
                return false;
 
+#if defined(ENABLE_JAVASE)
        if (!link_class(class_java_lang_ThreadGroup))
                return false;
        if (!link_class(class_java_lang_ThreadGroup))
                return false;
+#endif
 
 
+#if defined(WITH_CLASSPATH_GNU)
        if (!link_class(class_java_lang_VMSystem))
                return false;
 
        if (!link_class(class_java_lang_VMThread))
                return false;
        if (!link_class(class_java_lang_VMSystem))
                return false;
 
        if (!link_class(class_java_lang_VMThread))
                return false;
+#endif
 
 
        /* some classes which may be used more often */
 
 
 
        /* some classes which may be used more often */
 
+#if defined(ENABLE_JAVASE)
        if (!link_class(class_java_lang_StackTraceElement))
                return false;
 
        if (!link_class(class_java_lang_StackTraceElement))
                return false;
 
@@ -234,20 +249,27 @@ bool linker_init(void)
 
        if (!link_class(arrayclass_java_lang_Object))
                return false;
 
        if (!link_class(arrayclass_java_lang_Object))
                return false;
+#endif
 
 
        /* create pseudo classes used by the typechecker */
 
     /* pseudo class for Arraystubs (extends java.lang.Object) */
 
 
        /* create pseudo classes used by the typechecker */
 
     /* pseudo class for Arraystubs (extends java.lang.Object) */
-    
+
        pseudo_class_Arraystub =
                class_create_classinfo(utf_new_char("$ARRAYSTUB$"));
        pseudo_class_Arraystub =
                class_create_classinfo(utf_new_char("$ARRAYSTUB$"));
-       pseudo_class_Arraystub->state |= CLASS_LOADED;
-       pseudo_class_Arraystub->super.cls = class_java_lang_Object;
-       pseudo_class_Arraystub->interfacescount = 2;
-       pseudo_class_Arraystub->interfaces = MNEW(classref_or_classinfo, 2);
+       pseudo_class_Arraystub->state            |= CLASS_LOADED;
+       pseudo_class_Arraystub->super.cls         = class_java_lang_Object;
+
+#if defined(ENABLE_JAVASE)
+       pseudo_class_Arraystub->interfacescount   = 2;
+       pseudo_class_Arraystub->interfaces        = MNEW(classref_or_classinfo, 2);
        pseudo_class_Arraystub->interfaces[0].cls = class_java_lang_Cloneable;
        pseudo_class_Arraystub->interfaces[1].cls = class_java_io_Serializable;
        pseudo_class_Arraystub->interfaces[0].cls = class_java_lang_Cloneable;
        pseudo_class_Arraystub->interfaces[1].cls = class_java_io_Serializable;
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+       pseudo_class_Arraystub->interfacescount   = 0;
+       pseudo_class_Arraystub->interfaces        = NULL;
+#endif
 
        if (!classcache_store_unique(pseudo_class_Arraystub)) {
                log_text("could not cache pseudo_class_Arraystub");
 
        if (!classcache_store_unique(pseudo_class_Arraystub)) {
                log_text("could not cache pseudo_class_Arraystub");
index 5433718a1eb633f6270fa7ec7a106dbd7bea02fd..1462faa75b0224b030b0a6196c308dc355d9f6b9 100644 (file)
@@ -31,7 +31,7 @@
             Edwin Steiner
             Christian Thalinger
 
             Edwin Steiner
             Christian Thalinger
 
-   $Id: loader.c 6216 2006-12-18 18:21:37Z twisti $
+   $Id: loader.c 6251 2006-12-27 23:15:56Z twisti $
 
 */
 
 
 */
 
@@ -112,6 +112,7 @@ bool loader_init(void)
        if (!(class_java_lang_String = load_class_bootstrap(utf_java_lang_String)))
                return false;
 
        if (!(class_java_lang_String = load_class_bootstrap(utf_java_lang_String)))
                return false;
 
+#if defined(ENABLE_JAVASE)
        if (!(class_java_lang_Cloneable =
                  load_class_bootstrap(utf_java_lang_Cloneable)))
                return false;
        if (!(class_java_lang_Cloneable =
                  load_class_bootstrap(utf_java_lang_Cloneable)))
                return false;
@@ -119,12 +120,14 @@ bool loader_init(void)
        if (!(class_java_io_Serializable =
                  load_class_bootstrap(utf_java_io_Serializable)))
                return false;
        if (!(class_java_io_Serializable =
                  load_class_bootstrap(utf_java_io_Serializable)))
                return false;
-
+#endif
 
        /* load classes for wrapping primitive types */
 
 
        /* load classes for wrapping primitive types */
 
+#if defined(ENABLE_JAVASE)
        if (!(class_java_lang_Void = load_class_bootstrap(utf_java_lang_Void)))
                return false;
        if (!(class_java_lang_Void = load_class_bootstrap(utf_java_lang_Void)))
                return false;
+#endif
 
        if (!(class_java_lang_Boolean =
                  load_class_bootstrap(utf_java_lang_Boolean)))
 
        if (!(class_java_lang_Boolean =
                  load_class_bootstrap(utf_java_lang_Boolean)))
@@ -159,6 +162,7 @@ bool loader_init(void)
        if (!(class_java_lang_Class = load_class_bootstrap(utf_java_lang_Class)))
                return false;
 
        if (!(class_java_lang_Class = load_class_bootstrap(utf_java_lang_Class)))
                return false;
 
+#if defined(ENABLE_JAVASE)
        if (!(class_java_lang_ClassLoader =
                  load_class_bootstrap(utf_java_lang_ClassLoader)))
                return false;
        if (!(class_java_lang_ClassLoader =
                  load_class_bootstrap(utf_java_lang_ClassLoader)))
                return false;
@@ -166,6 +170,7 @@ bool loader_init(void)
        if (!(class_java_lang_SecurityManager =
                  load_class_bootstrap(utf_java_lang_SecurityManager)))
                return false;
        if (!(class_java_lang_SecurityManager =
                  load_class_bootstrap(utf_java_lang_SecurityManager)))
                return false;
+#endif
 
        if (!(class_java_lang_System = load_class_bootstrap(utf_java_lang_System)))
                return false;
 
        if (!(class_java_lang_System = load_class_bootstrap(utf_java_lang_System)))
                return false;
@@ -174,21 +179,27 @@ bool loader_init(void)
                  load_class_bootstrap(utf_new_char("java/lang/Thread"))))
                return false;
 
                  load_class_bootstrap(utf_new_char("java/lang/Thread"))))
                return false;
 
+#if defined(ENABLE_JAVASE)
        if (!(class_java_lang_ThreadGroup =
                  load_class_bootstrap(utf_java_lang_ThreadGroup)))
                return false;
        if (!(class_java_lang_ThreadGroup =
                  load_class_bootstrap(utf_java_lang_ThreadGroup)))
                return false;
+#endif
 
 
+#if defined(WITH_CLASSPATH_GNU)
        if (!(class_java_lang_VMSystem =
                  load_class_bootstrap(utf_new_char("java/lang/VMSystem"))))
        if (!(class_java_lang_VMSystem =
                  load_class_bootstrap(utf_new_char("java/lang/VMSystem"))))
+
                return false;
 
        if (!(class_java_lang_VMThread =
                  load_class_bootstrap(utf_new_char("java/lang/VMThread"))))
                return false;
                return false;
 
        if (!(class_java_lang_VMThread =
                  load_class_bootstrap(utf_new_char("java/lang/VMThread"))))
                return false;
+#endif
 
 
        /* some classes which may be used more often */
 
 
 
        /* some classes which may be used more often */
 
+#if defined(ENABLE_JAVASE)
        if (!(class_java_lang_StackTraceElement =
                  load_class_bootstrap(utf_java_lang_StackTraceElement)))
                return false;
        if (!(class_java_lang_StackTraceElement =
                  load_class_bootstrap(utf_java_lang_StackTraceElement)))
                return false;
@@ -215,6 +226,7 @@ bool loader_init(void)
        if (!(arrayclass_java_lang_Object =
                  load_class_bootstrap(utf_new_char("[Ljava/lang/Object;"))))
                return false;
        if (!(arrayclass_java_lang_Object =
                  load_class_bootstrap(utf_new_char("[Ljava/lang/Object;"))))
                return false;
+#endif
 
        return true;
 }
 
        return true;
 }
@@ -1348,12 +1360,14 @@ static bool loader_load_method(classbuffer *cb, methodinfo *m,
                                                m->linenumbers[l].line_number = suck_u2(cb);
                                        }
                                }
                                                m->linenumbers[l].line_number = suck_u2(cb);
                                        }
                                }
+#if defined(ENABLE_JAVASE)
                                else if (code_attribute_name == utf_StackMapTable) {
                                        /* StackTableMap */
 
                                        if (!stackmap_load_attribute_stackmaptable(cb, m))
                                                return false;
                                }
                                else if (code_attribute_name == utf_StackMapTable) {
                                        /* StackTableMap */
 
                                        if (!stackmap_load_attribute_stackmaptable(cb, m))
                                                return false;
                                }
+#endif
                                else {
                                        /* unknown code attribute */
 
                                else {
                                        /* unknown code attribute */
 
@@ -2483,14 +2497,19 @@ classinfo *load_newly_created_array(classinfo *c, java_objectheader *loader)
        }
 
        assert(class_java_lang_Object);
        }
 
        assert(class_java_lang_Object);
+#if defined(ENABLE_JAVASE)
        assert(class_java_lang_Cloneable);
        assert(class_java_io_Serializable);
        assert(class_java_lang_Cloneable);
        assert(class_java_io_Serializable);
+#endif
 
        /* setup the array class */
 
        c->super.cls = class_java_lang_Object;
 
 
        /* setup the array class */
 
        c->super.cls = class_java_lang_Object;
 
-    c->interfacescount = 2;
+    c->interfacescount = 0;
+       c->interfaces = NULL;
+
+#if defined(ENABLE_JAVASE)
     c->interfaces = MNEW(classref_or_classinfo, 2);
 
        if (opt_eager) {
     c->interfaces = MNEW(classref_or_classinfo, 2);
 
        if (opt_eager) {
@@ -2505,11 +2524,12 @@ classinfo *load_newly_created_array(classinfo *c, java_objectheader *loader)
                assert(tc->state & CLASS_LOADED);
                list_add_first(&unlinkedclasses, tc);
                c->interfaces[1].cls = tc;
                assert(tc->state & CLASS_LOADED);
                list_add_first(&unlinkedclasses, tc);
                c->interfaces[1].cls = tc;
-
-       else {
+       }
+       else {
                c->interfaces[0].cls = class_java_lang_Cloneable;
                c->interfaces[1].cls = class_java_io_Serializable;
        }
                c->interfaces[0].cls = class_java_lang_Cloneable;
                c->interfaces[1].cls = class_java_io_Serializable;
        }
+#endif
 
        c->methodscount = 1;
        c->methods = MNEW(methodinfo, c->methodscount);
 
        c->methodscount = 1;
        c->methods = MNEW(methodinfo, c->methodscount);