* src/vm/jit/trace.c (trace_java_call_print_argument): Deals with java_object_t.
authorMichael Starzinger <michi@complang.tuwien.ac.at>
Fri, 31 Aug 2007 21:11:10 +0000 (23:11 +0200)
committerMichael Starzinger <michi@complang.tuwien.ac.at>
Fri, 31 Aug 2007 21:11:10 +0000 (23:11 +0200)
* src/vm/exceptions.h (exceptions_asm_new_abstractmethoderror): Fixed prototype.

* src/vm/exceptions.c: Use LLNI_class_get throughout file.
(exceptions_get_exception): Wrap exception object.
(exceptions_set_exception): Unwrap exception object.

* src/vm/vm.c: Use LLNI_class_get throughout file.

src/vm/exceptions.c
src/vm/exceptions.h
src/vm/jit/trace.c
src/vm/vm.c

index 6a340702f6d46ebf34ac87cd05c95b3faad9f2ee..f23dcce0c93c1d5cd4c73effc0f3415afc6edf32 100644 (file)
@@ -202,9 +202,19 @@ bool exceptions_init(void)
 
 java_handle_t *exceptions_get_exception(void)
 {
+       java_handle_t *e;
+
+       /* get the exception */
+
+       LLNI_CRITICAL_START;
+
+       e = LLNI_WRAP(*exceptionptr);
+
+       LLNI_CRITICAL_END;
+
        /* return the exception */
 
-       return *exceptionptr;
+       return e;
 }
 
 
@@ -218,7 +228,11 @@ void exceptions_set_exception(java_handle_t *o)
 {
        /* set the exception */
 
-       *exceptionptr = o;
+       LLNI_CRITICAL_START;
+
+       *exceptionptr = LLNI_UNWRAP(o);
+
+       LLNI_CRITICAL_END;
 }
 
 
