* src/vm/jit/allocator/simplereg.c (new_allocate_scratch_registers):
[cacao.git] / src / vm / method.c
index 84efdd3eb6b5404d52a30a7487722ab64fdefbf0..6857e65c9c7f5bfcd866e92a90afe0eb83ad9002 100644 (file)
@@ -32,7 +32,7 @@
             Edwin Steiner
             Christian Thalinger
 
-   $Id: method.c 4595 2006-03-14 20:51:12Z edwin $
+   $Id: method.c 5038 2006-06-19 22:22:34Z twisti $
 
 */
 
@@ -116,6 +116,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 +131,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 */
 
-       resm = *((methodinfo **) (mptr + MethodPointer));
+       code = *((codeinfo **) (mptr + CodeinfoPointer));
+
+       resm = code->m;
 
        return resm;
 }
@@ -188,10 +191,10 @@ void method_print(methodinfo *m)
                return;
        }
 
-       utf_display_classname(m->class->name);
+       utf_display_printable_ascii_classname(m->class->name);
        printf(".");
-       utf_display(m->name);
-       utf_display(m->descriptor);
+       utf_display_printable_ascii(m->name);
+       utf_display_printable_ascii(m->descriptor);
 
        method_printflags(m);
 }
@@ -215,6 +218,50 @@ void method_println(methodinfo *m)
 #endif /* !defined(NDEBUG) */
 
 
+/* method_methodref_print ******************************************************
+
+   Prints a method reference to stdout.
+
+*******************************************************************************/
+
+#if !defined(NDEBUG)
+void method_methodref_print(constant_FMIref *mr)
+{
+       if (!mr) {
+               printf("(constant_FMIref *)NULL");
+               return;
+       }
+
+       if (IS_FMIREF_RESOLVED(mr)) {
+               printf("<method> ");
+               method_print(mr->p.method);
+       }
+       else {
+               printf("<methodref> ");
+               utf_display_printable_ascii_classname(mr->p.classref->name);
+               printf(".");
+               utf_display_printable_ascii(mr->name);
+               utf_display_printable_ascii(mr->descriptor);
+       }
+}
+#endif /* !defined(NDEBUG) */
+
+
+/* method_methodref_println ****************************************************
+
+   Prints a method reference to stdout, followed by a newline.
+
+*******************************************************************************/
+
+#if !defined(NDEBUG)
+void method_methodref_println(constant_FMIref *mr)
+{
+       method_methodref_print(mr);
+       printf("\n");
+}
+#endif /* !defined(NDEBUG) */
+
+
 /*
  * These are local overrides for various environment variables in Emacs.
  * Please do not remove this and leave it at the end of the file, where