* Removed all Id tags.
[cacao.git] / src / vm / jit / verify / typeinfo.c
index 95fd6b2baf015ac7af955fc8e51579a0640b7322..3d0a47888fc582644cd9ca2a1e5292a6735a8e8e 100644 (file)
@@ -1,6 +1,6 @@
 /* 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 6073 2006-11-28 19:24:06Z 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! */
@@ -1053,7 +1053,7 @@ typeinfos_init_from_methoddesc(methoddesc *desc,u1 *typebuf,typeinfo *infobuf,
     /* 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;
                }
 
@@ -1062,7 +1062,7 @@ typeinfos_init_from_methoddesc(methoddesc *desc,u1 *typebuf,typeinfo *infobuf,
                
                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;
                        }
 
@@ -1191,7 +1191,7 @@ typeinfo_init_varinfos_from_methoddesc(varinfo *vars,
                                                                         typedescriptor *returntype)
 {
        s4 i;
-    s4 index;
+    s4 varindex;
        s4 type;
        s4 slot = 0;
 
@@ -1205,21 +1205,21 @@ typeinfo_init_varinfos_from_methoddesc(varinfo *vars,
     /* 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;
     }
 
@@ -1275,7 +1275,7 @@ typedescriptors_init_from_methoddesc(typedescriptor *td,
     /* 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;
                }
 
@@ -1285,7 +1285,7 @@ typedescriptors_init_from_methoddesc(typedescriptor *td,
 
                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;
                        }
 
@@ -1335,7 +1335,7 @@ typeinfo_init_component(typeinfo *srcarray,typeinfo *dst)
     
     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;
        }
 
@@ -2051,7 +2051,7 @@ return_simple:
             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;
                                }
 
@@ -2082,7 +2082,7 @@ return_simple:
                                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;
                                        }
                                }