added field and method resolution
authoredwin <none@none>
Wed, 31 Mar 2004 22:44:07 +0000 (22:44 +0000)
committeredwin <none@none>
Wed, 31 Mar 2004 22:44:07 +0000 (22:44 +0000)
jit/inline.c
jit/parse.c
jit/parseRT.c
main.c
src/cacao/cacao.c
src/vm/jit/inline/inline.c
src/vm/jit/inline/parseRT.c
src/vm/jit/parse.c

index 159ea4896b695f79eb2c7434e00f90cec9786fad..f4e98c5fe8ab7c51a200294c801d8d057b1b530f 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Dieter Thuernbeck
 
-   $Id: inline.c 846 2004-01-05 10:40:42Z twisti $
+   $Id: inline.c 1009 2004-03-31 22:44:07Z edwin $
 
 */
 
@@ -382,7 +382,9 @@ inlining_methodinfo *inlining_analyse_method(methodinfo *m, int level, int gp, i
                                        methodinfo *imi;
 
                                        imr = class_getconstant(m->class, i, CONSTANT_Methodref);
-                                       imi = class_fetchmethod(imr->class, imr->name, imr->descriptor);
+                                       imi = class_resolveclassmethod (imr->class, imr->name, imr->descriptor, class, true);
+                                       if (!imi)
+                                               panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
 
                                        if (opcode == JAVA_INVOKEVIRTUAL) {
                                                if (!is_unique_method(imi->class, imi, imr->name, imr->descriptor))
index 5dbc382ce8d2fcd93d38f43b5f9054e3e3be45d6..b3bc997d807cf62e6999102ad8f521d19d974cc9 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Carolyn Oates
             Edwin Steiner
 
-   $Id: parse.c 991 2004-03-29 11:22:34Z stefan $
+   $Id: parse.c 1009 2004-03-31 22:44:07Z edwin $
 
 */
 
@@ -1203,7 +1203,9 @@ void parse()
                                constant_FMIref *fr;
                                fieldinfo *fi;
                                fr = class_getconstant(class, i, CONSTANT_Fieldref);
-                               fi = class_findfield(fr->class, fr->name, fr->descriptor);
+                               fi = class_resolvefield(fr->class, fr->name, fr->descriptor, class, true);
+                               if (!fi)
+                                       panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                OP2A(opcode, fi->type, fi,currentline);
                                if (!fi->class->initialized) {
                                        isleafmethod = false;
@@ -1218,7 +1220,9 @@ void parse()
                                constant_FMIref *fr;
                                fieldinfo *fi;
                                fr = class_getconstant (class, i, CONSTANT_Fieldref);
-                               fi = class_findfield (fr->class, fr->name, fr->descriptor);
+                               fi = class_resolvefield(fr->class, fr->name, fr->descriptor, class, true);
+                               if (!fi)
+                                       panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                OP2A(opcode, fi->type, fi,currentline);
                        }
                        break;
@@ -1233,7 +1237,9 @@ void parse()
                                methodinfo *mi;
                                
                                mr = class_getconstant (class, i, CONSTANT_Methodref);
-                               mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
+                               mi = class_resolveclassmethod (mr->class, mr->name, mr->descriptor, class, true);
+                               if (!mi)
+                                       panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                /*RTAprint*/ if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
                                        /*RTAprint*/    {printf(" method name =");
                                        /*RTAprint*/    utf_display(mi->class->name); printf(".");
@@ -1256,7 +1262,9 @@ void parse()
                                methodinfo *mi;
 
                                mr = class_getconstant (class, i, CONSTANT_Methodref);
-                               mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
+                               mi = class_resolveclassmethod (mr->class, mr->name, mr->descriptor, class, true);
+                               if (!mi)
+                                       panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                /*RTAprint*/ if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
                                        /*RTAprint*/    {printf(" method name =");
                                        method_display(mi);
@@ -1279,7 +1287,9 @@ void parse()
                                methodinfo *mi;
                                
                                mr = class_getconstant (class, i, CONSTANT_InterfaceMethodref);
-                               mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
+                               mi = class_resolveinterfacemethod (mr->class, mr->name, mr->descriptor, class, true);
+                               if (!mi)
+                                       panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                if (mi->flags & ACC_STATIC)
                                        panic ("Static/Nonstatic mismatch calling static method");
                                descriptor2types(mi);
index b6512b89f9c656bcfddb8f355ca2981143fd35eb..1a82196e07682667b60d2e074c3b0e272b0022c8 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Carolyn Oates
 
-   $Id: parseRT.c 911 2004-02-04 11:42:41Z carolyn $
+   $Id: parseRT.c 1009 2004-03-31 22:44:07Z edwin $
 
 Changes:
 opcode put into functions
@@ -1570,7 +1570,9 @@ static void parseRT()
                                methodinfo *mi;
 
                                mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
-                               mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
+                               mi = class_resolveclassmethod (mr->class, mr->name, mr->descriptor, class, true);
+                               if (!mi)
+                                       panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                /*-- RTA --*/
                                invokestatic(mi);
                        }
@@ -1583,7 +1585,9 @@ static void parseRT()
                        methodinfo *mi;
                                
                        mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
-                       mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
+                       mi = class_resolveclassmethod (mr->class, mr->name, mr->descriptor, class, true);
+                       if (!mi)
+                               panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                                RTAPRINT06invoke_spec_virt1
                        /*--- PRIVATE Method -----------------------------------------------------*/ 
                        if (mi->name        != INIT) {     /* if method called is PRIVATE */ 
@@ -1607,7 +1611,9 @@ static void parseRT()
                        methodinfo *mi;
                                
                        mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
-                       mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
+                       mi = class_resolveclassmethod (mr->class, mr->name, mr->descriptor, class, true);
+                       if (!mi)
+                               panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
 
                        invokevirtual(mi);
                        }
@@ -1620,8 +1626,10 @@ static void parseRT()
                        methodinfo *mi;
 
                        mr = class_getconstant (rt_class, i, CONSTANT_InterfaceMethodref);
-                       mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
-                       invokeinterface(mi);
+                       mi = class_resolveinterfacemethod (mr->class, mr->name, mr->descriptor, class, true);
+                       if (!mi)
+                               panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
+                       invokeinterface(mi);
                        }
                        break;
 
diff --git a/main.c b/main.c
index d01b8ac5dc9b9eca3d83746ad5a32c7d1a832010..db5e48b7764e84f7c74702248c913f5450372579 100644 (file)
--- a/main.c
+++ b/main.c
@@ -37,7 +37,7 @@
      - Calling the class loader
      - Running the main method
 
-   $Id: main.c 997 2004-03-30 21:49:28Z twisti $
+   $Id: main.c 1009 2004-03-31 22:44:07Z edwin $
 
 */
 
@@ -924,9 +924,11 @@ int main(int argc, char **argv)
 
 /*             heap_addreference((void**) &a); */
 
-               mainmethod = class_findmethod(topclass,
+               mainmethod = class_resolveclassmethod(topclass,
                                                                          utf_new_char("main"), 
-                                                                         utf_new_char("([Ljava/lang/String;)V")
+                                                                         utf_new_char("([Ljava/lang/String;)V"),
+                                                                               topclass,
+                                                                               true
                                                                          );
 
                /* there is no main method or it isn't static */
index 8156e13efe99a86813b40e69a1bf2002c2a6d67e..1c4945840e96f99115b0d3441538d49d886240bb 100644 (file)
@@ -37,7 +37,7 @@
      - Calling the class loader
      - Running the main method
 
-   $Id: cacao.c 997 2004-03-30 21:49:28Z twisti $
+   $Id: cacao.c 1009 2004-03-31 22:44:07Z edwin $
 
 */
 
@@ -924,9 +924,11 @@ int main(int argc, char **argv)
 
 /*             heap_addreference((void**) &a); */
 
-               mainmethod = class_findmethod(topclass,
+               mainmethod = class_resolveclassmethod(topclass,
                                                                          utf_new_char("main"), 
-                                                                         utf_new_char("([Ljava/lang/String;)V")
+                                                                         utf_new_char("([Ljava/lang/String;)V"),
+                                                                               topclass,
+                                                                               true
                                                                          );
 
                /* there is no main method or it isn't static */
index 159ea4896b695f79eb2c7434e00f90cec9786fad..f4e98c5fe8ab7c51a200294c801d8d057b1b530f 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Dieter Thuernbeck
 
-   $Id: inline.c 846 2004-01-05 10:40:42Z twisti $
+   $Id: inline.c 1009 2004-03-31 22:44:07Z edwin $
 
 */
 
@@ -382,7 +382,9 @@ inlining_methodinfo *inlining_analyse_method(methodinfo *m, int level, int gp, i
                                        methodinfo *imi;
 
                                        imr = class_getconstant(m->class, i, CONSTANT_Methodref);
-                                       imi = class_fetchmethod(imr->class, imr->name, imr->descriptor);
+                                       imi = class_resolveclassmethod (imr->class, imr->name, imr->descriptor, class, true);
+                                       if (!imi)
+                                               panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
 
                                        if (opcode == JAVA_INVOKEVIRTUAL) {
                                                if (!is_unique_method(imi->class, imi, imr->name, imr->descriptor))
index b6512b89f9c656bcfddb8f355ca2981143fd35eb..1a82196e07682667b60d2e074c3b0e272b0022c8 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Carolyn Oates
 
-   $Id: parseRT.c 911 2004-02-04 11:42:41Z carolyn $
+   $Id: parseRT.c 1009 2004-03-31 22:44:07Z edwin $
 
 Changes:
 opcode put into functions
@@ -1570,7 +1570,9 @@ static void parseRT()
                                methodinfo *mi;
 
                                mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
-                               mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
+                               mi = class_resolveclassmethod (mr->class, mr->name, mr->descriptor, class, true);
+                               if (!mi)
+                                       panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                /*-- RTA --*/
                                invokestatic(mi);
                        }
@@ -1583,7 +1585,9 @@ static void parseRT()
                        methodinfo *mi;
                                
                        mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
-                       mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
+                       mi = class_resolveclassmethod (mr->class, mr->name, mr->descriptor, class, true);
+                       if (!mi)
+                               panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                                RTAPRINT06invoke_spec_virt1
                        /*--- PRIVATE Method -----------------------------------------------------*/ 
                        if (mi->name        != INIT) {     /* if method called is PRIVATE */ 
@@ -1607,7 +1611,9 @@ static void parseRT()
                        methodinfo *mi;
                                
                        mr = class_getconstant (rt_class, i, CONSTANT_Methodref);
-                       mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
+                       mi = class_resolveclassmethod (mr->class, mr->name, mr->descriptor, class, true);
+                       if (!mi)
+                               panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
 
                        invokevirtual(mi);
                        }
@@ -1620,8 +1626,10 @@ static void parseRT()
                        methodinfo *mi;
 
                        mr = class_getconstant (rt_class, i, CONSTANT_InterfaceMethodref);
-                       mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
-                       invokeinterface(mi);
+                       mi = class_resolveinterfacemethod (mr->class, mr->name, mr->descriptor, class, true);
+                       if (!mi)
+                               panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
+                       invokeinterface(mi);
                        }
                        break;
 
index 5dbc382ce8d2fcd93d38f43b5f9054e3e3be45d6..b3bc997d807cf62e6999102ad8f521d19d974cc9 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Carolyn Oates
             Edwin Steiner
 
-   $Id: parse.c 991 2004-03-29 11:22:34Z stefan $
+   $Id: parse.c 1009 2004-03-31 22:44:07Z edwin $
 
 */
 
@@ -1203,7 +1203,9 @@ void parse()
                                constant_FMIref *fr;
                                fieldinfo *fi;
                                fr = class_getconstant(class, i, CONSTANT_Fieldref);
-                               fi = class_findfield(fr->class, fr->name, fr->descriptor);
+                               fi = class_resolvefield(fr->class, fr->name, fr->descriptor, class, true);
+                               if (!fi)
+                                       panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                OP2A(opcode, fi->type, fi,currentline);
                                if (!fi->class->initialized) {
                                        isleafmethod = false;
@@ -1218,7 +1220,9 @@ void parse()
                                constant_FMIref *fr;
                                fieldinfo *fi;
                                fr = class_getconstant (class, i, CONSTANT_Fieldref);
-                               fi = class_findfield (fr->class, fr->name, fr->descriptor);
+                               fi = class_resolvefield(fr->class, fr->name, fr->descriptor, class, true);
+                               if (!fi)
+                                       panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                OP2A(opcode, fi->type, fi,currentline);
                        }
                        break;
@@ -1233,7 +1237,9 @@ void parse()
                                methodinfo *mi;
                                
                                mr = class_getconstant (class, i, CONSTANT_Methodref);
-                               mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
+                               mi = class_resolveclassmethod (mr->class, mr->name, mr->descriptor, class, true);
+                               if (!mi)
+                                       panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                /*RTAprint*/ if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
                                        /*RTAprint*/    {printf(" method name =");
                                        /*RTAprint*/    utf_display(mi->class->name); printf(".");
@@ -1256,7 +1262,9 @@ void parse()
                                methodinfo *mi;
 
                                mr = class_getconstant (class, i, CONSTANT_Methodref);
-                               mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
+                               mi = class_resolveclassmethod (mr->class, mr->name, mr->descriptor, class, true);
+                               if (!mi)
+                                       panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                /*RTAprint*/ if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
                                        /*RTAprint*/    {printf(" method name =");
                                        method_display(mi);
@@ -1279,7 +1287,9 @@ void parse()
                                methodinfo *mi;
                                
                                mr = class_getconstant (class, i, CONSTANT_InterfaceMethodref);
-                               mi = class_fetchmethod (mr->class, mr->name, mr->descriptor);
+                               mi = class_resolveinterfacemethod (mr->class, mr->name, mr->descriptor, class, true);
+                               if (!mi)
+                                       panic("Exception thrown while parsing bytecode"); /* XXX should be passed on */
                                if (mi->flags & ACC_STATIC)
                                        panic ("Static/Nonstatic mismatch calling static method");
                                descriptor2types(mi);