* src/vm/jit/trap.c: Moved to C++
[cacao.git] / src / vm / vm.cpp
index 5bdaf1ea5f04219e4fd1710939c33b83e73beb09..43fb31c9a402ac613579e143935f44c9c5dc6d4a 100644 (file)
 #include "vm/jit/abi-asm.h"
 
 #include "mm/codememory.h"
+#include "mm/dumpmemory.hpp"
 #include "mm/gc.hpp"
-#include "mm/memory.h"
+#include "mm/memory.hpp"
 
 #include "native/jni.hpp"
 #include "native/llni.h"
-#include "native/localref.h"
-#include "native/native.h"
+#include "native/localref.hpp"
+#include "native/native.hpp"
 
-#include "native/vm/nativevm.h"
+#include "native/vm/nativevm.hpp"
 
-#include "threads/lock-common.h"
-#include "threads/threadlist.h"
+#include "threads/lock.hpp"
 #include "threads/thread.hpp"
 
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
 
-#include "vm/array.h"
+#include "vm/array.hpp"
 
 #if defined(ENABLE_ASSERTION)
-#include "vm/assertion.h"
+#include "vm/assertion.hpp"
 #endif
 
-#include "vm/builtin.h"
-#include "vm/classcache.h"
+#include "vm/jit/builtin.hpp"
+#include "vm/classcache.hpp"
 #include "vm/exceptions.hpp"
-#include "vm/finalizer.h"
+#include "vm/finalizer.hpp"
 #include "vm/global.h"
 #include "vm/globals.hpp"
-#include "vm/initialize.h"
+#include "vm/initialize.hpp"
 #include "vm/options.h"
 #include "vm/os.hpp"
-#include "vm/package.hpp"
 #include "vm/primitive.hpp"
-#include "vm/properties.h"
-#include "vm/signallocal.h"
+#include "vm/properties.hpp"
+#include "vm/signallocal.hpp"
 #include "vm/statistics.h"
 #include "vm/string.hpp"
-#include "vm/suck.h"
+#include "vm/suck.hpp"
 #include "vm/vm.hpp"
 
-#include "vm/jit/argument.h"
+#include "vm/jit/argument.hpp"
 #include "vm/jit/asmpart.h"
-#include "vm/jit/code.h"
+#include "vm/jit/code.hpp"
 
 #if defined(ENABLE_DISASSEMBLER)
 # include "vm/jit/disass.h"
 #endif
 
-#include "vm/jit/jit.h"
+#include "vm/jit/jit.hpp"
 #include "vm/jit/methodtree.h"
 
 #if defined(ENABLE_PROFILING)
 # include "vm/jit/optimizing/profile.h"
 #endif
 
-#include "vm/jit/optimizing/recompile.h"
+#include "vm/jit/optimizing/recompiler.hpp"
 
 #if defined(ENABLE_PYTHON)
 # include "vm/jit/python.h"
 #endif
 
-#include "vm/jit/trap.h"
+#include "vm/jit/trap.hpp"
 
 #if defined(ENABLE_JVMTI)
 # include "native/jvmti/cacaodbg.h"