@@ -1468,9 +1482,12 @@ void exceptions_throw_arraystoreexception(void)
 java_handle_t *exceptions_new_classcastexception(java_handle_t *o)
 {
        java_handle_t *e;
+       classinfo     *c;
        utf           *classname;
 
-       classname = o->vftbl->class->name;
+       LLNI_class_get(o, c);
+
+       classname = c->name;
 
        e = exceptions_new_class_utf(class_java_lang_ClassCastException, classname);
 
@@ -1693,6 +1710,7 @@ void exceptions_classnotfoundexception_to_noclassdeffounderror(void)
 java_handle_t *exceptions_fillinstacktrace(void)
 {
        java_handle_t *o;
+       classinfo     *c;
        methodinfo    *m;
 
        /* get exception */
@@ -1703,12 +1721,14 @@ java_handle_t *exceptions_fillinstacktrace(void)
 
        /* resolve methodinfo pointer from exception object */
 
+       LLNI_class_get(o, c);
+
 #if defined(ENABLE_JAVASE)
-       m = class_resolvemethod(o->vftbl->class,
+       m = class_resolvemethod(c,
                                                        utf_fillInStackTrace,
                                                        utf_void__java_lang_Throwable);
 #elif defined(ENABLE_JAVAME_CLDC1_1)
-       m = class_resolvemethod(o->vftbl->class,
+       m = class_resolvemethod(c,
                                                        utf_fillInStackTrace,
                                                        utf_void__void);
 #else
@@ -2031,7 +2051,7 @@ void exceptions_print_stacktrace(void)
 
        /* clear exception, because we are calling jit code again */
 
-       c = oxptr->vftbl->class;
+       LLNI_class_get(oxptr, c);
 
        /* find the printStackTrace() method */
 
index 6c60a2793bf49f3fde324ba492a396f86f6b0b0c..b79c7be650203d99e0e6399b2822880eeea9ee42 100644 (file)
@@ -86,7 +86,7 @@ java_handle_t *new_exception_utfmessage(const char *classname,
 /* functions to generate compiler exceptions */
 
 java_handle_t *exceptions_new_abstractmethoderror(void);
-java_handle_t *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra);
+java_object_t *exceptions_asm_new_abstractmethoderror(u1 *sp, u1 *ra);
 java_handle_t *exceptions_new_arraystoreexception(void);
 
 void exceptions_throw_abstractmethoderror(void);
index aa95d7274877e06d29030c615a756b1803983f65..21ee204a92cd572c32ca5523e9148a08c7ff471b 100644 (file)
@@ -149,7 +149,7 @@ static imm_union _array_load_return_value(typedesc *td, uint64_t *return_regs) {
 static char *trace_java_call_print_argument(char *logtext, s4 *logtextlen,
                                                                                typedesc *paramtype, imm_union imu)
 {
-       java_handle_t     *o;
+       java_object_t     *o;
        classinfo         *c;
        utf               *u;
        u4                 len;
@@ -188,7 +188,7 @@ static char *trace_java_call_print_argument(char *logtext, s4 *logtextlen,
 
                /* cast to java.lang.Object */
 
-               o = (java_handle_t *) (ptrint) imu.l;
+               o = (java_object_t *) (ptrint) imu.l;
 
                /* check return argument for java.lang.Class or java.lang.String */
 
index aefd786077bea9c30e9d44edf4e277d091ee34c2..4a0332dabd561b07c38f46716a9cc0c377470189 100644 (file)
@@ -2067,7 +2067,9 @@ static char *vm_get_mainclass_from_jar(char *mainstring)
 
        /* get Main Attributes */
 
-       m = class_resolveclassmethod(o->vftbl->class,
+       LLNI_class_get(o, c);
+
+       m = class_resolveclassmethod(c,
                                                                 utf_new_char("getMainAttributes"), 
                                                                 utf_new_char("()Ljava/util/jar/Attributes;"),
                                                                 class_java_lang_Object,
@@ -2088,7 +2090,9 @@ static char *vm_get_mainclass_from_jar(char *mainstring)
 
        /* get property Main-Class */
 
-       m = class_resolveclassmethod(o->vftbl->class,
+       LLNI_class_get(o, c);
+
+       m = class_resolveclassmethod(c,
                                                                 utf_new_char("getValue"), 
                                                                 utf_new_char("(Ljava/lang/String;)Ljava/lang/String;"),
                                                                 class_java_lang_Object,
@@ -2408,7 +2412,7 @@ static void vm_array_store_adr(uint64_t *array, paramdesc *pd, void *value)
 
 *******************************************************************************/
 
-uint64_t *vm_array_from_valist(methodinfo *m, java_object_t *o, va_list ap)
+uint64_t *vm_array_from_valist(methodinfo *m, java_handle_t *o, va_list ap)
 {
        methoddesc *md;
        paramdesc  *pd;
@@ -2486,7 +2490,7 @@ uint64_t *vm_array_from_valist(methodinfo *m, java_object_t *o, va_list ap)
 
 *******************************************************************************/
 
-static uint64_t *vm_array_from_jvalue(methodinfo *m, java_object_t *o,
+static uint64_t *vm_array_from_jvalue(methodinfo *m, java_handle_t *o,
                                                                          const jvalue *args)
 {
        methoddesc *md;
@@ -2557,7 +2561,7 @@ static uint64_t *vm_array_from_jvalue(methodinfo *m, java_object_t *o,
 
 *******************************************************************************/
 
-uint64_t *vm_array_from_objectarray(methodinfo *m, java_object_t *o,
+uint64_t *vm_array_from_objectarray(methodinfo *m, java_handle_t *o,
                                                                        java_handle_objectarray_t *params)
 {
        methoddesc    *md;
@@ -2604,7 +2608,7 @@ uint64_t *vm_array_from_objectarray(methodinfo *m, java_object_t *o,
 
                        /* convert the value according to its declared type */
 
-                       c    = param->vftbl->class;
+                       LLNI_class_get(param, c);
                        type = primitive_type_get_by_wrapperclass(c);
 
                        switch (td->decltype) {
@@ -2674,9 +2678,7 @@ uint64_t *vm_array_from_objectarray(methodinfo *m, java_object_t *o,
                        if (param == NULL)
                                goto illegal_arg;
 
-                       c    = param->vftbl->class;
-                       type = primitive_type_get_by_wrapperclass(c);
-
+                       LLNI_class_get(param, c);
                        assert(td->decltype == PRIMITIVETYPE_LONG);
 
                        switch (type) {
@@ -2698,7 +2700,7 @@ uint64_t *vm_array_from_objectarray(methodinfo *m, java_object_t *o,
                        if (param == NULL)
                                goto illegal_arg;
 
-                       c    = param->vftbl->class;
+                       LLNI_class_get(param, c);
                        type = primitive_type_get_by_wrapperclass(c);
 
                        assert(td->decltype == PRIMITIVETYPE_FLOAT);
@@ -2719,7 +2721,7 @@ uint64_t *vm_array_from_objectarray(methodinfo *m, java_object_t *o,
                        if (param == NULL)
                                goto illegal_arg;
 
-                       c    = param->vftbl->class;
+                       LLNI_class_get(param, c);
                        type = primitive_type_get_by_wrapperclass(c);
 
                        assert(td->decltype == PRIMITIVETYPE_DOUBLE);
@@ -2874,7 +2876,7 @@ type vm_call##name##_array(methodinfo *m, uint64_t *array)   \
                if (!jit_compile(m))                                 \
                        return 0;                                        \
                                                              \
-    pv = m->code->entrypoint;                                \
+       pv = m->code->entrypoint;                                \
                                                              \
        STATISTICS(count_calls_native_to_java++);                \
                                                              \
@@ -2901,4 +2903,5 @@ VM_CALL_ARRAY(_double, double)
  * c-basic-offset: 4
  * tab-width: 4
  * End:
+ * vim:noexpandtab:sw=4:ts=4:
  */