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
35 classinfo *arrayclass;
36 arraydescriptor *desc;
39 /* check the array lengths on the stack */
40 i = state->iptr->s1.argcount;
42 #if !defined(TYPECHECK_TYPEINFERER)
44 VERIFY_ERROR("Illegal dimension argument");
47 TYPECHECK_INT(state->iptr->sx.s23.s2.args[i]);
49 #endif /* !defined(TYPECHECK_TYPEINFERER) */
51 /* check array descriptor */
52 if (INSTRUCTION_IS_RESOLVED(state->iptr)) {
53 /* the array class reference has already been resolved */
54 arrayclass = state->iptr->sx.s23.s3.c.cls;
56 VERIFY_ERROR("MULTIANEWARRAY with unlinked class");
57 if ((desc = arrayclass->vftbl->arraydesc) == NULL)
58 VERIFY_ERROR("MULTIANEWARRAY with non-array class");
59 if (desc->dimension < state->iptr->s1.argcount)
60 VERIFY_ERROR("MULTIANEWARRAY dimension to high");
62 /* set the array type of the result */
63 typeinfo_init_classinfo(&(dv->typeinfo), arrayclass);
67 constant_classref *cr;
69 /* the array class reference is still unresolved */
70 /* check that the reference indicates an array class of correct dimension */
71 cr = state->iptr->sx.s23.s3.c.ref;
76 /* { the dimension of the array class == i } */
77 #if !defined(TYPECHECK_TYPEINFERER)
79 VERIFY_ERROR("MULTIANEWARRAY with non-array class");
80 if (i < state->iptr->s1.argcount)
81 VERIFY_ERROR("MULTIANEWARRAY dimension to high");
82 #endif /* !defined(TYPECHECK_TYPEINFERER) */
84 /* set the array type of the result */
85 if (!typeinfo_init_class(&(dv->typeinfo),CLASSREF_OR_CLASSINFO(cr)))
96 * These are local overrides for various environment variables in Emacs.
97 * Please do not remove this and leave it at the end of the file, where
98 * Emacs will automagically detect them.
99 * ---------------------------------------------------------------------
102 * indent-tabs-mode: t
106 * vim:noexpandtab:sw=4:ts=4:filetype=c: