This commit introduces C++ support.
[cacao.git] / src / vm / vm.c
index 0a6536aa96fb9ea7d097edc6618e7782c5c589eb..5fa1f57a1db303de45b7fe3d55459255e5654268 100644 (file)
@@ -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"
@@ -1467,7 +1467,7 @@ bool vm_create(JavaVMInitArgs *vm_args)
 
        /* BEFORE: loader_preinit */
 
-       package_init();
+       Package_initialize();
 
        /* AFTER: utf8_init, classcache_init */
 
@@ -1639,9 +1639,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 +1805,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 +1836,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. */