1 /* src/vm/jit/verify/typecheck-multianewarray.inc - type checking for MULTIANEWARRAY
3 Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 Contact: cacao@cacaojvm.org
27 Authors: Edwin Steiner
34 classinfo *arrayclass;
35 arraydescriptor *desc;
38 /* check the array lengths on the stack */
39 i = state->iptr->s1.argcount;
41 #if !defined(TYPECHECK_TYPEINFERER)
43 VERIFY_ERROR("Illegal dimension argument");
46 TYPECHECK_INT(state->iptr->sx.s23.s2.args[i]);
48 #endif /* !defined(TYPECHECK_TYPEINFERER) */
50 /* check array descriptor */
51 if (INSTRUCTION_IS_RESOLVED(state->iptr)) {
52 /* the array class reference has already been resolved */
53 arrayclass = state->iptr->sx.s23.s3.c.cls;
55 VERIFY_ERROR("MULTIANEWARRAY with unlinked class");
56 if ((desc = arrayclass->vftbl->arraydesc) == NULL)
57 VERIFY_ERROR("MULTIANEWARRAY with non-array class");
58 if (desc->dimension < state->iptr->s1.argcount)
59 VERIFY_ERROR("MULTIANEWARRAY dimension to high");
61 /* set the array type of the result */
62 typeinfo_init_classinfo(&(dv->typeinfo), arrayclass);
66 constant_classref *cr;
68 /* the array class reference is still unresolved */
69 /* check that the reference indicates an array class of correct dimension */
70 cr = state->iptr->sx.s23.s3.c.ref;
75 /* { the dimension of the array class == i } */
76 #if !defined(TYPECHECK_TYPEINFERER)
78 VERIFY_ERROR("MULTIANEWARRAY with non-array class");
79 if (i < state->iptr->s1.argcount)
80 VERIFY_ERROR("MULTIANEWARRAY dimension to high");
81 #endif /* !defined(TYPECHECK_TYPEINFERER) */
83 /* set the array type of the result */
84 if (!typeinfo_init_class(&(dv->typeinfo),CLASSREF_OR_CLASSINFO(cr)))
95 * These are local overrides for various environment variables in Emacs.
96 * Please do not remove this and leave it at the end of the file, where
97 * Emacs will automagically detect them.
98 * ---------------------------------------------------------------------
101 * indent-tabs-mode: t
105 * vim:noexpandtab:sw=4:ts=4:filetype=c: