/* src/vm/jit/verify/typeinfo.c - type system used by the type checker
- Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+ 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
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Edwin Steiner
-
- $Id: typeinfo.c 5738 2006-10-11 19:42:07Z edwin $
-
*/
#include <string.h>
#include "mm/memory.h"
+
#include "toolbox/logging.h"
-#include "vm/class.h"
-#include "vm/loader.h"
+
+#include "vm/array.h"
+#include "vm/exceptions.h"
+#include "vm/primitive.h"
+#include "vm/resolve.h"
+
#include "vm/jit/jit.h"
#include "vm/jit/verify/typeinfo.h"
-#include "vm/descriptor.h"
-#include "vm/resolve.h"
-#include "vm/exceptions.h"
+
+#include "vmcore/class.h"
+#include "vmcore/descriptor.h"
+#include "vmcore/loader.h"
/* check if a linked class is an array class. Only use for linked classes! */
typevector_store(varinfo *vec,int index,int type,typeinfo *info)
{
TYPEINFO_ASSERT(vec);
- TYPEINFO_ASSERT((info && !TYPEINFO_IS_PRIMITIVE(*info)) || type != TYPE_ADR);
vec[index].type = type;
if (info)
/* check arguments */
for (i=0; i<desc->paramcount; ++i) {
if (++args > buflen) {
- *exceptionptr = new_internalerror("Buffer too small for method arguments.");
+ exceptions_throw_internalerror("Buffer too small for method arguments.");
return false;
}
if (twoword && (typebuf[-1] == TYPE_LNG || typebuf[-1] == TYPE_DBL)) {
if (++args > buflen) {
- *exceptionptr = new_internalerror("Buffer too small for method arguments.");
+ exceptions_throw_internalerror("Buffer too small for method arguments.");
return false;
}
typedescriptor *returntype)
{
s4 i;
- s4 index;
+ s4 varindex;
s4 type;
s4 slot = 0;
/* check arguments */
for (i=startindex; i<desc->paramcount; ++i) {
type = desc->paramtypes[i].type;
- index = map[5*slot + type];
+ varindex = map[5*slot + type];
slot++;
if (IS_2_WORD_TYPE(type))
slot++;
- if (index == UNUSED)
+ if (varindex == UNUSED)
continue;
- if (index >= buflen) {
- *exceptionptr = new_internalerror("Buffer too small for method arguments.");
+ if (varindex >= buflen) {
+ exceptions_throw_internalerror("Buffer too small for method arguments.");
return false;
}
- if (!typeinfo_init_varinfo_from_typedesc(vars + index, desc->paramtypes + i))
+ if (!typeinfo_init_varinfo_from_typedesc(vars + varindex, desc->paramtypes + i))
return false;
}
/* check arguments */
for (i=startindex; i<desc->paramcount; ++i) {
if (++args > buflen) {
- *exceptionptr = new_internalerror("Buffer too small for method arguments.");
+ exceptions_throw_internalerror("Buffer too small for method arguments.");
return -1;
}
if (twoword && (td[-1].type == TYPE_LNG || td[-1].type == TYPE_DBL)) {
if (++args > buflen) {
- *exceptionptr = new_internalerror("Buffer too small for method arguments.");
+ exceptions_throw_internalerror("Buffer too small for method arguments.");
return -1;
}
if (!TYPEINFO_IS_ARRAY(*srcarray)) {
/* XXX should we make that a verify error? */
- *exceptionptr = new_internalerror("Trying to access component of non-array");
+ exceptions_throw_internalerror("Trying to access component of non-array");
return false;
}
typeinfo_print(stderr,x,1);
fprintf(stderr,"Typeinfo y:\n");
typeinfo_print(stderr,y,1);
+ log_text(str);
#endif
- log_text(str);
exceptions_throw_verifyerror(m, str);
}
else {
common.cls = class_multiarray_of(dimension,pseudo_class_Arraystub,true);
if (!common.cls) {
- *exceptionptr = new_internalerror("XXX Coult not create array class");
+ exceptions_throw_internalerror("XXX Coult not create array class");
return typecheck_FAIL;
}
else {
common.cls = class_multiarray_of(dimension,elementclass.cls,true);
if (!common.cls) {
- *exceptionptr = new_internalerror("XXX Coult not create array class");
+ exceptions_throw_internalerror("XXX Coult not create array class");
return typecheck_FAIL;
}
}
case TYPE_FLT: fprintf(file,"F"); break;
case TYPE_DBL: fprintf(file,"D"); break;
case TYPE_LNG: fprintf(file,"J"); break;
+ case TYPE_RET: fprintf(file,"R:"); /* FALLTHROUGH! */
case TYPE_ADR:
typeinfo_print_short(file,info);
break;