- created jitcache-arm-x86 branch
[cacao.git] / src / vm / vm.c
index c77fea6e86819380f35a29c6ed340571e5337682..84a9a7351b553a4f3f67a16d78660fbf1f33d0ca 100644 (file)
@@ -49,7 +49,7 @@
 #include "native/include/java_lang_Object.h"             /* required by j.l.C */
 #include "native/include/java_lang_String.h"             /* required by j.l.C */
 
-#if defined(WITH_CLASSPATH_SUN)
+#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
 # include "native/include/java_nio_ByteBuffer.h"        /* required by j.l.CL */
 # include "native/include/java_lang_ClassLoader.h"       /* required by j.l.C */
 #endif
@@ -76,7 +76,7 @@
 #include "vm/finalizer.h"
 #include "vm/global.h"
 #include "vm/initialize.h"
-#include "vm/package.h"
+#include "vm/package.hpp"
 #include "vm/primitive.h"
 #include "vm/properties.h"
 #include "vm/signallocal.h"
@@ -86,6 +86,7 @@
 #include "vm/jit/argument.h"
 #include "vm/jit/asmpart.h"
 #include "vm/jit/code.h"
+#include "vm/jit/jitcache.h"
 
 #if defined(ENABLE_DISASSEMBLER)
 # include "vm/jit/disass.h"
@@ -638,12 +639,12 @@ static void vm_printconfig(void)
        /* When we're building with JRE-layout, the default paths are the
           same as the runtime paths. */
 #else
-# if defined(WITH_CLASSPATH_GNU)
-       puts("  gnu.classpath.boot.library.path: "CLASSPATH_LIBDIR);
-       puts("  java.boot.class.path           : "CACAO_VM_ZIP":"CLASSPATH_CLASSES"");
-# elif defined(WITH_CLASSPATH_SUN)
-       puts("  sun.boot.library.path          : "CLASSPATH_LIBDIR);
-       puts("  java.boot.class.path           : "CLASSPATH_CLASSES);
+# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
+       puts("  gnu.classpath.boot.library.path: "JAVA_RUNTIME_LIBRARY_LIBDIR);
+       puts("  java.boot.class.path           : "CACAO_VM_ZIP":"JAVA_RUNTIME_LIBRARY_CLASSES"");
+# elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+       puts("  sun.boot.library.path          : "JAVA_RUNTIME_LIBRARY_LIBDIR);
+       puts("  java.boot.class.path           : "JAVA_RUNTIME_LIBRARY_CLASSES);
 # endif
 #endif
 
@@ -654,9 +655,9 @@ static void vm_printconfig(void)
        printf("  initial heap size              : %d\n", opt_heapstartsize);
        printf("  stack size                     : %d\n", opt_stacksize);
 
-#if defined(WITH_CLASSPATH_GNU)
+#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
        printf("  gnu.classpath.boot.library.path: %s\n", properties_get("gnu.classpath.boot.library.path"));
-#elif defined(WITH_CLASSPATH_SUN)
+#elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
        printf("  sun.boot.library.path          : %s\n", properties_get("sun.boot.library.path"));
 #endif
 
@@ -1467,7 +1468,7 @@ bool vm_create(JavaVMInitArgs *vm_args)
 
        /* BEFORE: loader_preinit */
 
-       package_init();
+       Package_initialize();
 
        /* AFTER: utf8_init, classcache_init */
 
@@ -1639,9 +1640,8 @@ void vm_run(JavaVM *vm, JavaVMInitArgs *vm_args)
        int                        status;
        int                        i;
 
-#if defined(ENABLE_THREADS)
-       threadobject              *t;
-#endif
+       // Prevent compiler warnings.
+       oa = NULL;
 
 #if !defined(NDEBUG)
        if (compileall) {
@@ -1806,9 +1806,7 @@ void vm_run(JavaVM *vm, JavaVMInitArgs *vm_args)
     /* Detach the main thread so that it appears to have ended when
           the application's main method exits. */
 
-       t = thread_get_current();
-
-       if (!threads_detach_thread(t))
+       if (!thread_detach_current_thread())
                vm_abort("vm_run: Could not detach main thread.");
 #endif
 
@@ -1839,7 +1837,7 @@ int vm_destroy(JavaVM *vm)
        args.name  = "DestroyJavaVM";
        args.group = NULL;
 
-       if (!threads_attach_current_thread(&args, false))
+       if (!thread_attach_current_thread(&args, false))
                return 1;
 
        /* Wait until we are the last non-daemon thread. */
@@ -1940,6 +1938,10 @@ void vm_shutdown(s4 status)
        }       
 #endif
 
+#if defined (ENABLE_JITCACHE)
+       jitcache_quit();
+#endif
+
        exit(status);
 }