PR163: descriptor_params_from_paramtypes is protected by a mutex now (per descriptor...
[cacao.git] / src / vm / jit / verify / typecheck-invoke.inc
index a8257c22bc9d92d8ed2d508382ccfeed1fc25b0c..781defe657b27190610ca85cf0a7b801ac1168d0 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/verify/typecheck-invoke.inc - type checking for invocations
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
-   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
-   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
-   J. Wenninger, Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2011
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Edwin Steiner
-
-   Changes: 
-
-   $Id$
-
 */
 
 
 {
        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 */