#include "native/jni.h"
#include "native/llni.h"
-#include "native/include/java_lang_String.h"
-#include "native/include/java_lang_Throwable.h"
#include "threads/lock-common.h"
-#if defined(ENABLE_THREADS)
-#include "threads/native/threads.h"
-#else
-#include "threads/none/threads.h"
-#endif
+#include "threads/threads-common.h"
#include "toolbox/logging.h"
#include "toolbox/util.h"
#include "vm/stringlocal.h"
#include "vm/jit/asmpart.h"
+#include "vm/jit/trace.h"
#include "vmcore/class.h"
#include "vmcore/linker.h"
void *builtin_throw_exception(java_object_t *xptr)
{
#if !defined(NDEBUG)
- java_lang_Throwable *t;
- java_lang_String *s;
- char *logtext;
- s4 logtextlen;
- s4 dumpsize;
-
- if (opt_verbose) {
- t = (java_lang_Throwable *) xptr;
-
- /* get detail message */
- if (t)
- LLNI_field_get_ref(t, detailMessage, s);
-
- /* calculate message length */
-
- logtextlen = strlen("Builtin exception thrown: ") + strlen("0");
-
- if (t) {
- logtextlen +=
- utf_bytes(xptr->vftbl->class->name);
- if (s) {
- logtextlen += strlen(": ") +
- u2_utflength(LLNI_field_direct(s, value)->data
- + LLNI_field_direct(s, offset),
- LLNI_field_direct(s,count));
- }
- }
- else {
- logtextlen += strlen("(nil)");
- }
-
- /* allocate memory */
-
- dumpsize = dump_size();
-
- logtext = DMNEW(char, logtextlen);
-
- strcpy(logtext, "Builtin exception thrown: ");
-
- if (t) {
- utf_cat_classname(logtext, xptr->vftbl->class->name);
-
- if (s) {
- char *buf;
+ /* print exception trace */
- buf = javastring_tochar((java_handle_t *) s);
- strcat(logtext, ": ");
- strcat(logtext, buf);
- MFREE(buf, char, strlen(buf) + 1);
- }
-
- } else {
- strcat(logtext, "(nil)");
- }
-
- log_text(logtext);
-
- /* release memory */
-
- dump_release(dumpsize);
- }
+ if (opt_TraceExceptions)
+ trace_exception_builtin(xptr);
#endif /* !defined(NDEBUG) */
/* actually set the exception */
s4 builtin_canstore(java_handle_objectarray_t *oa, java_handle_t *o)
{
- s4 result;
+ int result;
LLNI_CRITICAL_START;
- result = builtin_fast_canstore(LLNI_UNWRAP(oa), LLNI_UNWRAP(o));
+ result = builtin_fast_canstore(LLNI_DIRECT(oa), LLNI_UNWRAP(o));
LLNI_CRITICAL_END;
+ /* if not possible, throw an exception */
+
+ if (result == 0)
+ exceptions_throw_arraystoreexception();
+
return result;
}
result = builtin_descriptorscompatible(valuedesc, componentvftbl->arraydesc);
}
- /* if not possible, throw an exception */
-
- if (result == 0)
- exceptions_throw_arraystoreexception();
-
/* return result */
return result;
/* now call the real function */
- return builtin_multianewarray_intern(n, arrayclass, dims);
+ return (java_handle_objectarray_t *)
+ builtin_multianewarray_intern(n, arrayclass, dims);
}
*****************************************************************************/
-#if !defined(NDEBUG)
-static s4 methodindent = 0;
-static u4 callcount = 0;
-#endif /* !defined(NDEBUG) */
-
-
/* builtin_print_argument ******************************************************
Prints arguments and return values for the call trace.
s4 dumpsize;
s4 i;
s4 pos;
+ int methodindent;
+ int callcount;
#if defined(ENABLE_DEBUG_FILTER)
if (! show_filters_test_verbosecall_enter(m)) return;
md = m->parseddesc;
+ methodindent = TRACEJAVACALLINDENT;
+
/* calculate message length */
logtextlen =
logtext = DMNEW(char, logtextlen);
- callcount++;
+ callcount = ++TRACEJAVACALLCOUNT;
sprintf(logtext, "%10d ", callcount);
sprintf(logtext + strlen(logtext), "-%d-", methodindent);
dump_release(dumpsize);
- methodindent++;
+ TRACEJAVACALLINDENT++;
}
#endif
s4 i;
s4 pos;
imm_union val;
+ int methodindent;
#if defined(ENABLE_DEBUG_FILTER)
if (! show_filters_test_verbosecall_exit(m)) return;
md = m->parseddesc;
+ /* outdent the log message */
+
+ if (TRACEJAVACALLINDENT)
+ TRACEJAVACALLINDENT--;
+ else
+ log_text("WARNING: unmatched methodindent--");
+
+ methodindent = TRACEJAVACALLINDENT;
+
/* calculate message length */
logtextlen =
logtext = DMNEW(char, logtextlen);
- /* outdent the log message */
-
- if (methodindent)
- methodindent--;
- else
- log_text("WARNING: unmatched methodindent--");
-
/* generate the message */
sprintf(logtext, " ");