* src/vm/jit/parse.c, src/vm/jit/parse.h (Changes): Merged with
[cacao.git] / src / vm / method.c
index 21ce34a06be4e8ac536e498cdcfae04882ac16f1..845ed7236b20394d02e4937d235b1e01c7f78ef1 100644 (file)
@@ -32,7 +32,7 @@
             Edwin Steiner
             Christian Thalinger
 
-   $Id: method.c 4879 2006-05-05 17:34:49Z edwin $
+   $Id: method.c 5785 2006-10-15 22:25:54Z edwin $
 
 */
 
@@ -50,6 +50,7 @@
 #include "vm/linker.h"
 #include "vm/loader.h"
 #include "vm/method.h"
+#include "vm/options.h"
 #include "vm/jit/methodheader.h"
 
 
@@ -64,8 +65,8 @@ void method_free(methodinfo *m)
        if (m->jcode)
                MFREE(m->jcode, u1, m->jcodelength);
 
-       if (m->exceptiontable)
-               MFREE(m->exceptiontable, exceptiontable, m->exceptiontablelength);
+       if (m->rawexceptiontable)
+               MFREE(m->rawexceptiontable, raw_exception_entry, m->rawexceptiontablelength);
 
        code_free_code_of_method(m);
 
@@ -116,6 +117,7 @@ methodinfo *method_vftbl_lookup(vftbl_t *vftbl, methodinfo* m)
        methodptr   mptr;
        methodptr  *pmptr;
        methodinfo *resm;                   /* pointer to new resolved method     */
+       codeinfo   *code;
 
        /* If the method is not an instance method, just return it. */
 
@@ -130,14 +132,16 @@ methodinfo *method_vftbl_lookup(vftbl_t *vftbl, methodinfo* m)
        if (m->class->flags & ACC_INTERFACE) {
                pmptr = vftbl->interfacetable[-(m->class->index)];
                mptr  = pmptr[(m - m->class->methods)];
-
-       else {
+       }
+       else {
                mptr = vftbl->table[m->vftblindex];
        }
 
-       /* and now get the methodinfo* from the first data segment slot */
+       /* and now get the codeinfo pointer from the first data segment slot */
+
+       code = *((codeinfo **) (mptr + CodeinfoPointer));
 
-       resm = *((methodinfo **) (mptr + MethodPointer));
+       resm = code->m;
 
        return resm;
 }
@@ -209,7 +213,9 @@ void method_print(methodinfo *m)
 #if !defined(NDEBUG)
 void method_println(methodinfo *m)
 {
+       if (opt_debugcolor) printf("\033[31m"); /* red */
        method_print(m);
+       if (opt_debugcolor) printf("\033[m");   
        printf("\n");
 }
 #endif /* !defined(NDEBUG) */