* src/native/vm/sun/jvm.c (JVM_EEXIST): Defined.
[cacao.git] / src / native / vm / sun / jvm.c
index b4bc9d56543551e45a1786841e5744a7758d05a0..80de64b27a66a1f1f11da6dcc030d30b20a4d769 100644 (file)
@@ -1,6 +1,6 @@
 /* src/native/vm/sun/jvm.c - HotSpot JVM interface functions
 
-   Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel,
+   Copyright (C) 2007, 2008 R. Grafl, A. Krall, C. Kruegel,
    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
    J. Wenninger, Institut f. Computersprachen - TU Wien
 */
 
 
-#define PRINTJVM 0
-
 #include "config.h"
 
 #include <assert.h>
 #include <errno.h>
-#include <fcntl.h>
 #include <ltdl.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
@@ -44,6 +42,7 @@
 
 #include <sys/socket.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 
 #include "vm/types.h"
 
 #include "native/include/java_lang_StackTraceElement.h"
 #include "native/include/java_lang_Throwable.h"
 #include "native/include/java_security_ProtectionDomain.h"
-#include "native/include/java_lang_Integer.h"
-#include "native/include/java_lang_Long.h"
-#include "native/include/java_lang_Short.h"
-#include "native/include/java_lang_Byte.h"
-#include "native/include/java_lang_Character.h"
-#include "native/include/java_lang_Boolean.h"
-#include "native/include/java_lang_Float.h"
-#include "native/include/java_lang_Double.h"
 
 #if defined(ENABLE_ANNOTATIONS)
 #include "native/include/sun_reflect_ConstantPool.h"
 
 #include "native/vm/java_lang_Class.h"
 #include "native/vm/java_lang_ClassLoader.h"
-#include "native/vm/java_lang_Object.h"
 #include "native/vm/java_lang_Runtime.h"
 #include "native/vm/java_lang_Thread.h"
 #include "native/vm/java_lang_reflect_Constructor.h"
 #include "native/vm/java_lang_reflect_Method.h"
-#include "native/vm/java_util_concurrent_atomic_AtomicLong.h"
 #include "native/vm/reflect.h"
 
 #include "threads/lock-common.h"
 #include "threads/threads-common.h"
 
 #include "toolbox/logging.h"
+#include "toolbox/list.h"
 
 #include "vm/array.h"
+
+#if defined(ENABLE_ASSERTION)
+#include "vm/assertion.h"
+#endif
+
 #include "vm/builtin.h"
 #include "vm/exceptions.h"
 #include "vm/global.h"
 #include "vm/initialize.h"
+#include "vm/package.h"
 #include "vm/primitive.h"
 #include "vm/properties.h"
 #include "vm/resolve.h"
 
 #include "vmcore/classcache.h"
 #include "vmcore/options.h"
+#include "vmcore/system.h"
 
 
 /* debugging macros ***********************************************************/
 
 #if !defined(NDEBUG)
 
