#include "vm/jit/stacktrace.hpp"
-#include "vm/global.h" /* required here for native includes */
-#include "native/jni.h"
#include "native/llni.h"
-#include "native/include/java_lang_Object.h"
-#include "native/include/java_lang_Throwable.h"
-
-#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
-# include "native/include/gnu_classpath_Pointer.h"
-# include "native/include/java_lang_VMThrowable.h"
-#endif
-
-#include "threads/thread.h"
+#include "threads/thread.hpp"
#include "toolbox/logging.h"
#include "vm/array.h"
-#include "vm/builtin.h"
+#include "vm/jit/builtin.hpp"
+#include "vm/class.h"
#include "vm/cycles-stats.h"
-#include "vm/exceptions.h"
-#include "vm/stringlocal.h"
+#include "vm/exceptions.hpp"
+#include "vm/globals.hpp"
+#include "vm/javaobjects.hpp"
+#include "vm/loader.hpp"
+#include "vm/method.h"
+#include "vm/options.h"
+#include "vm/string.hpp"
#include "vm/vm.hpp"
#include "vm/jit/asmpart.h"
-#include "vm/jit/codegen-common.h"
+#include "vm/jit/codegen-common.hpp"
#include "vm/jit/linenumbertable.h"
#include "vm/jit/methodheader.h"
#include "vm/jit/methodtree.h"
-#include "vmcore/class.h"
-#include "vmcore/globals.hpp"
-#include "vmcore/loader.h"
-#include "vmcore/method.h"
-#include "vmcore/options.h"
-
// FIXME Use C-linkage for now.
extern "C" {
void stacktrace_print_exception(java_handle_t *h)
{
- java_lang_Throwable *o;
-
-#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
- java_lang_VMThrowable *vmt;
-#endif
-
- java_lang_Object *backtrace;
- java_handle_bytearray_t *ba;
- stacktrace_t *st;
-
- o = (java_lang_Throwable *) h;
-
- if (o == NULL)
+ if (h == NULL)
return;
+ java_lang_Throwable t(h);
+
/* now print the stacktrace */
#if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
- LLNI_field_get_ref(o, vmState, vmt);
- LLNI_field_get_ref(vmt, vmdata, backtrace);
+ java_lang_VMThrowable vmt(t.get_vmState());
+ java_handle_bytearray_t* backtrace = vmt.get_vmdata();
#elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK) || defined(WITH_JAVA_RUNTIME_LIBRARY_CLDC1_1)
- LLNI_field_get_ref(o, backtrace, backtrace);
+ java_handle_bytearray_t* backtrace = t.get_backtrace();
#else
# error unknown classpath configuration
#endif
- ba = (java_handle_bytearray_t *) backtrace;
-
- /* Sanity check. */
+ // Sanity check.
- assert(ba != NULL);
+ assert(backtrace != NULL);
/* We need a critical section here as we use the byte-array data
pointer directly. */
LLNI_CRITICAL_START;
- st = (stacktrace_t *) LLNI_array_data(ba);
+ stacktrace_t* st = (stacktrace_t*) LLNI_array_data(backtrace);
stacktrace_print(st);