@@ -190,10 +189,11 @@ enum {
        OPT_MS,
        OPT_MX,
 
+       OPT_XCHECK_JNI,
+
        /* CACAO options */
 
        OPT_VERBOSE1,
-       OPT_NOIEEE,
 
 #if defined(ENABLE_STATISTICS)
        OPT_TIME,
@@ -214,6 +214,8 @@ enum {
 
 #if defined(ENABLE_VERIFIER)
        OPT_NOVERIFY,
+       OPT_XVERIFY_ALL,
+       OPT_XVERIFY_NONE,
 #if defined(TYPECHECK_VERBOSE)
        OPT_VERBOSETC,
 #endif
@@ -306,7 +308,8 @@ opt_struct opts[] = {
        { "noasyncgc",         false, OPT_IGNORE },
 #if defined(ENABLE_VERIFIER)
        { "noverify",          false, OPT_NOVERIFY },
-       { "Xverify:none",      false, OPT_NOVERIFY },
+       { "Xverify:all",       false, OPT_XVERIFY_ALL },
+       { "Xverify:none",      false, OPT_XVERIFY_NONE },
 #endif
        { "v",                 false, OPT_VERBOSE1 },
        { "verbose:",          true,  OPT_VERBOSE },
@@ -314,9 +317,6 @@ opt_struct opts[] = {
 #if defined(ENABLE_VERIFIER) && defined(TYPECHECK_VERBOSE)
        { "verbosetc",         false, OPT_VERBOSETC },
 #endif
-#if defined(__ALPHA__)
-       { "noieee",            false, OPT_NOIEEE },
-#endif
 #if defined(ENABLE_STATISTICS)
        { "time",              false, OPT_TIME },
        { "stat",              false, OPT_STAT },
@@ -381,6 +381,8 @@ opt_struct opts[] = {
        { "Xss",               true,  OPT_SS },
        { "ss",                true,  OPT_SS },
 
+       { "Xcheck:jni",        false, OPT_XCHECK_JNI },
+
 #if defined(ENABLE_PROFILING)
        { "Xprof:",            true,  OPT_PROF_OPTION },
        { "Xprof",             false, OPT_PROF },
@@ -509,9 +511,6 @@ static void XXusage(void)
 #ifdef TYPECHECK_VERBOSE
        puts("    -verbosetc               write debug messages while typechecking");
 #endif
-#if defined(__ALPHA__)
-       puts("    -noieee                  don't use ieee compliant arithmetic");
-#endif
 #if defined(ENABLE_VERIFIER)
        puts("    -noverify                don't verify classfiles");
 #endif
@@ -728,24 +727,17 @@ VM::VM(JavaVMInitArgs* vm_args)
        /* Install the exit handler. */
 
        if (atexit(vm_exit_handler))
-               VM::get_current()->abort("atexit failed: %s\n", strerror(errno));
+               os::abort("atexit failed: %s\n", strerror(errno));
 
        /* Set some options. */
 
        opt_version       = false;
        opt_exit          = false;
 
-       opt_noieee        = false;
-
        opt_heapmaxsize   = HEAP_MAXSIZE;
        opt_heapstartsize = HEAP_STARTSIZE;
        opt_stacksize     = STACK_SIZE;
 
-       /* Initialize the properties list before command-line handling.
-          Otherwise -XX:+PrintConfig crashes. */
-
-       properties_init();
-
        // First of all, parse the -XX options.
 
 #if defined(ENABLE_VMLOG)
@@ -765,7 +757,7 @@ VM::VM(JavaVMInitArgs* vm_args)
 
        /* We need to check if the actual size of a java.lang.Class object
           is smaller or equal than the assumption made in
-          src/vm/class.h. */
+          src/vm/class.hpp. */
 
 #warning FIXME We need to check the size of java.lang.Class!!!
 //     if (sizeof(java_lang_Class) > sizeof(dummy_java_lang_Class))
@@ -780,10 +772,6 @@ VM::VM(JavaVMInitArgs* vm_args)
        jvmti = false;
 #endif
 
-       /* Fill the properties before command-line handling. */
-
-       properties_set();
-
        /* iterate over all passed options */
 
        while ((opt = options_get(opts, vm_args)) != OPT_DONE) {
@@ -818,14 +806,14 @@ VM::VM(JavaVMInitArgs* vm_args)
                           classpath. */
 
                        // FIXME Make class_path const char*.
-                       class_path = (char*) properties_get("java.class.path");
+                       class_path = (char*) _properties.get("java.class.path");
 
                        p = MNEW(char, strlen(opt_arg) + strlen("0"));
 
                        strcpy(p, opt_arg);
 
 #if defined(ENABLE_JAVASE)
-                       properties_add("java.class.path", p);
+                       _properties.put("java.class.path", p);
 #endif
 
                        MFREE(class_path, char, strlen(class_path));
@@ -835,14 +823,14 @@ VM::VM(JavaVMInitArgs* vm_args)
                        for (unsigned int i = 0; i < strlen(opt_arg); i++) {
                                if (opt_arg[i] == '=') {
                                        opt_arg[i] = '\0';
-                                       properties_add(opt_arg, opt_arg + i + 1);
+                                       _properties.put(opt_arg, opt_arg + i + 1);
                                        goto opt_d_done;
                                }
                        }
 
                        /* if no '=' is given, just create an empty property */
 
-                       properties_add(opt_arg, "");
+                       _properties.put(opt_arg, "");
 
                opt_d_done:
                        break;
@@ -852,14 +840,14 @@ VM::VM(JavaVMInitArgs* vm_args)
                           new boot classpath. */
 
                        // FIXME Make boot_class_path const char*.
-                       boot_class_path = (char*) properties_get("sun.boot.class.path");
+                       boot_class_path = (char*) _properties.get("sun.boot.class.path");
 
                        p = MNEW(char, strlen(opt_arg) + strlen("0"));
 
                        strcpy(p, opt_arg);
 
-                       properties_add("sun.boot.class.path", p);
-                       properties_add("java.boot.class.path", p);
+                       _properties.put("sun.boot.class.path", p);
+                       _properties.put("java.boot.class.path", p);
 
                        MFREE(boot_class_path, char, strlen(boot_class_path));
                        break;
@@ -868,7 +856,7 @@ VM::VM(JavaVMInitArgs* vm_args)
                        /* Append to bootclasspath. */
 
                        // FIXME Make boot_class_path const char*.
-                       boot_class_path = (char*) properties_get("sun.boot.class.path");
+                       boot_class_path = (char*) _properties.get("sun.boot.class.path");
 
                        len = strlen(boot_class_path);
 
@@ -882,15 +870,15 @@ VM::VM(JavaVMInitArgs* vm_args)
                        strcat(p, ":");
                        strcat(p, opt_arg);
 
-                       properties_add("sun.boot.class.path", p);
-                       properties_add("java.boot.class.path", p);
+                       _properties.put("sun.boot.class.path", p);
+                       _properties.put("java.boot.class.path", p);
                        break;
 
                case OPT_BOOTCLASSPATH_P:
                        /* Prepend to bootclasspath. */
 
                        // FIXME Make boot_class_path const char*.
-                       boot_class_path = (char*) properties_get("sun.boot.class.path");
+                       boot_class_path = (char*) _properties.get("sun.boot.class.path");
 
                        len = strlen(boot_class_path);
 
@@ -900,8 +888,8 @@ VM::VM(JavaVMInitArgs* vm_args)
                        strcat(p, ":");
                        strcat(p, boot_class_path);
 
-                       properties_add("sun.boot.class.path", p);
-                       properties_add("java.boot.class.path", p);
+                       _properties.put("sun.boot.class.path", p);
+                       _properties.put("java.boot.class.path", p);
 
                        MFREE(boot_class_path, char, len);
                        break;
@@ -911,7 +899,7 @@ VM::VM(JavaVMInitArgs* vm_args)
                           classes. */
 
                        // FIXME Make boot_class_path const char*.
-                       boot_class_path = (char*) properties_get("sun.boot.class.path");
+                       boot_class_path = (char*) _properties.get("sun.boot.class.path");
 
                        len =
                                strlen(CACAO_VM_ZIP) +
@@ -925,8 +913,8 @@ VM::VM(JavaVMInitArgs* vm_args)
                        strcat(p, ":");
                        strcat(p, opt_arg);
 
-                       properties_add("sun.boot.class.path", p);
-                       properties_add("java.boot.class.path", p);
+                       _properties.put("sun.boot.class.path", p);
+                       _properties.put("java.boot.class.path", p);
 
                        MFREE(boot_class_path, char, strlen(boot_class_path));
                        break;
@@ -995,6 +983,10 @@ VM::VM(JavaVMInitArgs* vm_args)
                        }
                        break;
 
+               case OPT_XCHECK_JNI:
+                       // HotSpot compatibility option.
+                       break;
+
                case OPT_VERBOSE1:
                        opt_verbose = true;
                        break;
@@ -1046,12 +1038,13 @@ VM::VM(JavaVMInitArgs* vm_args)
                        opt_version = true;
                        break;
 
-               case OPT_NOIEEE:
-                       opt_noieee = true;
+#if defined(ENABLE_VERIFIER)
+               case OPT_XVERIFY_ALL:
+                       opt_verify = true;
                        break;
 
-#if defined(ENABLE_VERIFIER)
                case OPT_NOVERIFY:
+               case OPT_XVERIFY_NONE:
                        opt_verify = false;
                        break;
 #endif
@@ -1346,10 +1339,6 @@ VM::VM(JavaVMInitArgs* vm_args)
        gc_init(opt_heapmaxsize, opt_heapstartsize);
 
 #if defined(ENABLE_THREADS)
-       /* BEFORE: threads_preinit */
-
-       threadlist_init();
-
        /* AFTER: gc_init */
 
        threads_preinit();
@@ -1359,7 +1348,7 @@ VM::VM(JavaVMInitArgs* vm_args)
        /* install architecture dependent signal handlers */
 
        if (!signal_init())
-               VM::get_current()->abort("vm_create: signal_init failed");
+               os::abort("vm_create: signal_init failed");
 
 #if defined(ENABLE_INTRP)
        /* Allocate main thread stack on the Java heap. */
@@ -1373,7 +1362,7 @@ VM::VM(JavaVMInitArgs* vm_args)
        /* AFTER: threads_preinit */
 
        if (!string_init())
-               VM::get_current()->abort("vm_create: string_init failed");
+               os::abort("vm_create: string_init failed");
 
        /* AFTER: threads_preinit */
 
@@ -1382,7 +1371,7 @@ VM::VM(JavaVMInitArgs* vm_args)
        /* AFTER: thread_preinit */
 
        if (!suck_init())
-               VM::get_current()->abort("vm_create: suck_init failed");
+               os::abort("vm_create: suck_init failed");
 
        suck_add_from_property("java.endorsed.dirs");
 
@@ -1397,14 +1386,14 @@ VM::VM(JavaVMInitArgs* vm_args)
        /* AFTER: utf8_init */
 
        // FIXME Make boot_class_path const char*.
-       boot_class_path = (char*) properties_get("sun.boot.class.path");
+       boot_class_path = (char*) _properties.get("sun.boot.class.path");
        suck_add(boot_class_path);
 
        /* initialize the classcache hashtable stuff: lock, hashtable
           (must be done _after_ threads_preinit) */
 
        if (!classcache_init())
-               VM::get_current()->abort("vm_create: classcache_init failed");
+               os::abort("vm_create: classcache_init failed");
 
        /* Initialize the code memory management. */
        /* AFTER: threads_preinit */
@@ -1415,7 +1404,7 @@ VM::VM(JavaVMInitArgs* vm_args)
           threads_preinit) */
 
        if (!finalizer_init())
-               VM::get_current()->abort("vm_create: finalizer_init failed");
+               os::abort("vm_create: finalizer_init failed");
 
        /* Initialize the JIT compiler. */
 
@@ -1427,10 +1416,6 @@ VM::VM(JavaVMInitArgs* vm_args)
        pythonpass_init();
 #endif
 
-       /* BEFORE: loader_preinit */
-
-       Package::initialize();
-
        /* AFTER: utf8_init, classcache_init */
 
        loader_preinit();
@@ -1451,13 +1436,7 @@ VM::VM(JavaVMInitArgs* vm_args)
 #endif
 
        if (!builtin_init())
-               VM::get_current()->abort("vm_create: builtin_init failed");
-
-       /* Initialize the native subsystem. */
-       /* BEFORE: threads_init */
-
-       if (!native_init())
-               VM::get_current()->abort("vm_create: native_init failed");
+               os::abort("vm_create: builtin_init failed");
 
        /* Register the native methods implemented in the VM. */
        /* BEFORE: threads_init */
@@ -1470,7 +1449,7 @@ VM::VM(JavaVMInitArgs* vm_args)
           (e.g. NewGlobalRef). */
 
        if (!jni_init())
-               VM::get_current()->abort("vm_create: jni_init failed");
+               os::abort("vm_create: jni_init failed");
 #endif
 
 #if defined(ENABLE_JNI) || defined(ENABLE_HANDLES)
@@ -1478,7 +1457,7 @@ VM::VM(JavaVMInitArgs* vm_args)
        /* BEFORE: threads_init */
 
        if (!localref_table_init())
-               VM::get_current()->abort("vm_create: localref_table_init failed");
+               os::abort("vm_create: localref_table_init failed");
 #endif
 
        /* Iinitialize some important system classes. */
@@ -1499,15 +1478,10 @@ VM::VM(JavaVMInitArgs* vm_args)
        /* initialize profiling */
 
        if (!profile_init())
-               VM::get_current()->abort("vm_create: profile_init failed");
+               os::abort("vm_create: profile_init failed");
 #endif
 
 #if defined(ENABLE_THREADS)
-       /* initialize recompilation */
-
-       if (!recompile_init())
-               VM::get_current()->abort("vm_create: recompile_init failed");
-
        /* start the signal handler thread */
 
 #if defined(__LINUX__)
@@ -1515,33 +1489,32 @@ VM::VM(JavaVMInitArgs* vm_args)
        if (threads_pthreads_implementation_nptl)
 #endif
                if (!signal_start_thread())
-                       VM::get_current()->abort("vm_create: signal_start_thread failed");
+                       os::abort("vm_create: signal_start_thread failed");
 
        /* finally, start the finalizer thread */
 
        if (!finalizer_start_thread())
-               VM::get_current()->abort("vm_create: finalizer_start_thread failed");
+               os::abort("vm_create: finalizer_start_thread failed");
 
 # if !defined(NDEBUG)
        /* start the memory profiling thread */
 
        if (opt_ProfileMemoryUsage || opt_ProfileGCMemoryUsage)
                if (!memory_start_thread())
-                       VM::get_current()->abort("vm_create: memory_start_thread failed");
+                       os::abort("vm_create: memory_start_thread failed");
 # endif
 
-       /* start the recompilation thread (must be done before the
-          profiling thread) */
-
-       if (!recompile_start_thread())
-               VM::get_current()->abort("vm_create: recompile_start_thread failed");
+       // Start the recompilation thread (must be done before the
+       // profiling thread).
+       // FIXME Only works for one recompiler.
+       _recompiler.start();
 
 # if defined(ENABLE_PROFILING)
        /* start the profile sampling thread */
 
 /*     if (opt_prof) */
 /*             if (!profile_start_thread()) */
-/*                     VM::get_current()->abort("vm_create: profile_start_thread failed"); */
+/*                     os::abort("vm_create: profile_start_thread failed"); */
 # endif
 #endif
 
@@ -1616,7 +1589,7 @@ void VM::print_build_time_config(void)
 /**
  * Print run-time VM configuration.
  */
-void VM::print_run_time_config(void)
+void VM::print_run_time_config()
 {
        puts("Run-time variables:\n");
        printf("  maximum heap size              : %d\n", opt_heapmaxsize);
@@ -1624,13 +1597,13 @@ void VM::print_run_time_config(void)
        printf("  stack size                     : %d\n", opt_stacksize);
 
 #if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
-       printf("  gnu.classpath.boot.library.path: %s\n", properties_get("gnu.classpath.boot.library.path"));
+       printf("  gnu.classpath.boot.library.path: %s\n", _properties.get("gnu.classpath.boot.library.path"));
 #elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
-       printf("  sun.boot.library.path          : %s\n", properties_get("sun.boot.library.path"));
+       printf("  sun.boot.library.path          : %s\n", _properties.get("sun.boot.library.path"));
 #endif
 
-       printf("  java.boot.class.path           : %s\n", properties_get("java.boot.class.path"));
-       printf("  java.class.path                : %s\n", properties_get("java.class.path"));
+       printf("  java.boot.class.path           : %s\n", _properties.get("java.boot.class.path"));
+       printf("  java.class.path                : %s\n", _properties.get("java.class.path"));
 
        puts("");
 }
@@ -1685,7 +1658,7 @@ void vm_run(JavaVM *vm, JavaVMInitArgs *vm_args)
                        strcpy(p, mainname);
 
 #if defined(ENABLE_JAVASE)
-                       properties_add("java.class.path", p);
+                       VM::get_current()->get_properties().put("java.class.path", p);
 #endif
                }
                else {
@@ -1825,7 +1798,7 @@ void vm_run(JavaVM *vm, JavaVMInitArgs *vm_args)
           the application's main method exits. */
 
        if (!thread_detach_current_thread())
-               VM::get_current()->abort("vm_run: Could not detach main thread.");
+               os::abort("vm_run: Could not detach main thread.");
 #endif
 
        /* Destroy the JavaVM. */
@@ -2023,78 +1996,6 @@ void vm_exit_handler(void)
 }
 
 
-/**
- * Prints an error message and aborts the VM.
- *
- * @param text Error message to print.
- */
-void VM::abort(const char* text, ...)
-{
-       va_list ap;
-
-       // Print the log message.
-       log_start();
-
-       va_start(ap, text);
-       log_vprint(text, ap);
-       va_end(ap);
-
-       log_finish();
-
-       // Print a backtrace.
-       os::print_backtrace();
-
-       // Now abort the VM.
-       os::abort();
-}
-
-
-/**
- * Prints an error message, appends ":" plus the strerror-message of
- * errnum and aborts the VM.
- *
- * @param errnum Error number.
- * @param text   Error message to print.
- */
-void VM::abort_errnum(int errnum, const char* text, ...)
-{
-       va_list ap;
-
-       // Print the log message.
-       log_start();
-
-       va_start(ap, text);
-       log_vprint(text, ap);
-       va_end(ap);
-
-       // Print the strerror-message of errnum.
-       log_print(": %s", os::strerror(errnum));
-
-       log_finish();
-
-       // Print a backtrace.
-       os::print_backtrace();
-
-       // Now abort the VM.
-       os::abort();
-}
-
-
-/**
- * Equal to VM::abort_errnum, but uses errno to get the error number.
- *
- * @param text Error message to print.
- */
-void VM::abort_errno(const char* text, ...)
-{
-       va_list ap;
-
-       va_start(ap, text);
-       abort_errnum(errno, text, ap);
-       va_end(ap);
-}
-
-
 /* vm_abort_disassemble ********************************************************
 
    Prints an error message, disassemble the given code range (if
@@ -2141,7 +2042,7 @@ void vm_abort_disassemble(void *pc, int count, const char *text, ...)
                pc = disassinstr((u1*) pc);
 #endif
 
-       VM::get_current()->abort("Aborting...");
+       os::abort("Aborting...");
 }
 
 
@@ -2382,7 +2283,7 @@ static void vm_compile_method(char* mainname)
        }
 
        if (m == NULL)
-               VM::get_current()->abort("vm_compile_method: java.lang.NoSuchMethodException: %s.%s",
+               os::abort("vm_compile_method: java.lang.NoSuchMethodException: %s.%s",
                                 opt_method, opt_signature ? opt_signature : "");
                
        jit_compile(m);
@@ -2484,19 +2385,18 @@ type vm_call_method##name##_valist(methodinfo *m, java_handle_t *o,     \
 {                                                                       \
        uint64_t *array;                                                    \
        type      value;                                                    \
-       int32_t   dumpmarker;                                               \
                                                                         \
        if (m->code == NULL)                                                \
                if (!jit_compile(m))                                            \
                        return 0;                                                   \
                                                                         \
        THREAD_NATIVEWORLD_EXIT;                                            \
-       DMARKER;                                                            \
+                                                                                                                                               \
+       DumpMemoryArea dma;                                                                                                     \
                                                                         \
        array = argument_vmarray_from_valist(m, o, ap);                     \
        value = vm_call##name##_array(m, array);                            \
                                                                         \
-       DRELEASE;                                                           \
        THREAD_NATIVEWORLD_ENTER;                                           \
                                                                         \
        return value;                                                       \
@@ -2522,19 +2422,18 @@ type vm_call_method##name##_jvalue(methodinfo *m, java_handle_t *o,     \
 {                                                                       \
        uint64_t *array;                                                    \
        type      value;                                                    \
-       int32_t   dumpmarker;                                               \
                                                                         \
        if (m->code == NULL)                                                \
                if (!jit_compile(m))                                            \
                        return 0;                                                   \
                                                                         \
        THREAD_NATIVEWORLD_EXIT;                                            \
-       DMARKER;                                                            \
+                                                                                                                                               \
+       DumpMemoryArea dma;                                                                                                     \
                                                                         \
        array = argument_vmarray_from_jvalue(m, o, args);                   \
        value = vm_call##name##_array(m, array);                            \
                                                                         \
-       DRELEASE;                                                           \
        THREAD_NATIVEWORLD_ENTER;                                           \
                                                                         \
        return value;                                                       \
@@ -2561,7 +2460,6 @@ java_handle_t *vm_call_method_objectarray(methodinfo *m, java_handle_t *o,
        java_handle_t *xptr;
        java_handle_t *ro;
        imm_union      value;
-       int32_t        dumpmarker;
 
        /* Prevent compiler warnings. */
 
@@ -2577,19 +2475,14 @@ java_handle_t *vm_call_method_objectarray(methodinfo *m, java_handle_t *o,
 
        THREAD_NATIVEWORLD_EXIT;
 
-       /* mark start of dump memory area */
-
-       DMARKER;
+       // Create new dump memory area.
+       DumpMemoryArea dma;
 
        /* Fill the argument array from a object-array. */
 
        array = argument_vmarray_from_objectarray(m, o, params);
 
        if (array == NULL) {
-               /* release dump area */
-
-               DRELEASE;
-
                /* enter the nativeworld again */
 
                THREAD_NATIVEWORLD_ENTER;
@@ -2629,13 +2522,9 @@ java_handle_t *vm_call_method_objectarray(methodinfo *m, java_handle_t *o,
                break;
 
        default:
-               VM::get_current()->abort("vm_call_method_objectarray: invalid return type %d", m->parseddesc->returntype.primitivetype);
+               os::abort("vm_call_method_objectarray: invalid return type %d", m->parseddesc->returntype.primitivetype);
        }
 
-       /* release dump area */
-
-       DRELEASE;
-
        /* enter the nativeworld again */
 
        THREAD_NATIVEWORLD_ENTER;
@@ -2676,7 +2565,7 @@ void vm_abort(const char* text, ...)
        va_list ap;
 
        va_start(ap, text);
-       VM::get_current()->abort(text, ap);
+       os::abort(text, ap);
        va_end(ap);
 }
 
@@ -2685,7 +2574,7 @@ void vm_abort_errnum(int errnum, const char* text, ...)
        va_list ap;
 
        va_start(ap, text);
-       VM::get_current()->abort_errnum(errnum, text, ap);
+       os::abort_errnum(errnum, text, ap);
        va_end(ap);
 }
 
@@ -2694,7 +2583,7 @@ void vm_abort_errno(const char* text, ...)
        va_list ap;
 
        va_start(ap, text);
-       VM::get_current()->abort_errno(text, ap);
+       os::abort_errno(text, ap);
        va_end(ap);
 }