From 0d68c07fe14a227ddcb29ed094214406d340a1cc Mon Sep 17 00:00:00 2001 From: edwin Date: Wed, 31 Mar 2004 22:44:07 +0000 Subject: [PATCH] added field and method resolution --- jit/inline.c | 6 ++++-- jit/parse.c | 22 ++++++++++++++++------ jit/parseRT.c | 20 ++++++++++++++------ main.c | 8 +++++--- src/cacao/cacao.c | 8 +++++--- src/vm/jit/inline/inline.c | 6 ++++-- src/vm/jit/inline/parseRT.c | 20 ++++++++++++++------ src/vm/jit/parse.c | 22 ++++++++++++++++------ 8 files changed, 78 insertions(+), 34 deletions(-) diff --git a/jit/inline.c b/jit/inline.c index 159ea4896..f4e98c5fe 100644 --- a/jit/inline.c +++ b/jit/inline.c @@ -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)) diff --git a/jit/parse.c b/jit/parse.c index 5dbc382ce..b3bc997d8 100644 --- a/jit/parse.c +++ b/jit/parse.c @@ -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); diff --git a/jit/parseRT.c b/jit/parseRT.c index b6512b89f..1a82196e0 100644 --- a/jit/parseRT.c +++ b/jit/parseRT.c @@ -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 d01b8ac5d..db5e48b77 100644 --- 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 */ diff --git a/src/cacao/cacao.c b/src/cacao/cacao.c index 8156e13ef..1c4945840 100644 --- a/src/cacao/cacao.c +++ b/src/cacao/cacao.c @@ -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 */ diff --git a/src/vm/jit/inline/inline.c b/src/vm/jit/inline/inline.c index 159ea4896..f4e98c5fe 100644 --- a/src/vm/jit/inline/inline.c +++ b/src/vm/jit/inline/inline.c @@ -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)) diff --git a/src/vm/jit/inline/parseRT.c b/src/vm/jit/inline/parseRT.c index b6512b89f..1a82196e0 100644 --- a/src/vm/jit/inline/parseRT.c +++ b/src/vm/jit/inline/parseRT.c @@ -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/src/vm/jit/parse.c b/src/vm/jit/parse.c index 5dbc382ce..b3bc997d8 100644 --- a/src/vm/jit/parse.c +++ b/src/vm/jit/parse.c @@ -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); -- 2.25.1