-# define TRACEJVMCALLS(...) \
-    do { \
-        if (opt_TraceJVMCalls) { \
-            log_println(__VA_ARGS__); \
-        } \
+# define TRACEJVMCALLS(...)                                            \
+    do {                                                                               \
+        if (opt_TraceJVMCalls || opt_TraceJVMCallsVerbose) {                           \
+            log_println(__VA_ARGS__);                  \
+        }                                                                              \
+    } while (0)
+
+# define TRACEJVMCALLSVERBOSE(x)                               \
+    do {                                                                               \
+        if (opt_TraceJVMCallsVerbose) {                        \
+            log_println x;                                             \
+        }                                                                              \
     } while (0)
 
 # define PRINTJVMWARNINGS(...)
 #else
 
 # define TRACEJVMCALLS(...)
+# define TRACEJVMCALLSVERBOSE(x)
 # define PRINTJVMWARNINGS(...)
 
 #endif
@@ -191,18 +196,24 @@ int jio_snprintf(char *str, size_t count, const char *fmt, ...)
 int jio_fprintf(FILE* f, const char *fmt, ...)
 {
        log_println("jio_fprintf: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
 int jio_vfprintf(FILE* f, const char *fmt, va_list args)
 {
        log_println("jio_vfprintf: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
 int jio_printf(const char *fmt, ...)
 {
        log_println("jio_printf: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -222,9 +233,8 @@ jint JVM_GetInterfaceVersion()
 
 jlong JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored)
 {
-#if PRINTJVM
-       log_println("JVM_CurrentTimeMillis");
-#endif
+       TRACEJVMCALLS("JVM_CurrentTimeMillis(env=%p, ignored=%p)", env, ignored);
+
        return (jlong) builtin_currenttimemillis();
 }
 
@@ -233,9 +243,8 @@ jlong JVM_CurrentTimeMillis(JNIEnv *env, jclass ignored)
 
 jlong JVM_NanoTime(JNIEnv *env, jclass ignored)
 {
-#if PRINTJVM
-       log_println("JVM_NanoTime");
-#endif
+       TRACEJVMCALLS("JVM_NanoTime(env=%p, ignored=%p)", env, ignored);
+
        return (jlong) builtin_nanotime();
 }
 
@@ -250,11 +259,9 @@ void JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos, jobje
        s = (java_handle_t *) src;
        d = (java_handle_t *) dst;
 
-#if PRINTJVM
-       log_println("JVM_ArrayCopy: src=%p, src_pos=%d, dst=%p, dst_pos=%d, length=%d", src, src_pos, dst, dst_pos, length);
-#endif
+       TRACEJVMCALLSVERBOSE(("JVM_ArrayCopy(env=%p, ignored=%p, src=%p, src_pos=%d, dst=%p, dst_pos=%d, length=%d)", env, ignored, src, src_pos, dst, dst_pos, length));
 
-       (void) builtin_arraycopy(s, src_pos, d, dst_pos, length);
+       builtin_arraycopy(s, src_pos, d, dst_pos, length);
 }
 
 
@@ -262,10 +269,15 @@ void JVM_ArrayCopy(JNIEnv *env, jclass ignored, jobject src, jint src_pos, jobje
 
 jobject JVM_InitProperties(JNIEnv *env, jobject properties)
 {
-#if PRINTJVM
-       log_println("JVM_InitProperties: properties=%d", properties);
-#endif
-       properties_system_add_all((java_handle_t *) properties);
+       java_handle_t *h;
+
+       TRACEJVMCALLS("JVM_InitProperties(env=%p, properties=%p)", env, properties);
+
+       h = (java_handle_t *) properties;
+
+       properties_system_add_all(h);
+
+       return properties;
 }
 
 
@@ -281,9 +293,8 @@ void JVM_Exit(jint code)
 
 void JVM_Halt(jint code)
 {
-#if PRINTJVM
-       log_println("JVM_Halt: code=%d", code);
-#endif
+       TRACEJVMCALLS("JVM_Halt(code=%d)", code);
+
 /*     vm_exit(code); */
        vm_shutdown(code);
 }
@@ -312,6 +323,8 @@ void JVM_GC(void)
 jlong JVM_MaxObjectInspectionAge(void)
 {
        log_println("JVM_MaxObjectInspectionAge: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -365,7 +378,9 @@ jlong JVM_MaxMemory(void)
 
 jint JVM_ActiveProcessorCount(void)
 {
-       log_println("JVM_ActiveProcessorCount: IMPLEMENT ME!");
+       TRACEJVMCALLS("JVM_ActiveProcessorCount()");
+
+       return system_processors_online();
 }
 
 
@@ -373,21 +388,19 @@ jint JVM_ActiveProcessorCount(void)
 
 void JVM_FillInStackTrace(JNIEnv *env, jobject receiver)
 {
-       java_lang_Throwable *o;
-       stacktracecontainer *stc;
+       java_lang_Throwable     *o;
+       java_handle_bytearray_t *ba;
 
-#if PRINTJVM
-       log_println("JVM_FillInStackTrace: receiver=%p", receiver);
-#endif
+       TRACEJVMCALLS("JVM_FillInStackTrace(env=%p, receiver=%p)", env, receiver);
 
        o = (java_lang_Throwable *) receiver;
 
-       stc = stacktrace_fillInStackTrace();
+       ba = stacktrace_get();
 
-       if (stc == NULL)
+       if (ba == NULL)
                return;
 
-    o->backtrace = (java_lang_Object *) stc;
+       LLNI_field_set_ref(o, backtrace, (java_lang_Object *) ba);
 }
 
 
@@ -403,19 +416,37 @@ void JVM_PrintStackTrace(JNIEnv *env, jobject receiver, jobject printable)
 
 jint JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable)
 {
-       java_lang_Throwable *o;
-       stacktracecontainer *stc;
-       stacktracebuffer    *stb;
+       java_lang_Throwable     *t;
+       java_handle_bytearray_t *ba;
+       stacktrace_t            *st;
+       int32_t                  depth;
 
-#if PRINTJVM
-       log_println("JVM_GetStackTraceDepth: throwable=%p", throwable);
-#endif
+       TRACEJVMCALLS("JVM_GetStackTraceDepth(env=%p, throwable=%p)", env, throwable);
+
+       if (throwable == NULL) {
+               exceptions_throw_nullpointerexception();
+               return 0;
+       }
+
+       t = (java_lang_Throwable *) throwable;
+
+       LLNI_field_get_ref(t, backtrace, ba);
+
+       if (ba == NULL)
+               return 0;
+
+       /* We need a critical section here as the stacktrace structure is
+          mapped onto a Java byte-array. */
+
+       LLNI_CRITICAL_START;
+
+       st = (stacktrace_t *) LLNI_array_data(ba);
+
+       depth = st->length;
 
-       o   = (java_lang_Throwable *) throwable;
-       stc = (stacktracecontainer *) o->backtrace;
-       stb = &(stc->stb);
+       LLNI_CRITICAL_END;
 
-       return stb->used;
+       return depth;
 }
 
 
@@ -423,24 +454,29 @@ jint JVM_GetStackTraceDepth(JNIEnv *env, jobject throwable)
 
 jobject JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index)
 {
-       java_lang_Throwable *t;
-       stacktracecontainer *stc;
-       stacktracebuffer    *stb;
-       stacktrace_entry    *ste;
+       java_lang_Throwable         *t;
+       java_handle_bytearray_t     *ba;
+       stacktrace_t                *st;
+       stacktrace_entry_t          *ste;
+       codeinfo                    *code;
+       methodinfo                  *m;
+       classinfo                   *c;
        java_lang_StackTraceElement *o;
        java_lang_String            *declaringclass;
        java_lang_String            *filename;
-       s4                           linenumber;
+       int32_t                      linenumber;
 
-#if PRINTJVM
-       log_println("JVM_GetStackTraceElement: throwable=%p, index=%d", throwable, index);
-#endif
+       TRACEJVMCALLS("JVM_GetStackTraceElement(env=%p, throwable=%p, index=%d)", env, throwable, index);
+
+       t = (java_lang_Throwable *) throwable;
+
+       LLNI_field_get_ref(t, backtrace, ba);
+
+       /* FIXME critical section */
 
-       t   = (java_lang_Throwable *) throwable;
-       stc = (stacktracecontainer *) t->backtrace;
-       stb = &(stc->stb);
+       st = (stacktrace_t *) LLNI_array_data(ba);
 
-       if ((index < 0) || (index >= stb->used)) {
+       if ((index < 0) || (index >= st->length)) {
                /* XXX This should be an IndexOutOfBoundsException (check this
                   again). */
 
@@ -448,7 +484,15 @@ jobject JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index)
                return NULL;
        }
 
-       ste = &(stb->entries[index]);
+       /* Get the stacktrace entry. */
+
+       ste = &(st->entries[index]);
+
+       /* Get the codeinfo, methodinfo and classinfo. */
+
+       code = ste->code;
+       m    = code->m;
+       c    = m->class;
 
        /* allocate a new StackTraceElement */
 
@@ -460,9 +504,9 @@ jobject JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index)
 
        /* get filename */
 
-       if (!(ste->method->flags & ACC_NATIVE)) {
-               if (ste->method->class->sourcefile)
-                       filename = (java_lang_String *) javastring_new(ste->method->class->sourcefile);
+       if (!(m->flags & ACC_NATIVE)) {
+               if (c->sourcefile != NULL)
+                       filename = (java_lang_String *) javastring_new(c->sourcefile);
                else
                        filename = NULL;
        }
@@ -471,20 +515,27 @@ jobject JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index)
 
        /* get line number */
 
-       if (ste->method->flags & ACC_NATIVE)
+       if (m->flags & ACC_NATIVE) {
                linenumber = -2;
-       else
-               linenumber = (ste->linenumber == 0) ? -1 : ste->linenumber;
+       }
+       else {
+               /* FIXME The linenumbertable_linenumber_for_pc could change
+                  the methodinfo pointer when hitting an inlined method. */
+
+               linenumber = linenumbertable_linenumber_for_pc(&m, code, ste->pc);
+               linenumber = (linenumber == 0) ? -1 : linenumber;
+       }
 
        /* get declaring class name */
 
-       declaringclass =
-               _Jv_java_lang_Class_getName(LLNI_classinfo_wrap(ste->method->class));
+       declaringclass = _Jv_java_lang_Class_getName(LLNI_classinfo_wrap(c));
 
        /* fill the java.lang.StackTraceElement element */
 
+       /* FIXME critical section */
+
        o->declaringClass = declaringclass;
-       o->methodName     = (java_lang_String *) javastring_new(ste->method->name);
+       o->methodName     = (java_lang_String *) javastring_new(m->name);
        o->fileName       = filename;
        o->lineNumber     = linenumber;
 
@@ -496,9 +547,8 @@ jobject JVM_GetStackTraceElement(JNIEnv *env, jobject throwable, jint index)
 
 jint JVM_IHashCode(JNIEnv* env, jobject handle)
 {
-#if PRINTJVM
-       log_println("JVM_IHashCode: jobject=%p", handle);
-#endif
+       TRACEJVMCALLS("JVM_IHashCode(env=%p, jobject=%p)", env, handle);
+
        return (jint) ((ptrint) handle);
 }
 
@@ -507,10 +557,22 @@ jint JVM_IHashCode(JNIEnv* env, jobject handle)
 
 void JVM_MonitorWait(JNIEnv* env, jobject handle, jlong ms)
 {
-#if PRINTJVM
-       log_println("JVM_MonitorWait: handle=%p, ms=%ld", handle, ms);
+#if defined(ENABLE_THREADS)
+       java_handle_t *o;
+#endif
+
+       TRACEJVMCALLS("JVM_MonitorWait(env=%p, handle=%p, ms=%ld)", env, handle, ms);
+    if (ms < 0) {
+/*             exceptions_throw_illegalargumentexception("argument out of range"); */
+               exceptions_throw_illegalargumentexception();
+               return;
+       }
+
+#if defined(ENABLE_THREADS)
+       o = (java_handle_t *) handle;
+
+       lock_wait_for_object(o, ms, 0);
 #endif
-       _Jv_java_lang_Object_wait((java_lang_Object *) handle, ms, 0);
 }
 
 
@@ -518,10 +580,17 @@ void JVM_MonitorWait(JNIEnv* env, jobject handle, jlong ms)
 
 void JVM_MonitorNotify(JNIEnv* env, jobject handle)
 {
-#if PRINTJVM
-       log_println("JVM_MonitorNotify: IMPLEMENT ME!");
+#if defined(ENABLE_THREADS)
+       java_handle_t *o;
+#endif
+
+       TRACEJVMCALLS("JVM_MonitorNotify(env=%p, handle=%p)", env, handle);
+
+#if defined(ENABLE_THREADS)
+       o = (java_handle_t *) handle;
+
+       lock_notify_object(o);
 #endif
-       _Jv_java_lang_Object_notify((java_lang_Object *) handle);
 }
 
 
@@ -529,10 +598,17 @@ void JVM_MonitorNotify(JNIEnv* env, jobject handle)
 
 void JVM_MonitorNotifyAll(JNIEnv* env, jobject handle)
 {
-#if PRINTJVM
-       log_println("JVM_MonitorNotifyAll: handle=%p", handle);
+#if defined(ENABLE_THREADS)
+       java_handle_t *o;
+#endif
+
+       TRACEJVMCALLS("JVM_MonitorNotifyAll(env=%p, handle=%p)", env, handle);
+
+#if defined(ENABLE_THREADS)
+       o = (java_handle_t *) handle;
+
+       lock_notify_all_object(o);
 #endif
-       _Jv_java_lang_Object_notifyAll((java_lang_Object *) handle);
 }
 
 
@@ -540,9 +616,8 @@ void JVM_MonitorNotifyAll(JNIEnv* env, jobject handle)
 
 jobject JVM_Clone(JNIEnv* env, jobject handle)
 {
-#if PRINTJVM
-       log_println("JVM_Clone: handle=%p", handle);
-#endif
+       TRACEJVMCALLS("JVM_Clone(env=%p, handle=%p)", env, handle);
+
        return (jobject) builtin_clone(env, (java_handle_t *) handle);
 }
 
@@ -560,6 +635,8 @@ void JVM_InitializeCompiler (JNIEnv *env, jclass compCls)
 jboolean JVM_IsSilentCompiler(JNIEnv *env, jclass compCls)
 {
        log_println("JVM_IsSilentCompiler: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -568,6 +645,8 @@ jboolean JVM_IsSilentCompiler(JNIEnv *env, jclass compCls)
 jboolean JVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls)
 {
        log_println("JVM_CompileClass: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -576,6 +655,8 @@ jboolean JVM_CompileClass(JNIEnv *env, jclass compCls, jclass cls)
 jboolean JVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname)
 {
        log_println("JVM_CompileClasses: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -584,6 +665,8 @@ jboolean JVM_CompileClasses(JNIEnv *env, jclass cls, jstring jname)
 jobject JVM_CompilerCommand(JNIEnv *env, jclass compCls, jobject arg)
 {
        log_println("JVM_CompilerCommand: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -697,10 +780,10 @@ jclass JVM_FindClassFromClassLoader(JNIEnv* env, const char* name, jboolean init
        utf         *u;
        classloader *cl;
 
-       TRACEJVMCALLS("JVM_FindClassFromClassLoader: name=%s, init=%d, loader=%p, throwError=%d", name, init, loader, throwError);
+       TRACEJVMCALLS("JVM_FindClassFromClassLoader(name=%s, init=%d, loader=%p, throwError=%d)", name, init, loader, throwError);
 
        u  = utf_new_char(name);
-       cl = (classloader *) loader;
+       cl = loader_hashtable_classloader_add((java_handle_t *) loader);
 
        c = load_class_from_classloader(u, cl);
 
@@ -721,6 +804,8 @@ jclass JVM_FindClassFromClassLoader(JNIEnv* env, const char* name, jboolean init
 jclass JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init, jclass from)
 {
        log_println("JVM_FindClassFromClass: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -729,6 +814,8 @@ jclass JVM_FindClassFromClass(JNIEnv *env, const char *name, jboolean init, jcla
 jclass JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd)
 {
        log_println("JVM_DefineClass: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -742,8 +829,12 @@ jclass JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader,
 
        TRACEJVMCALLS("JVM_DefineClassWithSource(env=%p, name=%s, loader=%p, buf=%p, len=%d, pd=%p, source=%s)", env, name, loader, buf, len, pd, source);
 
-       u  = utf_new_char(name);
-       cl = (classloader *) loader;
+       if (name != NULL)
+               u = utf_new_char(name);
+       else
+               u = NULL;
+
+       cl = loader_hashtable_classloader_add((java_handle_t *) loader);
 
        /* XXX do something with source */
 
@@ -763,7 +854,7 @@ jclass JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name)
 
        TRACEJVMCALLS("JVM_FindLoadedClass(env=%p, loader=%p, name=%p)", env, loader, name);
 
-       cl = (classloader *) loader;
+       cl = loader_hashtable_classloader_add((java_handle_t *) loader);
 
        u = javastring_toutf((java_handle_t *) name, true);
        c = classcache_lookup(cl, u);
@@ -776,9 +867,8 @@ jclass JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name)
 
 jstring JVM_GetClassName(JNIEnv *env, jclass cls)
 {
-#if PRINTJVM
-       log_println("JVM_GetClassName: cls=%p", cls);
-#endif
+       TRACEJVMCALLS("JVM_GetClassName(env=%p, cls=%p)", env, cls);
+
        return (jstring) _Jv_java_lang_Class_getName((java_lang_Class *) cls);
 }
 
@@ -804,9 +894,15 @@ jobjectArray JVM_GetClassInterfaces(JNIEnv *env, jclass cls)
 
 jobject JVM_GetClassLoader(JNIEnv *env, jclass cls)
 {
+       classinfo   *c;
+       classloader *cl;
+
        TRACEJVMCALLS("JVM_GetClassLoader(env=%p, cls=%p)", env, cls);
 
-       return (jobject) _Jv_java_lang_Class_getClassLoader((java_lang_Class *) cls);
+       c  = LLNI_classinfo_unwrap(cls);
+       cl = class_get_classloader(c);
+
+       return (jobject) cl;
 }
 
 
@@ -816,9 +912,7 @@ jboolean JVM_IsInterface(JNIEnv *env, jclass cls)
 {
        classinfo *c;
 
-#if PRINTJVM
-       log_println("JVM_IsInterface: cls=%p", cls);
-#endif
+       TRACEJVMCALLS("JVM_IsInterface(env=%p, cls=%p)", env, cls);
 
        c = LLNI_classinfo_unwrap(cls);
 
@@ -831,6 +925,8 @@ jboolean JVM_IsInterface(JNIEnv *env, jclass cls)
 jobjectArray JVM_GetClassSigners(JNIEnv *env, jclass cls)
 {
        log_println("JVM_GetClassSigners: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -838,7 +934,24 @@ jobjectArray JVM_GetClassSigners(JNIEnv *env, jclass cls)
 
 void JVM_SetClassSigners(JNIEnv *env, jclass cls, jobjectArray signers)
 {
-       log_println("JVM_SetClassSigners: IMPLEMENT ME!");
+       classinfo                 *c;
+       java_handle_objectarray_t *hoa;
+
+       TRACEJVMCALLS("JVM_SetClassSigners(env=%p, cls=%p, signers=%p)", env, cls, signers);
+
+       c = LLNI_classinfo_unwrap(cls);
+
+       hoa = (java_handle_objectarray_t *) signers;
+
+    /* This call is ignored for primitive types and arrays.  Signers
+          are only set once, ClassLoader.java, and thus shouldn't be
+          called with an array.  Only the bootstrap loader creates
+          arrays. */
+
+       if (class_is_primitive(c) || class_is_array(c))
+               return;
+
+       LLNI_classinfo_field_set(c, signers, hoa);
 }
 
 
@@ -884,9 +997,7 @@ jobject JVM_DoPrivileged(JNIEnv *env, jclass cls, jobject action, jobject contex
        java_handle_t *result;
        java_handle_t *e;
 
-#if PRINTJVM
-       log_println("JVM_DoPrivileged: action=%p, context=%p, wrapException=%d", action, context, wrapException);
-#endif
+       TRACEJVMCALLS("JVM_DoPrivileged(env=%p, cls=%p, action=%p, context=%p, wrapException=%d)", env, cls, action, context, wrapException);
 
        o = (java_handle_t *) action;
        c = o->vftbl->class;
@@ -927,6 +1038,8 @@ jobject JVM_DoPrivileged(JNIEnv *env, jclass cls, jobject action, jobject contex
 jobject JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls)
 {
        log_println("JVM_GetInheritedAccessControlContext: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -934,7 +1047,13 @@ jobject JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls)
 
 jobject JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls)
 {
-       log_println("JVM_GetStackAccessControlContext: IMPLEMENT ME!");
+       TRACEJVMCALLS("JVM_GetStackAccessControlContext(env=%p, cls=%p): IMPLEMENT ME!", env, cls);
+
+       /* XXX All stuff I tested so far works without that function.  At
+          some point we have to implement it, but I disable the output
+          for now to make IcedTea happy. */
+
+       return NULL;
 }
 
 
@@ -942,10 +1061,13 @@ jobject JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls)
 
 jboolean JVM_IsArrayClass(JNIEnv *env, jclass cls)
 {
-#if PRINTJVM
-       log_println("JVM_IsArrayClass: cls=%p", cls);
-#endif
-       return class_is_array(LLNI_classinfo_unwrap(cls));
+       classinfo *c;
+
+       TRACEJVMCALLS("JVM_IsArrayClass(env=%p, cls=%p)", env, cls);
+
+       c = LLNI_classinfo_unwrap(cls);
+
+       return class_is_array(c);
 }
 
 
@@ -955,11 +1077,9 @@ jboolean JVM_IsPrimitiveClass(JNIEnv *env, jclass cls)
 {
        classinfo *c;
 
-       c = LLNI_classinfo_unwrap(cls);
+       TRACEJVMCALLS("JVM_IsPrimitiveClass(env=%p, cls=%p)", env, cls);
 
-#if PRINTJVM
-       log_println("JVM_IsPrimitiveClass(cls=%p)", cls);
-#endif
+       c = LLNI_classinfo_unwrap(cls);
 
        return class_is_primitive(c);
 }
@@ -987,16 +1107,15 @@ jclass JVM_GetComponentType(JNIEnv *env, jclass cls)
 jint JVM_GetClassModifiers(JNIEnv *env, jclass cls)
 {
        classinfo *c;
+       int32_t    flags;
 
-#if PRINTJVM
-       log_println("JVM_GetClassModifiers: cls=%p", cls);
-#endif
+       TRACEJVMCALLS("JVM_GetClassModifiers(env=%p, cls=%p)", env, cls);
 
        c = LLNI_classinfo_unwrap(cls);
 
-       /* XXX is this correct? */
+       flags = class_get_modifiers(c, false);
 
-       return c->flags & ACC_CLASS_REFLECT_MASK;
+       return flags;
 }
 
 
@@ -1040,11 +1159,11 @@ jstring JVM_GetClassSignature(JNIEnv *env, jclass cls)
 {
        classinfo     *c;
        utf           *u;
-       java_object_t *s;
+       java_handle_t *s;
 
        TRACEJVMCALLS("JVM_GetClassSignature(env=%p, cls=%p)", env, cls);
 
-       c = (classinfo *) cls;
+       c = LLNI_classinfo_unwrap(cls);
 
        /* Get the signature of the class. */
 
@@ -1065,8 +1184,8 @@ jstring JVM_GetClassSignature(JNIEnv *env, jclass cls)
 
 jbyteArray JVM_GetClassAnnotations(JNIEnv *env, jclass cls)
 {
-       classinfo               *c           = NULL;
-       java_handle_bytearray_t *annotations = NULL;
+       classinfo               *c           = NULL; /* classinfo for 'cls'  */
+       java_handle_bytearray_t *annotations = NULL; /* unparsed annotations */
 
        TRACEJVMCALLS("JVM_GetClassAnnotations: cls=%p", cls);
 
@@ -1088,8 +1207,8 @@ jbyteArray JVM_GetClassAnnotations(JNIEnv *env, jclass cls)
 
 jbyteArray JVM_GetFieldAnnotations(JNIEnv *env, jobject field)
 {
-       java_lang_reflect_Field *rf = (java_lang_reflect_Field*)field;
-       java_handle_bytearray_t *ba = NULL;
+       java_lang_reflect_Field *rf = NULL; /* java.lang.reflect.Field for 'field' */
+       java_handle_bytearray_t *ba = NULL; /* unparsed annotations */
 
        TRACEJVMCALLS("JVM_GetFieldAnnotations: field=%p", field);
 
@@ -1098,6 +1217,8 @@ jbyteArray JVM_GetFieldAnnotations(JNIEnv *env, jobject field)
                return NULL;
        }
 
+       rf = (java_lang_reflect_Field*)field;
+
        LLNI_field_get_ref(rf, annotations, ba);
 
        return (jbyteArray)ba;
@@ -1108,8 +1229,8 @@ jbyteArray JVM_GetFieldAnnotations(JNIEnv *env, jobject field)
 
 jbyteArray JVM_GetMethodAnnotations(JNIEnv *env, jobject method)
 {
-       java_lang_reflect_Method *rm = (java_lang_reflect_Method*)method;
-       java_handle_bytearray_t  *ba = NULL;
+       java_lang_reflect_Method *rm = NULL; /* java.lang.reflect.Method for 'method' */
+       java_handle_bytearray_t  *ba = NULL; /* unparsed annotations */
 
        TRACEJVMCALLS("JVM_GetMethodAnnotations: method=%p", method);
 
@@ -1118,6 +1239,8 @@ jbyteArray JVM_GetMethodAnnotations(JNIEnv *env, jobject method)
                return NULL;
        }
 
+       rm = (java_lang_reflect_Method*)method;
+
        LLNI_field_get_ref(rm, annotations, ba);
 
        return (jbyteArray)ba;
@@ -1128,8 +1251,8 @@ jbyteArray JVM_GetMethodAnnotations(JNIEnv *env, jobject method)
 
 jbyteArray JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method)
 {
-       java_lang_reflect_Method *rm = (java_lang_reflect_Method*)method;
-       java_handle_bytearray_t  *ba = NULL;
+       java_lang_reflect_Method *rm = NULL; /* java.lang.reflect.Method for 'method' */
+       java_handle_bytearray_t  *ba = NULL; /* unparsed annotation default value */
 
        TRACEJVMCALLS("JVM_GetMethodDefaultAnnotationValue: method=%p", method);
 
@@ -1138,6 +1261,8 @@ jbyteArray JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method)
                return NULL;
        }
 
+       rm = (java_lang_reflect_Method*)method;
+
        LLNI_field_get_ref(rm, annotationDefault, ba);
 
        return (jbyteArray)ba;
@@ -1148,8 +1273,8 @@ jbyteArray JVM_GetMethodDefaultAnnotationValue(JNIEnv *env, jobject method)
 
 jbyteArray JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method)
 {
-       java_lang_reflect_Method *rm = (java_lang_reflect_Method*)method;
-       java_handle_bytearray_t  *ba = NULL;
+       java_lang_reflect_Method *rm = NULL; /* java.lang.reflect.Method for 'method' */
+       java_handle_bytearray_t  *ba = NULL; /* unparsed parameter annotations */
 
        TRACEJVMCALLS("JVM_GetMethodParameterAnnotations: method=%p", method);
 
@@ -1158,6 +1283,8 @@ jbyteArray JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method)
                return NULL;
        }
 
+       rm = (java_lang_reflect_Method*)method;
+
        LLNI_field_get_ref(rm, parameterAnnotations, ba);
 
        return (jbyteArray)ba;
@@ -1168,9 +1295,8 @@ jbyteArray JVM_GetMethodParameterAnnotations(JNIEnv *env, jobject method)
 
 jobjectArray JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly)
 {
-#if PRINTJVM
-       log_println("JVM_GetClassDeclaredFields: ofClass=%p, publicOnly=%d", ofClass, publicOnly);
-#endif
+       TRACEJVMCALLS("JVM_GetClassDeclaredFields(env=%p, ofClass=%p, publicOnly=%d)", env, ofClass, publicOnly);
+
        return (jobjectArray) _Jv_java_lang_Class_getDeclaredFields((java_lang_Class *) ofClass, publicOnly);
 }
 
@@ -1179,9 +1305,8 @@ jobjectArray JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean pu
 
 jobjectArray JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean publicOnly)
 {
-#if PRINTJVM
-       log_println("JVM_GetClassDeclaredMethods: ofClass=%p, publicOnly=%d", ofClass, publicOnly);
-#endif
+       TRACEJVMCALLS("JVM_GetClassDeclaredMethods(env=%p, ofClass=%p, publicOnly=%d)", env, ofClass, publicOnly);
+
        return (jobjectArray) _Jv_java_lang_Class_getDeclaredMethods((java_lang_Class *) ofClass, publicOnly);
 }
 
@@ -1190,9 +1315,8 @@ jobjectArray JVM_GetClassDeclaredMethods(JNIEnv *env, jclass ofClass, jboolean p
 
 jobjectArray JVM_GetClassDeclaredConstructors(JNIEnv *env, jclass ofClass, jboolean publicOnly)
 {
-#if PRINTJVM
-       log_println("JVM_GetClassDeclaredConstructors: ofClass=%p, publicOnly=%d", ofClass, publicOnly);
-#endif
+       TRACEJVMCALLS("JVM_GetClassDeclaredConstructors(env=%p, ofClass=%p, publicOnly=%d)", env, ofClass, publicOnly);
+
        return (jobjectArray) _Jv_java_lang_Class_getDeclaredConstructors((java_lang_Class *) ofClass, publicOnly);
 }
 
@@ -1203,12 +1327,12 @@ jint JVM_GetClassAccessFlags(JNIEnv *env, jclass cls)
 {
        classinfo *c;
 
-#if PRINTJVM
-       log_println("JVM_GetClassAccessFlags: cls=%p", cls);
-#endif
+       TRACEJVMCALLS("JVM_GetClassAccessFlags(env=%p, cls=%p)", env, cls);
 
        c = LLNI_classinfo_unwrap(cls);
 
+       /* Primitive type classes have the correct access flags. */
+
        return c->flags & ACC_CLASS_REFLECT_MASK;
 }
 
@@ -1219,8 +1343,10 @@ jobject JVM_GetClassConstantPool(JNIEnv *env, jclass cls)
 {
 #if defined(ENABLE_ANNOTATIONS)
        sun_reflect_ConstantPool *constantPool    = NULL;
+                     /* constant pool object for the class refered by 'cls' */
        java_lang_Object         *constantPoolOop = (java_lang_Object*)cls;
-       
+                     /* constantPoolOop field of the constant pool object   */
+
        TRACEJVMCALLS("JVM_GetClassConstantPool(env=%p, cls=%p)", env, cls);
 
        constantPool = 
@@ -1246,7 +1372,7 @@ jobject JVM_GetClassConstantPool(JNIEnv *env, jclass cls)
 
 jint JVM_ConstantPoolGetSize(JNIEnv *env, jobject unused, jobject jcpool)
 {
-       classinfo *c;
+       classinfo *c; /* classinfo of the class for which 'this' is the constant pool */
 
        TRACEJVMCALLS("JVM_ConstantPoolGetSize(env=%p, unused=%p, jcpool=%p)", env, unused, jcpool);
 
@@ -1260,9 +1386,9 @@ jint JVM_ConstantPoolGetSize(JNIEnv *env, jobject unused, jobject jcpool)
 
 jclass JVM_ConstantPoolGetClassAt(JNIEnv *env, jobject unused, jobject jcpool, jint index)
 {
-       constant_classref *ref;
-       classinfo         *c;
-       classinfo         *result;
+       constant_classref *ref;    /* classref to the class at constant pool index 'index' */
+       classinfo         *c;      /* classinfo of the class for which 'this' is the constant pool */
+       classinfo         *result; /* classinfo of the class at constant pool index 'index' */
 
        TRACEJVMCALLS("JVM_ConstantPoolGetClassAt(env=%p, jcpool=%p, index=%d)", env, jcpool, index);
 
@@ -1270,8 +1396,10 @@ jclass JVM_ConstantPoolGetClassAt(JNIEnv *env, jobject unused, jobject jcpool, j
 
        ref = (constant_classref *) class_getconstant(c, index, CONSTANT_Class);
 
-       if (ref == NULL)
+       if (ref == NULL) {
+               exceptions_throw_illegalargumentexception();
                return NULL;
+       }
 
        result = resolve_classref_eager(ref);
 
@@ -1283,9 +1411,9 @@ jclass JVM_ConstantPoolGetClassAt(JNIEnv *env, jobject unused, jobject jcpool, j
 
 jclass JVM_ConstantPoolGetClassAtIfLoaded(JNIEnv *env, jobject unused, jobject jcpool, jint index)
 {
-       constant_classref *ref;
-       classinfo         *c;
-       classinfo         *result;
+       constant_classref *ref;    /* classref to the class at constant pool index 'index' */
+       classinfo         *c;      /* classinfo of the class for which 'this' is the constant pool */
+       classinfo         *result; /* classinfo of the class at constant pool index 'index' */
 
        TRACEJVMCALLS("JVM_ConstantPoolGetClassAtIfLoaded(env=%p, unused=%p, jcpool=%p, index=%d)", env, unused, jcpool, index);
 
@@ -1293,11 +1421,14 @@ jclass JVM_ConstantPoolGetClassAtIfLoaded(JNIEnv *env, jobject unused, jobject j
 
        ref = (constant_classref *) class_getconstant(c, index, CONSTANT_Class);
 
-       if (ref == NULL)
+       if (ref == NULL) {
+               exceptions_throw_illegalargumentexception();
                return NULL;
+       }
        
-       if (!resolve_classref(NULL, ref, resolveLazy, true, true, &result))
+       if (!resolve_classref(NULL, ref, resolveLazy, true, true, &result)) {
                return NULL;
+       }
 
        if ((result == NULL) || !(result->state & CLASS_LOADED)) {
                return NULL;
@@ -1311,14 +1442,16 @@ jclass JVM_ConstantPoolGetClassAtIfLoaded(JNIEnv *env, jobject unused, jobject j
 
 jobject JVM_ConstantPoolGetMethodAt(JNIEnv *env, jobject unused, jobject jcpool, jint index)
 {
-       constant_FMIref *ref;
-       classinfo *cls = LLNI_classinfo_unwrap(jcpool);
+       constant_FMIref *ref; /* reference to the method in constant pool at index 'index' */
+       classinfo *cls;       /* classinfo of the class for which 'this' is the constant pool */
        
        TRACEJVMCALLS("JVM_ConstantPoolGetMethodAt: jcpool=%p, index=%d", jcpool, index);
-
+       
+       cls = LLNI_classinfo_unwrap(jcpool);
        ref = (constant_FMIref*)class_getconstant(cls, index, CONSTANT_Methodref);
        
        if (ref == NULL) {
+               exceptions_throw_illegalargumentexception();
                return NULL;
        }
 
@@ -1331,15 +1464,17 @@ jobject JVM_ConstantPoolGetMethodAt(JNIEnv *env, jobject unused, jobject jcpool,
 
 jobject JVM_ConstantPoolGetMethodAtIfLoaded(JNIEnv *env, jobject unused, jobject jcpool, jint index)
 {
-       constant_FMIref *ref;
-       classinfo *c = NULL;
-       classinfo *cls = LLNI_classinfo_unwrap(jcpool);
+       constant_FMIref *ref; /* reference to the method in constant pool at index 'index' */
+       classinfo *c = NULL;  /* resolved declaring class of the method */
+       classinfo *cls;       /* classinfo of the class for which 'this' is the constant pool */
 
        TRACEJVMCALLS("JVM_ConstantPoolGetMethodAtIfLoaded: jcpool=%p, index=%d", jcpool, index);
 
+       cls = LLNI_classinfo_unwrap(jcpool);
        ref = (constant_FMIref*)class_getconstant(cls, index, CONSTANT_Methodref);
 
        if (ref == NULL) {
+               exceptions_throw_illegalargumentexception();
                return NULL;
        }
 
@@ -1359,14 +1494,16 @@ jobject JVM_ConstantPoolGetMethodAtIfLoaded(JNIEnv *env, jobject unused, jobject
 
 jobject JVM_ConstantPoolGetFieldAt(JNIEnv *env, jobject unused, jobject jcpool, jint index)
 {
-       constant_FMIref *ref;
-       classinfo *cls = LLNI_classinfo_unwrap(jcpool);
+       constant_FMIref *ref; /* reference to the field in constant pool at index 'index' */
+       classinfo *cls;       /* classinfo of the class for which 'this' is the constant pool */
        
        TRACEJVMCALLS("JVM_ConstantPoolGetFieldAt: jcpool=%p, index=%d", jcpool, index);
 
+       cls = LLNI_classinfo_unwrap(jcpool);
        ref = (constant_FMIref*)class_getconstant(cls, index, CONSTANT_Fieldref);
 
        if (ref == NULL) {
+               exceptions_throw_illegalargumentexception();
                return NULL;
        }
 
@@ -1378,15 +1515,17 @@ jobject JVM_ConstantPoolGetFieldAt(JNIEnv *env, jobject unused, jobject jcpool,
 
 jobject JVM_ConstantPoolGetFieldAtIfLoaded(JNIEnv *env, jobject unused, jobject jcpool, jint index)
 {
-       constant_FMIref *ref;
-       classinfo *c;
-       classinfo *cls = LLNI_classinfo_unwrap(jcpool);
+       constant_FMIref *ref; /* reference to the field in constant pool at index 'index' */
+       classinfo *c;         /* resolved declaring class for the field */
+       classinfo *cls;       /* classinfo of the class for which 'this' is the constant pool */
 
        TRACEJVMCALLS("JVM_ConstantPoolGetFieldAtIfLoaded: jcpool=%p, index=%d", jcpool, index);
 
+       cls = LLNI_classinfo_unwrap(jcpool);
        ref = (constant_FMIref*)class_getconstant(cls, index, CONSTANT_Fieldref);
 
        if (ref == NULL) {
+               exceptions_throw_illegalargumentexception();
                return NULL;
        }
 
@@ -1407,6 +1546,9 @@ jobject JVM_ConstantPoolGetFieldAtIfLoaded(JNIEnv *env, jobject unused, jobject
 jobjectArray JVM_ConstantPoolGetMemberRefInfoAt(JNIEnv *env, jobject unused, jobject jcpool, jint index)
 {
        log_println("JVM_ConstantPoolGetMemberRefInfoAt: jcpool=%p, index=%d, IMPLEMENT ME!", jcpool, index);
+
+       /* TODO: implement. (this is yet unused be OpenJDK but, so very low priority) */
+
        return NULL;
 }
 
@@ -1415,14 +1557,16 @@ jobjectArray JVM_ConstantPoolGetMemberRefInfoAt(JNIEnv *env, jobject unused, job
 
 jint JVM_ConstantPoolGetIntAt(JNIEnv *env, jobject unused, jobject jcpool, jint index)
 {
-       constant_integer *ref;
-       classinfo *cls = LLNI_classinfo_unwrap(jcpool);
+       constant_integer *ref; /* reference to the int value in constant pool at index 'index' */
+       classinfo *cls;        /* classinfo of the class for which 'this' is the constant pool */
 
        TRACEJVMCALLS("JVM_ConstantPoolGetIntAt: jcpool=%p, index=%d", jcpool, index);
 
+       cls = LLNI_classinfo_unwrap(jcpool);
        ref = (constant_integer*)class_getconstant(cls, index, CONSTANT_Integer);
 
        if (ref == NULL) {
+               exceptions_throw_illegalargumentexception();
                return 0;
        }
 
@@ -1434,14 +1578,16 @@ jint JVM_ConstantPoolGetIntAt(JNIEnv *env, jobject unused, jobject jcpool, jint
 
 jlong JVM_ConstantPoolGetLongAt(JNIEnv *env, jobject unused, jobject jcpool, jint index)
 {
-       constant_long *ref;
-       classinfo *cls = LLNI_classinfo_unwrap(jcpool);
+       constant_long *ref; /* reference to the long value in constant pool at index 'index' */
+       classinfo *cls;     /* classinfo of the class for which 'this' is the constant pool */
 
        TRACEJVMCALLS("JVM_ConstantPoolGetLongAt: jcpool=%p, index=%d", jcpool, index);
 
+       cls = LLNI_classinfo_unwrap(jcpool);
        ref = (constant_long*)class_getconstant(cls, index, CONSTANT_Long);
 
        if (ref == NULL) {
+               exceptions_throw_illegalargumentexception();
                return 0;
        }
 
@@ -1453,14 +1599,16 @@ jlong JVM_ConstantPoolGetLongAt(JNIEnv *env, jobject unused, jobject jcpool, jin
 
 jfloat JVM_ConstantPoolGetFloatAt(JNIEnv *env, jobject unused, jobject jcpool, jint index)
 {
-       constant_float *ref;
-       classinfo *cls = LLNI_classinfo_unwrap(jcpool);
+       constant_float *ref; /* reference to the float value in constant pool at index 'index' */
+       classinfo *cls;      /* classinfo of the class for which 'this' is the constant pool */
 
        TRACEJVMCALLS("JVM_ConstantPoolGetFloatAt: jcpool=%p, index=%d", jcpool, index);
 
+       cls = LLNI_classinfo_unwrap(jcpool);
        ref = (constant_float*)class_getconstant(cls, index, CONSTANT_Float);
 
        if (ref == NULL) {
+               exceptions_throw_illegalargumentexception();
                return 0;
        }
 
@@ -1472,14 +1620,16 @@ jfloat JVM_ConstantPoolGetFloatAt(JNIEnv *env, jobject unused, jobject jcpool, j
 
 jdouble JVM_ConstantPoolGetDoubleAt(JNIEnv *env, jobject unused, jobject jcpool, jint index)
 {
-       constant_double *ref;
-       classinfo *cls = LLNI_classinfo_unwrap(jcpool);
+       constant_double *ref; /* reference to the double value in constant pool at index 'index' */
+       classinfo *cls;       /* classinfo of the class for which 'this' is the constant pool */
 
        TRACEJVMCALLS("JVM_ConstantPoolGetDoubleAt: jcpool=%p, index=%d", jcpool, index);
 
+       cls = LLNI_classinfo_unwrap(jcpool);
        ref = (constant_double*)class_getconstant(cls, index, CONSTANT_Double);
 
        if (ref == NULL) {
+               exceptions_throw_illegalargumentexception();
                return 0;
        }
 
@@ -1491,14 +1641,16 @@ jdouble JVM_ConstantPoolGetDoubleAt(JNIEnv *env, jobject unused, jobject jcpool,
 
 jstring JVM_ConstantPoolGetStringAt(JNIEnv *env, jobject unused, jobject jcpool, jint index)
 {
-       utf *ref;
-       classinfo *cls = LLNI_classinfo_unwrap(jcpool);
+       utf *ref;       /* utf object for the string in constant pool at index 'index' */
+       classinfo *cls; /* classinfo of the class for which 'this' is the constant pool */
 
        TRACEJVMCALLS("JVM_ConstantPoolGetStringAt: jcpool=%p, index=%d", jcpool, index);
        
+       cls = LLNI_classinfo_unwrap(jcpool);
        ref = (utf*)class_getconstant(cls, index, CONSTANT_String);
 
        if (ref == NULL) {
+               exceptions_throw_illegalargumentexception();
                return NULL;
        }
 
@@ -1511,14 +1663,16 @@ jstring JVM_ConstantPoolGetStringAt(JNIEnv *env, jobject unused, jobject jcpool,
 
 jstring JVM_ConstantPoolGetUTF8At(JNIEnv *env, jobject unused, jobject jcpool, jint index)
 {
-       utf *ref;
-       classinfo *cls = LLNI_classinfo_unwrap(jcpool);
+       utf *ref; /* utf object for the utf8 data in constant pool at index 'index' */
+       classinfo *cls; /* classinfo of the class for which 'this' is the constant pool */
 
        TRACEJVMCALLS("JVM_ConstantPoolGetUTF8At: jcpool=%p, index=%d", jcpool, index);
 
+       cls = LLNI_classinfo_unwrap(jcpool);
        ref = (utf*)class_getconstant(cls, index, CONSTANT_Utf8);
 
        if (ref == NULL) {
+               exceptions_throw_illegalargumentexception();
                return NULL;
        }
 
@@ -1531,11 +1685,42 @@ jstring JVM_ConstantPoolGetUTF8At(JNIEnv *env, jobject unused, jobject jcpool, j
 
 jboolean JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls)
 {
+#if defined(ENABLE_ASSERTION)
+       assertion_name_t  *item;
+       classinfo         *c;
+       jboolean           status;
+       utf               *name;
+
        TRACEJVMCALLS("JVM_DesiredAssertionStatus(env=%p, unused=%p, cls=%p)", env, unused, cls);
 
-       /* TODO: Implement this one, but false should be OK. */
+       c = LLNI_classinfo_unwrap(cls);
 
-       return false;
+       if (c->classloader == NULL) {
+               status = (jboolean)assertion_system_enabled;
+       }
+       else {
+               status = (jboolean)assertion_user_enabled;
+       }
+
+       if (list_assertion_names != NULL) {
+               item = (assertion_name_t *)list_first(list_assertion_names);
+               while (item != NULL) {
+                       name = utf_new_char(item->name);
+                       if (name == c->packagename) {
+                               status = (jboolean)item->enabled;
+                       }
+                       else if (name == c->name) {
+                               status = (jboolean)item->enabled;
+                       }
+
+                       item = (assertion_name_t *)list_next(list_assertion_names, item);
+               }
+       }
+
+       return status;
+#else
+       return (jboolean)false;
+#endif
 }
 
 
@@ -1543,15 +1728,19 @@ jboolean JVM_DesiredAssertionStatus(JNIEnv *env, jclass unused, jclass cls)
 
 jobject JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused)
 {
-       classinfo                           *c;
-       java_lang_AssertionStatusDirectives *o;
-       java_handle_objectarray_t           *classes;
-       java_handle_objectarray_t           *packages;
-
-#if PRINTJVM || 1
-       log_println("JVM_AssertionStatusDirectives");
+       classinfo                             *c;
+       java_lang_AssertionStatusDirectives   *o;
+       java_handle_objectarray_t             *classes;
+       java_handle_objectarray_t             *packages;
+       java_booleanarray_t                   *classEnabled;
+       java_booleanarray_t                   *packageEnabled;
+#if defined(ENABLE_ASSERTION)
+       assertion_name_t                      *item;
+       java_handle_t                         *js;
+       s4                                     i, j;
 #endif
-       /* XXX this is not completely implemented */
+
+       TRACEJVMCALLS("JVM_AssertionStatusDirectives(env=%p, unused=%p)", env, unused);
 
        c = load_class_bootstrap(utf_new_char("java/lang/AssertionStatusDirectives"));
 
@@ -1563,20 +1752,74 @@ jobject JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused)
        if (o == NULL)
                return NULL;
 
+#if defined(ENABLE_ASSERTION)
+       classes = builtin_anewarray(assertion_class_count, class_java_lang_Object);
+#else
        classes = builtin_anewarray(0, class_java_lang_Object);
-
+#endif
        if (classes == NULL)
                return NULL;
 
+#if defined(ENABLE_ASSERTION)
+       packages = builtin_anewarray(assertion_package_count, class_java_lang_Object);
+#else
        packages = builtin_anewarray(0, class_java_lang_Object);
-
+#endif
        if (packages == NULL)
                return NULL;
+       
+#if defined(ENABLE_ASSERTION)
+       classEnabled = builtin_newarray_boolean(assertion_class_count);
+#else
+       classEnabled = builtin_newarray_boolean(0);
+#endif
+       if (classEnabled == NULL)
+               return NULL;
+
+#if defined(ENABLE_ASSERTION)
+       packageEnabled = builtin_newarray_boolean(assertion_package_count);
+#else
+       packageEnabled = builtin_newarray_boolean(0);
+#endif
+       if (packageEnabled == NULL)
+               return NULL;
+
+#if defined(ENABLE_ASSERTION)
+       /* initialize arrays */
+
+       if (list_assertion_names != NULL) {
+               i = 0;
+               j = 0;
+               
+               item = (assertion_name_t *)list_first(list_assertion_names);
+               while (item != NULL) {
+                       js = javastring_new_from_ascii(item->name);
+                       if (js == NULL) {
+                               return NULL;
+                       }
+
+                       if (item->package == false) {
+                               classes->data[i] = js;
+                               classEnabled->data[i] = (jboolean) item->enabled;
+                               i += 1;
+                       }
+                       else {
+                               packages->data[j] = js;
+                               packageEnabled->data[j] = (jboolean) item->enabled;
+                               j += 1;
+                       }
+
+                       item = (assertion_name_t *)list_next(list_assertion_names, item);
+               }
+       }
+#endif
 
        /* set instance fields */
 
        o->classes  = classes;
        o->packages = packages;
+       o->classEnabled = classEnabled;
+       o->packageEnabled = packageEnabled;
 
        return (jobject) o;
 }
@@ -1584,9 +1827,11 @@ jobject JVM_AssertionStatusDirectives(JNIEnv *env, jclass unused)
 
 /* JVM_GetClassNameUTF */
 
-const charJVM_GetClassNameUTF(JNIEnv *env, jclass cls)
+const char *JVM_GetClassNameUTF(JNIEnv *env, jclass cls)
 {
        log_println("JVM_GetClassNameUTF: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -1603,6 +1848,8 @@ void JVM_GetClassCPTypes(JNIEnv *env, jclass cls, unsigned char *types)
 jint JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cls)
 {
        log_println("JVM_GetClassCPEntriesCount: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -1611,6 +1858,8 @@ jint JVM_GetClassCPEntriesCount(JNIEnv *env, jclass cls)
 jint JVM_GetClassFieldsCount(JNIEnv *env, jclass cls)
 {
        log_println("JVM_GetClassFieldsCount: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -1619,6 +1868,8 @@ jint JVM_GetClassFieldsCount(JNIEnv *env, jclass cls)
 jint JVM_GetClassMethodsCount(JNIEnv *env, jclass cls)
 {
        log_println("JVM_GetClassMethodsCount: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -1635,6 +1886,8 @@ void JVM_GetMethodIxExceptionIndexes(JNIEnv *env, jclass cls, jint method_index,
 jint JVM_GetMethodIxExceptionsCount(JNIEnv *env, jclass cls, jint method_index)
 {
        log_println("JVM_GetMethodIxExceptionsCount: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -1651,6 +1904,8 @@ void JVM_GetMethodIxByteCode(JNIEnv *env, jclass cls, jint method_index, unsigne
 jint JVM_GetMethodIxByteCodeLength(JNIEnv *env, jclass cls, jint method_index)
 {
        log_println("JVM_GetMethodIxByteCodeLength: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -1667,6 +1922,8 @@ void JVM_GetMethodIxExceptionTableEntry(JNIEnv *env, jclass cls, jint method_ind
 jint JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cls, int method_index)
 {
        log_println("JVM_GetMethodIxExceptionTableLength: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -1675,6 +1932,8 @@ jint JVM_GetMethodIxExceptionTableLength(JNIEnv *env, jclass cls, int method_ind
 jint JVM_GetMethodIxModifiers(JNIEnv *env, jclass cls, int method_index)
 {
        log_println("JVM_GetMethodIxModifiers: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -1683,6 +1942,8 @@ jint JVM_GetMethodIxModifiers(JNIEnv *env, jclass cls, int method_index)
 jint JVM_GetFieldIxModifiers(JNIEnv *env, jclass cls, int field_index)
 {
        log_println("JVM_GetFieldIxModifiers: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -1691,6 +1952,8 @@ jint JVM_GetFieldIxModifiers(JNIEnv *env, jclass cls, int field_index)
 jint JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cls, int method_index)
 {
        log_println("JVM_GetMethodIxLocalsCount: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -1699,6 +1962,8 @@ jint JVM_GetMethodIxLocalsCount(JNIEnv *env, jclass cls, int method_index)
 jint JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cls, int method_index)
 {
        log_println("JVM_GetMethodIxArgsSize: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -1707,6 +1972,8 @@ jint JVM_GetMethodIxArgsSize(JNIEnv *env, jclass cls, int method_index)
 jint JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cls, int method_index)
 {
        log_println("JVM_GetMethodIxMaxStack: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -1715,78 +1982,98 @@ jint JVM_GetMethodIxMaxStack(JNIEnv *env, jclass cls, int method_index)
 jboolean JVM_IsConstructorIx(JNIEnv *env, jclass cls, int method_index)
 {
        log_println("JVM_IsConstructorIx: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
 /* JVM_GetMethodIxNameUTF */
 
-const charJVM_GetMethodIxNameUTF(JNIEnv *env, jclass cls, jint method_index)
+const char *JVM_GetMethodIxNameUTF(JNIEnv *env, jclass cls, jint method_index)
 {
        log_println("JVM_GetMethodIxNameUTF: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
 /* JVM_GetMethodIxSignatureUTF */
 
-const charJVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cls, jint method_index)
+const char *JVM_GetMethodIxSignatureUTF(JNIEnv *env, jclass cls, jint method_index)
 {
        log_println("JVM_GetMethodIxSignatureUTF: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
 /* JVM_GetCPFieldNameUTF */
 
-const charJVM_GetCPFieldNameUTF(JNIEnv *env, jclass cls, jint cp_index)
+const char *JVM_GetCPFieldNameUTF(JNIEnv *env, jclass cls, jint cp_index)
 {
        log_println("JVM_GetCPFieldNameUTF: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
 /* JVM_GetCPMethodNameUTF */
 
-const charJVM_GetCPMethodNameUTF(JNIEnv *env, jclass cls, jint cp_index)
+const char *JVM_GetCPMethodNameUTF(JNIEnv *env, jclass cls, jint cp_index)
 {
        log_println("JVM_GetCPMethodNameUTF: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
 /* JVM_GetCPMethodSignatureUTF */
 
-const charJVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cls, jint cp_index)
+const char *JVM_GetCPMethodSignatureUTF(JNIEnv *env, jclass cls, jint cp_index)
 {
        log_println("JVM_GetCPMethodSignatureUTF: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
 /* JVM_GetCPFieldSignatureUTF */
 
-const charJVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cls, jint cp_index)
+const char *JVM_GetCPFieldSignatureUTF(JNIEnv *env, jclass cls, jint cp_index)
 {
        log_println("JVM_GetCPFieldSignatureUTF: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
 /* JVM_GetCPClassNameUTF */
 
-const charJVM_GetCPClassNameUTF(JNIEnv *env, jclass cls, jint cp_index)
+const char *JVM_GetCPClassNameUTF(JNIEnv *env, jclass cls, jint cp_index)
 {
        log_println("JVM_GetCPClassNameUTF: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
 /* JVM_GetCPFieldClassNameUTF */
 
-const charJVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cls, jint cp_index)
+const char *JVM_GetCPFieldClassNameUTF(JNIEnv *env, jclass cls, jint cp_index)
 {
        log_println("JVM_GetCPFieldClassNameUTF: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
 /* JVM_GetCPMethodClassNameUTF */
 
-const charJVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cls, jint cp_index)
+const char *JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cls, jint cp_index)
 {
        log_println("JVM_GetCPMethodClassNameUTF: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -1795,6 +2082,8 @@ const char* JVM_GetCPMethodClassNameUTF(JNIEnv *env, jclass cls, jint cp_index)
 jint JVM_GetCPFieldModifiers(JNIEnv *env, jclass cls, int cp_index, jclass called_cls)
 {
        log_println("JVM_GetCPFieldModifiers: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -1803,6 +2092,8 @@ jint JVM_GetCPFieldModifiers(JNIEnv *env, jclass cls, int cp_index, jclass calle
 jint JVM_GetCPMethodModifiers(JNIEnv *env, jclass cls, int cp_index, jclass called_cls)
 {
        log_println("JVM_GetCPMethodModifiers: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -1819,30 +2110,35 @@ void JVM_ReleaseUTF(const char *utf)
 jboolean JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2)
 {
        log_println("JVM_IsSameClassPackage: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
 /* JVM_Open */
 
+/* Taken from: hotspot/src/share/vm/prims/jvm.h */
+
+/*
+ * JVM I/O error codes
+ */
+#define JVM_EEXIST       -100
+
 jint JVM_Open(const char *fname, jint flags, jint mode)
 {
        int result;
 
-#if PRINTJVM
-       log_println("JVM_Open: fname=%s, flags=%d, mode=%d", fname, flags, mode);
-#endif
+       TRACEJVMCALLS("JVM_Open(fname=%s, flags=%d, mode=%d)", fname, flags, mode);
 
-       result = open(fname, flags, mode);
+       result = system_open(fname, flags, mode);
 
        if (result >= 0) {
                return result;
        }
        else {
-               switch(errno) {
+               switch (errno) {
                case EEXIST:
-                       /* XXX don't know what to do here */
-/*                     return JVM_EEXIST; */
-                       return -1;
+                       return JVM_EEXIST;
                default:
                        return -1;
                }
@@ -1854,10 +2150,9 @@ jint JVM_Open(const char *fname, jint flags, jint mode)
 
 jint JVM_Close(jint fd)
 {
-#if PRINTJVM
-       log_println("JVM_Close: fd=%d", fd);
-#endif
-       return close(fd);
+       TRACEJVMCALLS("JVM_Close(fd=%d)", fd);
+
+       return system_close(fd);
 }
 
 
@@ -1865,10 +2160,9 @@ jint JVM_Close(jint fd)
 
 jint JVM_Read(jint fd, char *buf, jint nbytes)
 {
-#if PRINTJVM
-       log_println("JVM_Read: fd=%d, buf=%p, nbytes=%d", fd, buf, nbytes);
-#endif
-       return read(fd, buf, nbytes);
+       TRACEJVMCALLS("JVM_Read(fd=%d, buf=%p, nbytes=%d)", fd, buf, nbytes);
+
+       return system_read(fd, buf, nbytes);
 }
 
 
@@ -1876,10 +2170,9 @@ jint JVM_Read(jint fd, char *buf, jint nbytes)
 
 jint JVM_Write(jint fd, char *buf, jint nbytes)
 {
-#if PRINTJVM
-       log_println("JVM_Write: fd=%d, buf=%s, nbytes=%d", fd, buf, nbytes);
-#endif
-       return write(fd, buf, nbytes);
+       TRACEJVMCALLS("JVM_Write(fd=%d, buf=%s, nbytes=%d)", fd, buf, nbytes);
+
+       return system_write(fd, buf, nbytes);
 }
 
 
@@ -1889,12 +2182,15 @@ jint JVM_Available(jint fd, jlong *pbytes)
 {
 #if defined(FIONREAD)
        int bytes;
+       int result;
 
        TRACEJVMCALLS("JVM_Available(fd=%d, pbytes=%p)", fd, pbytes);
 
        *pbytes = 0;
 
-       if (ioctl(fd, FIONREAD, &bytes) < 0)
+       result = ioctl(fd, FIONREAD, &bytes);
+
+       if (result < 0)
                return 0;
 
        *pbytes = bytes;
@@ -1910,10 +2206,9 @@ jint JVM_Available(jint fd, jlong *pbytes)
 
 jlong JVM_Lseek(jint fd, jlong offset, jint whence)
 {
-#if PRINTJVM
-       log_println("JVM_Lseek: fd=%d, offset=%ld, whence=%d", fd, offset, whence);
-#endif
-       return (jlong) lseek(fd, (off_t) offset, whence);
+       TRACEJVMCALLS("JVM_Lseek(fd=%d, offset=%ld, whence=%d)", fd, offset, whence);
+
+       return (jlong) system_lseek(fd, (off_t) offset, whence);
 }
 
 
@@ -1921,7 +2216,9 @@ jlong JVM_Lseek(jint fd, jlong offset, jint whence)
 
 jint JVM_SetLength(jint fd, jlong length)
 {
-       log_println("JVM_SetLength: IMPLEMENT ME!");
+       TRACEJVMCALLS("JVM_SetLength(fd=%d, length=%ld)", length);
+
+       return system_ftruncate(fd, length);
 }
 
 
@@ -1929,7 +2226,9 @@ jint JVM_SetLength(jint fd, jlong length)
 
 jint JVM_Sync(jint fd)
 {
-       log_println("JVM_Sync: IMPLEMENT ME!");
+       TRACEJVMCALLS("JVM_Sync(fd=%d)", fd);
+
+       return system_fsync(fd);
 }
 
 
@@ -1937,9 +2236,8 @@ jint JVM_Sync(jint fd)
 
 void JVM_StartThread(JNIEnv* env, jobject jthread)
 {
-#if PRINTJVM
-       log_println("JVM_StartThread: jthread=%p", jthread);
-#endif
+       TRACEJVMCALLS("JVM_StartThread(env=%p, jthread=%p)", env, jthread);
+
        _Jv_java_lang_Thread_start((java_lang_Thread *) jthread, 0);
 }
 
@@ -1956,10 +2254,30 @@ void JVM_StopThread(JNIEnv* env, jobject jthread, jobject throwable)
 
 jboolean JVM_IsThreadAlive(JNIEnv* env, jobject jthread)
 {
-#if PRINTJVM
-       log_println("JVM_IsThreadAlive: jthread=%p", jthread);
-#endif
-       return _Jv_java_lang_Thread_isAlive((java_lang_Thread *) jthread);
+       threadobject *t;
+       bool          equal;
+       bool          result;
+
+       TRACEJVMCALLS("JVM_IsThreadAlive(env=%p, jthread=%p)", env, jthread);
+
+       /* XXX this is just a quick hack */
+
+       for (t = threads_list_first(); t != NULL; t = threads_list_next(t)) {
+               LLNI_equals(t->object, jthread, equal);
+
+               if (equal == true)
+                       break;
+       }
+
+       /* The threadobject is null when a thread is created in Java. The
+          priority is set later during startup. */
+
+       if (t == NULL)
+               return 0;
+
+       result = threads_thread_is_alive(t);
+
+       return result;
 }
 
 
@@ -1983,9 +2301,8 @@ void JVM_ResumeThread(JNIEnv* env, jobject jthread)
 
 void JVM_SetThreadPriority(JNIEnv* env, jobject jthread, jint prio)
 {
-#if PRINTJVM
-       log_println("JVM_SetThreadPriority: jthread=%p, prio=%d", jthread, prio);
-#endif
+       TRACEJVMCALLS("JVM_SetThreadPriority(env=%p, jthread=%p, prio=%d)", env, jthread, prio);
+
        _Jv_java_lang_Thread_setPriority((java_lang_Thread *) jthread, prio);
 }
 
@@ -2004,9 +2321,8 @@ void JVM_Yield(JNIEnv *env, jclass threadClass)
 
 void JVM_Sleep(JNIEnv* env, jclass threadClass, jlong millis)
 {
-#if PRINTJVM
-       log_println("JVM_Sleep: threadClass=%p, millis=%ld", threadClass, millis);
-#endif
+       TRACEJVMCALLS("JVM_Sleep(env=%p, threadClass=%p, millis=%ld)", env, threadClass, millis);
+
        _Jv_java_lang_Thread_sleep(millis);
 }
 
@@ -2015,9 +2331,8 @@ void JVM_Sleep(JNIEnv* env, jclass threadClass, jlong millis)
 
 jobject JVM_CurrentThread(JNIEnv* env, jclass threadClass)
 {
-#if PRINTJVM
-       log_println("JVM_CurrentThread: threadClass=%p", threadClass);
-#endif
+       TRACEJVMCALLSVERBOSE(("JVM_CurrentThread(env=%p, threadClass=%p)", env, threadClass));
+
        return (jobject) _Jv_java_lang_Thread_currentThread();
 }
 
@@ -2027,6 +2342,8 @@ jobject JVM_CurrentThread(JNIEnv* env, jclass threadClass)
 jint JVM_CountStackFrames(JNIEnv* env, jobject jthread)
 {
        log_println("JVM_CountStackFrames: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2042,10 +2359,10 @@ void JVM_Interrupt(JNIEnv* env, jobject jthread)
 
 jboolean JVM_IsInterrupted(JNIEnv* env, jobject jthread, jboolean clear_interrupted)
 {
-#if PRINTJVM
-       log_println("JVM_IsInterrupted: jthread=%p, clear_interrupted=%d", jthread, clear_interrupted);
-#endif
+       TRACEJVMCALLS("JVM_IsInterrupted(env=%p, jthread=%p, clear_interrupted=%d)", env, jthread, clear_interrupted);
+
        /* XXX do something with clear_interrupted */
+
        return _Jv_java_lang_Thread_isInterrupted((java_lang_Thread *) jthread);
 }
 
@@ -2054,7 +2371,21 @@ jboolean JVM_IsInterrupted(JNIEnv* env, jobject jthread, jboolean clear_interrup
 
 jboolean JVM_HoldsLock(JNIEnv* env, jclass threadClass, jobject obj)
 {
-       log_println("JVM_HoldsLock: IMPLEMENT ME!");
+       java_handle_t *h;
+       bool           result;
+
+       TRACEJVMCALLS("JVM_HoldsLock(env=%p, threadClass=%p, obj=%p)", env, threadClass, obj);
+
+       h = (java_handle_t *) obj;
+
+       if (h == NULL) {
+               exceptions_throw_nullpointerexception();
+               return JNI_FALSE;
+       }
+
+       result = lock_is_held_by_current_thread(h);
+
+       return result;
 }
 
 
@@ -2071,6 +2402,8 @@ void JVM_DumpAllStacks(JNIEnv* env, jclass unused)
 jclass JVM_CurrentLoadedClass(JNIEnv *env)
 {
        log_println("JVM_CurrentLoadedClass: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2082,6 +2415,8 @@ jobject JVM_CurrentClassLoader(JNIEnv *env)
           doPrivileged, return NULL */
 
        log_println("JVM_CurrentClassLoader: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2089,9 +2424,8 @@ jobject JVM_CurrentClassLoader(JNIEnv *env)
 
 jobjectArray JVM_GetClassContext(JNIEnv *env)
 {
-#if PRINTJVM
-       log_println("JVM_GetClassContext");
-#endif
+       TRACEJVMCALLS("JVM_GetClassContext(env=%p)", env);
+
        return (jobjectArray) stacktrace_getClassContext();
 }
 
@@ -2101,6 +2435,8 @@ jobjectArray JVM_GetClassContext(JNIEnv *env)
 jint JVM_ClassDepth(JNIEnv *env, jstring name)
 {
        log_println("JVM_ClassDepth: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2109,6 +2445,8 @@ jint JVM_ClassDepth(JNIEnv *env, jstring name)
 jint JVM_ClassLoaderDepth(JNIEnv *env)
 {
        log_println("JVM_ClassLoaderDepth: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2116,11 +2454,23 @@ jint JVM_ClassLoaderDepth(JNIEnv *env)
 
 jstring JVM_GetSystemPackage(JNIEnv *env, jstring name)
 {
-       log_println("JVM_GetSystemPackage(env=%p, name=%p)");
-       javastring_print((java_handle_t *) name);
-       printf("\n");
+       java_handle_t *s;
+       utf *u;
+       utf *result;
 
-       return NULL;
+       TRACEJVMCALLS("JVM_GetSystemPackage(env=%p, name=%p)", env, name);
+
+/*     s = package_find(name); */
+       u = javastring_toutf((java_handle_t *) name, false);
+
+       result = package_find(u);
+
+       if (result != NULL)
+               s = javastring_new(result);
+       else
+               s = NULL;
+
+       return (jstring) s;
 }
 
 
@@ -2129,6 +2479,8 @@ jstring JVM_GetSystemPackage(JNIEnv *env, jstring name)
 jobjectArray JVM_GetSystemPackages(JNIEnv *env)
 {
        log_println("JVM_GetSystemPackages: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2137,6 +2489,8 @@ jobjectArray JVM_GetSystemPackages(JNIEnv *env)
 jobject JVM_AllocateNewObject(JNIEnv *env, jobject receiver, jclass currClass, jclass initClass)
 {
        log_println("JVM_AllocateNewObject: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2145,6 +2499,8 @@ jobject JVM_AllocateNewObject(JNIEnv *env, jobject receiver, jclass currClass, j
 jobject JVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass, jint length)
 {
        log_println("JVM_AllocateNewArray: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2152,7 +2508,13 @@ jobject JVM_AllocateNewArray(JNIEnv *env, jobject obj, jclass currClass, jint le
 
 jobject JVM_LatestUserDefinedLoader(JNIEnv *env)
 {
-       log_println("JVM_LatestUserDefinedLoader: IMPLEMENT ME!");
+       classloader *cl;
+
+       TRACEJVMCALLS("JVM_LatestUserDefinedLoader(env=%p)", env);
+
+       cl = stacktrace_first_nonnull_classloader();
+
+       return (jobject) cl;
 }
 
 
@@ -2161,6 +2523,8 @@ jobject JVM_LatestUserDefinedLoader(JNIEnv *env)
 jclass JVM_LoadClass0(JNIEnv *env, jobject receiver, jclass currClass, jstring currClassName)
 {
        log_println("JVM_LoadClass0: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2204,7 +2568,13 @@ jobject JVM_GetArrayElement(JNIEnv *env, jobject arr, jint index)
 
 jvalue JVM_GetPrimitiveArrayElement(JNIEnv *env, jobject arr, jint index, jint wCode)
 {
+       jvalue jv;
+
        log_println("JVM_GetPrimitiveArrayElement: IMPLEMENT ME!");
+
+       jv.l = NULL;
+
+       return jv;
 }
 
 
@@ -2296,7 +2666,7 @@ jobject JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim)
 
        ia = (java_handle_intarray_t *) dim;
 
-       length = array_length_get(ia);
+       length = array_length_get((java_handle_t *) ia);
 
        dims = MNEW(long, length);
 
@@ -2315,7 +2685,7 @@ jobject JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim)
        if (ac == NULL)
                return NULL;
 
-       a = builtin_multianewarray(length, ac, dims);
+       a = builtin_multianewarray(length, (java_handle_t *) ac, dims);
 
        return (jobject) a;
 }
@@ -2326,6 +2696,8 @@ jobject JVM_NewMultiArray(JNIEnv *env, jclass eltClass, jintArray dim)
 jint JVM_InitializeSocketLibrary()
 {
        log_println("JVM_InitializeSocketLibrary: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2335,7 +2707,7 @@ jint JVM_Socket(jint domain, jint type, jint protocol)
 {
        TRACEJVMCALLS("JVM_Socket(domain=%d, type=%d, protocol=%d)", domain, type, protocol);
 
-       return socket(domain, type, protocol);
+       return system_socket(domain, type, protocol);
 }
 
 
@@ -2345,7 +2717,7 @@ jint JVM_SocketClose(jint fd)
 {
        TRACEJVMCALLS("JVM_SocketClose(fd=%d)", fd);
 
-       return close(fd);
+       return system_close(fd);
 }
 
 
@@ -2355,7 +2727,7 @@ jint JVM_SocketShutdown(jint fd, jint howto)
 {
        TRACEJVMCALLS("JVM_SocketShutdown(fd=%d, howto=%d)", fd, howto);
 
-       return shutdown(fd, howto);
+       return system_shutdown(fd, howto);
 }
 
 
@@ -2364,6 +2736,8 @@ jint JVM_SocketShutdown(jint fd, jint howto)
 jint JVM_Recv(jint fd, char *buf, jint nBytes, jint flags)
 {
        log_println("JVM_Recv: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2372,6 +2746,8 @@ jint JVM_Recv(jint fd, char *buf, jint nBytes, jint flags)
 jint JVM_Send(jint fd, char *buf, jint nBytes, jint flags)
 {
        log_println("JVM_Send: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2380,6 +2756,8 @@ jint JVM_Send(jint fd, char *buf, jint nBytes, jint flags)
 jint JVM_Timeout(int fd, long timeout)
 {
        log_println("JVM_Timeout: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2389,7 +2767,7 @@ jint JVM_Listen(jint fd, jint count)
 {
        TRACEJVMCALLS("JVM_Listen(fd=%d, count=%d)", fd, count);
 
-       return listen(fd, count);
+       return system_listen(fd, count);
 }
 
 
@@ -2399,7 +2777,7 @@ jint JVM_Connect(jint fd, struct sockaddr *him, jint len)
 {
        TRACEJVMCALLS("JVM_Connect(fd=%d, him=%p, len=%d)", fd, him, len);
 
-       return connect(fd, him, len);
+       return system_connect(fd, him, len);
 }
 
 
@@ -2408,6 +2786,8 @@ jint JVM_Connect(jint fd, struct sockaddr *him, jint len)
 jint JVM_Bind(jint fd, struct sockaddr *him, jint len)
 {
        log_println("JVM_Bind: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2417,7 +2797,7 @@ jint JVM_Accept(jint fd, struct sockaddr *him, jint *len)
 {
        TRACEJVMCALLS("JVM_Accept(fd=%d, him=%p, len=%p)", fd, him, len);
 
-       return accept(fd, him, (socklen_t *) len);
+       return system_accept(fd, him, (socklen_t *) len);
 }
 
 
@@ -2426,6 +2806,8 @@ jint JVM_Accept(jint fd, struct sockaddr *him, jint *len)
 jint JVM_RecvFrom(jint fd, char *buf, int nBytes, int flags, struct sockaddr *from, int *fromlen)
 {
        log_println("JVM_RecvFrom: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2435,7 +2817,7 @@ jint JVM_GetSockName(jint fd, struct sockaddr *him, int *len)
 {
        TRACEJVMCALLS("JVM_GetSockName(fd=%d, him=%p, len=%p)", fd, him, len);
 
-       return getsockname(fd, him, (socklen_t *) len);
+       return system_getsockname(fd, him, (socklen_t *) len);
 }
 
 
@@ -2444,6 +2826,8 @@ jint JVM_GetSockName(jint fd, struct sockaddr *him, int *len)
 jint JVM_SendTo(jint fd, char *buf, int len, int flags, struct sockaddr *to, int tolen)
 {
        log_println("JVM_SendTo: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2451,7 +2835,25 @@ jint JVM_SendTo(jint fd, char *buf, int len, int flags, struct sockaddr *to, int
 
 jint JVM_SocketAvailable(jint fd, jint *pbytes)
 {
-       log_println("JVM_SocketAvailable: IMPLEMENT ME!");
+#if defined(FIONREAD)
+       int bytes;
+       int result;
+
+       TRACEJVMCALLS("JVM_SocketAvailable(fd=%d, pbytes=%p)", fd, pbytes);
+
+       *pbytes = 0;
+
+       result = ioctl(fd, FIONREAD, &bytes);
+
+       if (result < 0)
+               return 0;
+
+       *pbytes = bytes;
+
+       return 1;
+#else
+# error FIONREAD not defined
+#endif
 }
 
 
@@ -2459,7 +2861,9 @@ jint JVM_SocketAvailable(jint fd, jint *pbytes)
 
 jint JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen)
 {
-       log_println("JVM_GetSockOpt: IMPLEMENT ME!");
+       TRACEJVMCALLS("JVM_GetSockOpt(fd=%d, level=%d, optname=%d, optval=%s, optlen=%p)", fd, level, optname, optval, optlen);
+
+       return system_getsockopt(fd, level, optname, optval, (socklen_t *) optlen);
 }
 
 
@@ -2469,41 +2873,47 @@ jint JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int opt
 {
        TRACEJVMCALLS("JVM_SetSockOpt(fd=%d, level=%d, optname=%d, optval=%s, optlen=%d)", fd, level, optname, optval, optlen);
 
-       return setsockopt(fd, level, optname, optval, optlen);
+       return system_setsockopt(fd, level, optname, optval, optlen);
 }
 
 
 /* JVM_GetHostName */
 
-int JVM_GetHostName(charname, int namelen)
+int JVM_GetHostName(char *name, int namelen)
 {
        TRACEJVMCALLS("JVM_GetHostName(name=%s, namelen=%d)", name, namelen);
 
-       return gethostname(name, namelen);
+       return system_gethostname(name, namelen);
 }
 
 
 /* JVM_GetHostByAddr */
 
-struct hostentJVM_GetHostByAddr(const char* name, int len, int type)
+struct hostent *JVM_GetHostByAddr(const char* name, int len, int type)
 {
        log_println("JVM_GetHostByAddr: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
 /* JVM_GetHostByName */
 
-struct hostentJVM_GetHostByName(char* name)
+struct hostent *JVM_GetHostByName(char* name)
 {
        log_println("JVM_GetHostByName: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
 /* JVM_GetProtoByName */
 
-struct protoentJVM_GetProtoByName(char* name)
+struct protoent *JVM_GetProtoByName(char* name)
 {
        log_println("JVM_GetProtoByName: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2525,7 +2935,9 @@ void *JVM_LoadLibrary(const char *name)
 
 void JVM_UnloadLibrary(void* handle)
 {
-       log_println("JVM_UnloadLibrary: IMPLEMENT ME!");
+       TRACEJVMCALLS("JVM_UnloadLibrary(handle=%p)", handle);
+
+       native_library_close(handle);
 }
 
 
@@ -2548,6 +2960,8 @@ void *JVM_FindLibraryEntry(void *handle, const char *name)
 jboolean JVM_IsNaN(jdouble a)
 {
        log_println("JVM_IsNaN: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2557,15 +2971,7 @@ jboolean JVM_IsSupportedJNIVersion(jint version)
 {
        TRACEJVMCALLS("JVM_IsSupportedJNIVersion(version=%d)", version);
 
-       switch (version) {
-       case JNI_VERSION_1_1:
-       case JNI_VERSION_1_2:
-       case JNI_VERSION_1_4:
-       case JNI_VERSION_1_6:
-               return true;
-       default:
-               return false;
-       }
+       return jni_version_check(version);
 }
 
 
@@ -2585,9 +2991,7 @@ JNIEXPORT void* JNICALL JVM_RawMonitorCreate(void)
 {
        java_object_t *o;
 
-#if PRINTJVM
-       log_println("JVM_RawMonitorCreate");
-#endif
+       TRACEJVMCALLS("JVM_RawMonitorCreate()");
 
        o = NEW(java_object_t);
 
@@ -2601,9 +3005,8 @@ JNIEXPORT void* JNICALL JVM_RawMonitorCreate(void)
 
 JNIEXPORT void JNICALL JVM_RawMonitorDestroy(void *mon)
 {
-#if PRINTJVM
-       log_println("JVM_RawMonitorDestroy: mon=%p", mon);
-#endif
+       TRACEJVMCALLS("JVM_RawMonitorDestroy(mon=%p)", mon);
+
        FREE(mon, java_object_t);
 }
 
@@ -2612,9 +3015,8 @@ JNIEXPORT void JNICALL JVM_RawMonitorDestroy(void *mon)
 
 JNIEXPORT jint JNICALL JVM_RawMonitorEnter(void *mon)
 {
-#if PRINTJVM
-       log_println("JVM_RawMonitorEnter: mon=%p", mon);
-#endif
+       TRACEJVMCALLS("JVM_RawMonitorEnter(mon=%p)", mon);
+
        (void) lock_monitor_enter((java_object_t *) mon);
 
        return 0;
@@ -2625,9 +3027,8 @@ JNIEXPORT jint JNICALL JVM_RawMonitorEnter(void *mon)
 
 JNIEXPORT void JNICALL JVM_RawMonitorExit(void *mon)
 {
-#if PRINTJVM
-       log_println("JVM_RawMonitorExit: mon=%p", mon);
-#endif
+       TRACEJVMCALLS("JVM_RawMonitorExit(mon=%p)", mon);
+
        (void) lock_monitor_exit((java_object_t *) mon);
 }
 
@@ -2653,6 +3054,8 @@ void JVM_GetPrimitiveFieldValues(JNIEnv *env, jclass cb, jobject obj, jlongArray
 jboolean JVM_AccessVMBooleanFlag(const char* name, jboolean* value, jboolean is_get)
 {
        log_println("JVM_AccessVMBooleanFlag: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2661,6 +3064,8 @@ jboolean JVM_AccessVMBooleanFlag(const char* name, jboolean* value, jboolean is_
 jboolean JVM_AccessVMIntFlag(const char* name, jint* value, jboolean is_get)
 {
        log_println("JVM_AccessVMIntFlag: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2677,6 +3082,8 @@ void JVM_VMBreakPoint(JNIEnv *env, jobject obj)
 jobjectArray JVM_GetClassFields(JNIEnv *env, jclass cls, jint which)
 {
        log_println("JVM_GetClassFields: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2685,6 +3092,8 @@ jobjectArray JVM_GetClassFields(JNIEnv *env, jclass cls, jint which)
 jobjectArray JVM_GetClassMethods(JNIEnv *env, jclass cls, jint which)
 {
        log_println("JVM_GetClassMethods: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2693,6 +3102,8 @@ jobjectArray JVM_GetClassMethods(JNIEnv *env, jclass cls, jint which)
 jobjectArray JVM_GetClassConstructors(JNIEnv *env, jclass cls, jint which)
 {
        log_println("JVM_GetClassConstructors: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2701,6 +3112,8 @@ jobjectArray JVM_GetClassConstructors(JNIEnv *env, jclass cls, jint which)
 jobject JVM_GetClassField(JNIEnv *env, jclass cls, jstring name, jint which)
 {
        log_println("JVM_GetClassField: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2709,6 +3122,8 @@ jobject JVM_GetClassField(JNIEnv *env, jclass cls, jstring name, jint which)
 jobject JVM_GetClassMethod(JNIEnv *env, jclass cls, jstring name, jobjectArray types, jint which)
 {
        log_println("JVM_GetClassMethod: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2717,6 +3132,8 @@ jobject JVM_GetClassMethod(JNIEnv *env, jclass cls, jstring name, jobjectArray t
 jobject JVM_GetClassConstructor(JNIEnv *env, jclass cls, jobjectArray types, jint which)
 {
        log_println("JVM_GetClassConstructor: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2725,6 +3142,8 @@ jobject JVM_GetClassConstructor(JNIEnv *env, jclass cls, jobjectArray types, jin
 jobject JVM_NewInstance(JNIEnv *env, jclass cls)
 {
        log_println("JVM_NewInstance: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2733,6 +3152,8 @@ jobject JVM_NewInstance(JNIEnv *env, jclass cls)
 jobject JVM_GetField(JNIEnv *env, jobject field, jobject obj)
 {
        log_println("JVM_GetField: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2740,7 +3161,13 @@ jobject JVM_GetField(JNIEnv *env, jobject field, jobject obj)
 
 jvalue JVM_GetPrimitiveField(JNIEnv *env, jobject field, jobject obj, unsigned char wCode)
 {
+       jvalue jv;
+
        log_println("JVM_GetPrimitiveField: IMPLEMENT ME!");
+
+       jv.l = NULL;
+
+       return jv;
 }
 
 
@@ -2764,9 +3191,8 @@ void JVM_SetPrimitiveField(JNIEnv *env, jobject field, jobject obj, jvalue v, un
 
 jobject JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray args0)
 {
-#if PRINTJVM
-       log_println("JVM_InvokeMethod: method=%p, obj=%p, args0=%p", method, obj, args0);
-#endif
+       TRACEJVMCALLS("JVM_InvokeMethod(env=%p, method=%p, obj=%p, args0=%p)", env, method, obj, args0);
+
        return (jobject) _Jv_java_lang_reflect_Method_invoke((java_lang_reflect_Method *) method, (java_lang_Object *) obj, (java_handle_objectarray_t *) args0);
 }
 
@@ -2775,9 +3201,8 @@ jobject JVM_InvokeMethod(JNIEnv *env, jobject method, jobject obj, jobjectArray
 
 jobject JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args0)
 {
-#if PRINTJVM
-       log_println("JVM_NewInstanceFromConstructor: c=%p, args0=%p", c, args0);
-#endif
+       TRACEJVMCALLS("JVM_NewInstanceFromConstructor(env=%p, c=%p, args0=%p)", env, c, args0);
+
        return (jobject) _Jv_java_lang_reflect_Constructor_newInstance(env, (java_lang_reflect_Constructor *) c, (java_handle_objectarray_t *) args0);
 }
 
@@ -2786,10 +3211,11 @@ jobject JVM_NewInstanceFromConstructor(JNIEnv *env, jobject c, jobjectArray args
 
 jboolean JVM_SupportsCX8()
 {
-#if PRINTJVM
-       log_println("JVM_SupportsCX8");
-#endif
-       return _Jv_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8(NULL, NULL);
+       TRACEJVMCALLS("JVM_SupportsCX8()");
+
+       /* IMPLEMENT ME */
+
+       return 0;
 }
 
 
@@ -2798,6 +3224,8 @@ jboolean JVM_SupportsCX8()
 jboolean JVM_CX8Field(JNIEnv *env, jobject obj, jfieldID fid, jlong oldVal, jlong newVal)
 {
        log_println("JVM_CX8Field: IMPLEMENT ME!");
+
+       return 0;
 }
 
 
@@ -2806,6 +3234,8 @@ jboolean JVM_CX8Field(JNIEnv *env, jobject obj, jfieldID fid, jlong oldVal, jlon
 jobjectArray JVM_GetAllThreads(JNIEnv *env, jclass dummy)
 {
        log_println("JVM_GetAllThreads: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2814,14 +3244,20 @@ jobjectArray JVM_GetAllThreads(JNIEnv *env, jclass dummy)
 jobjectArray JVM_DumpThreads(JNIEnv *env, jclass threadClass, jobjectArray threads)
 {
        log_println("JVM_DumpThreads: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
 /* JVM_GetManagement */
 
-voidJVM_GetManagement(jint version)
+void *JVM_GetManagement(jint version)
 {
-       log_println("JVM_GetManagement: IMPLEMENT ME!");
+       TRACEJVMCALLS("JVM_GetManagement(version=%d)", version);
+
+       /* TODO We current don't support the management interface. */
+
+       return NULL;
 }
 
 
@@ -2830,6 +3266,8 @@ void* JVM_GetManagement(jint version)
 jobject JVM_InitAgentProperties(JNIEnv *env, jobject properties)
 {
        log_println("JVM_InitAgentProperties: IMPLEMENT ME!");
+
+       return NULL;
 }
 
 
@@ -2837,7 +3275,32 @@ jobject JVM_InitAgentProperties(JNIEnv *env, jobject properties)
 
 jobjectArray JVM_GetEnclosingMethodInfo(JNIEnv *env, jclass ofClass)
 {
-       log_println("JVM_GetEnclosingMethodInfo: IMPLEMENT ME!");
+       classinfo                 *c;
+       methodinfo                *m;
+       java_handle_objectarray_t *oa;
+
+       TRACEJVMCALLS("JVM_GetEnclosingMethodInfo(env=%p, ofClass=%p)", env, ofClass);
+
+       c = LLNI_classinfo_unwrap(ofClass);
+
+       if ((c == NULL) || class_is_primitive(c))
+               return NULL;
+
+       m = class_get_enclosingmethod(c);
+
+       if (m == NULL)
+               return NULL;
+
+       oa = builtin_anewarray(3, class_java_lang_Object);
+
+       if (oa == NULL)
+               return NULL;
+
+       array_objectarray_element_set(oa, 0, (java_handle_t *) LLNI_classinfo_wrap(m->class));
+       array_objectarray_element_set(oa, 1, javastring_new(m->name));
+       array_objectarray_element_set(oa, 2, javastring_new(m->descriptor));
+
+       return (jobjectArray) oa;
 }
 
 
@@ -3110,6 +3573,7 @@ void *JVM_RegisterSignal(jint sig, void *handler)
 jboolean JVM_RaiseSignal(jint sig)
 {
        log_println("JVM_RaiseSignal: IMPLEMENT ME! sig=%s", sig);
+
        return false;
 }