+/* src/vm/jit/verify/typecheck-invoke.inc - type checking for invocations
+
+ Copyright (C) 1996-2011
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+
+ This file is part of CACAO.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+*/
+
+
{
unresolved_method *um; /* struct describing the called method */
constant_FMIref *mref; /* reference to the called method */
- methodinfo *mi; /* resolved method (if any) */
methoddesc *md; /* descriptor of the called method */
utf *mname; /* method name */
+ u1 rtype; /* return type of called method */
+#if !defined(TYPECHECK_TYPEINFERER)
+ methodinfo *mi; /* resolved method (if any) */
utf *mclassname; /* name of the method's class */
bool specialmethod; /* true if a <...> method is called */
int opcode; /* invocation opcode */
s4 argindex; /* argument variable index */
varinfo *av; /* argument variable */
#else
- typedescriptor *av; /* argument stack slot */
+ typedescriptor_t *av; /* argument stack slot */
#endif
int i; /* counter */
- u1 rtype; /* return type of called method */
resolve_result_t result;
bool invokestatic;
bool invokespecial;
+#endif /* !defined(TYPECHECK_TYPEINFERER) */
/* get the FMIref and the unresolved_method struct (if any) */
/* from the instruction */
md = mref->parseddesc.md;
mname = mref->name;
+#if !defined(TYPECHECK_TYPEINFERER)
/* get method info (if resolved) and classname */
if (IS_FMIREF_RESOLVED(mref)) {
mi = mref->p.method;
- mclassname = mi->class->name;
+ mclassname = mi->clazz->name;
}
else {
mi = NULL;
/* allocate parameters if necessary */
- if (!md->params)
- if (!descriptor_params_from_paramtypes(md,
- (invokestatic) ? ACC_STATIC : ACC_NONE))
- return false;
+ descriptor_params_from_paramtypes(
+ md,
+ (invokestatic) ? ACC_STATIC : ACC_NONE);
/* check parameter types */
if (ins)
initclass = ins[-1].sx.val.c;
else
- initclass.cls = state->m->class;
+ initclass.cls = state->m->clazz;
LOGSTR("\t\tclass: "); LOGNAME(initclass); LOGNL;
}
}
/* the current class is linked, so must be its superclass. thus we can be */
/* sure that resolving will be trivial. */
if (mi) {
- cls = mi->class;
+ cls = mi->clazz;
}
else {
if (!resolve_classref(state->m,mref->p.classref,resolveLazy,false,true,&cls))
/* if lazy resolving did not succeed, it's not one of the allowed classes */
/* otherwise we check it directly */
- if (cls == NULL || (cls != state->m->class && cls != state->m->class->super.cls)) {
+ if (cls == NULL || (cls != state->m->clazz && cls != state->m->clazz->super)) {
TYPECHECK_VERIFYERROR_bool("<init> calling <init> of the wrong class");
}
/* impose loading constraints */
if (result == resolveSucceeded) {
- /* XXX state->m->class may have to be wrong when inlining */
- if (!resolve_method_loading_constraints(state->m->class, mi))
+ /* XXX state->m->clazz may have to be wrong when inlining */
+ if (!resolve_method_loading_constraints(state->m->clazz, mi))
return false;
}
if ((state->iptr->opc == ICMD_INVOKEVIRTUAL)
&& (mi->flags & (ACC_FINAL | ACC_PRIVATE)))
{
- state->iptr->opc = ICMD_INVOKESPECIAL;
+ state->iptr->opc = ICMD_INVOKESPECIAL;
+ state->iptr->flags.bits |= INS_FLAG_CHECK;
}
}
else {
/* resolution must be deferred */
if (!um) {
- um = resolve_create_unresolved_method(state->m->class, state->m,
+ um = resolve_create_unresolved_method(state->m->clazz, state->m,
mref,
invokestatic,
invokespecial);
state->iptr->sx.s23.s3.um = um;
state->iptr->flags.bits |= INS_FLAG_UNRESOLVED;
}
+#endif /* !defined(TYPECHECK_TYPEINFERER) */
/* set the return type */