* Removed all Id tags.
[cacao.git] / src / vm / jit / verify / typecheck-builtins.inc
index 904f2499941ce1becce66cffd4e9bb03f822ee2d..5ca682273764fd8b3c6713b834ff23fbec36730e 100644 (file)
@@ -1,8 +1,34 @@
+/* src/vm/jit/verify/typecheck-builtins.inc - type checking for ICMD_BUILTIN
+
+   Copyright (C) 1996-2005, 2006, 2007 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
+
+   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.
+
+*/
+
+
 #define ISBUILTIN(v)   (bte->fp == (functionptr) (v))
 
 {
        builtintable_entry *bte;
-    classref_or_classinfo cls;
 
        bte = state->iptr->sx.s23.s3.bte;
 
        /* pointer in builtintable_entry for this, so here you go.. ;)     */
 
        if (ISBUILTIN(BUILTIN_new)) {
+               dv->type = TYPE_ADR;
+#if defined(TYPECHECK_TYPEINFERER)
+               assert(state->iptr[-1].opc == ICMD_ACONST);
+               typeinfo_init_class(&(dv->typeinfo), state->iptr[-1].sx.val.c);
+#else
                if (state->iptr[-1].opc != ICMD_ACONST)
                        TYPECHECK_VERIFYERROR_bool("illegal instruction: builtin_new without class");
-               cls = state->iptr[-1].sx.val.c;
-               dv->type = TYPE_ADR;
                TYPEINFO_INIT_NEWOBJECT(dv->typeinfo,state->iptr);
+#endif
        }
        else if (ISBUILTIN(BUILTIN_newarray_boolean)) {
                TYPECHECK_INT(OP1);
        }
        else {
                methoddesc *md;
-               s4 i;
                u1 rtype;
+#if !defined(TYPECHECK_TYPEINFERER)
+               s4 i;
+#endif
 #if defined(TYPECHECK_STACKBASED)
                typedescriptor *av;
 #endif
                TYPECHECK_COUNT(stat_ins_builtin_gen);
 
                md = bte->md;
+#if !defined(TYPECHECK_TYPEINFERER)
                i = md->paramcount;
 
                /* check the types of the arguments on the stack */
 #ifdef TYPECHECK_DEBUG
                        /* generic builtins may only take primitive types and java.lang.Object references */
                        if (av->type == TYPE_ADR && md->paramtypes[i].classref->name != utf_java_lang_Object) {
-                               *exceptionptr = new_internalerror("generic builtin method with non-generic reference parameter");
+                               exceptions_throw_internalerror("generic builtin method with non-generic reference parameter");
                                return false;
                        }
 #endif
                        av += (IS_2_WORD_TYPE(av->type)) ? 2 : 1;
 #endif
                }
+#endif /* !defined(TYPECHECK_TYPEINFERER) */
 
                /* set the return type */