GNU header update.
[cacao.git] / src / vm / jit / verify / typeinfo.c
index 6fdbc2274fcf802b2dbd69caec0571d98749bb0f..500d74ea1179ce7db81d4aeb4b95aeaa0ecafee2 100644 (file)
@@ -1,9 +1,9 @@
-/* typeinfo.c - type system used by the type checker
+/* vm/jit/verify/typeinfo.c - type system used by the type checker
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-   R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
-   M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
-   P. Tomsich, J. Wenninger
+   Copyright (C) 1996-2005 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.
 
 
    Authors: Edwin Steiner
 
-   $Id: typeinfo.c 1035 2004-04-26 16:26:35Z twisti $
+   $Id: typeinfo.c 1735 2004-12-07 14:33:27Z twisti $
 
 */
 
 
-#include <stdlib.h>
 #include <string.h>
-#include "typeinfo.h"
-#include "tables.h"
-#include "loader.h"
-#include "toolbox/loging.h"
-#include "toolbox/memory.h"
-#include "jit/jit.h" /* XXX move typeinfo.* into jit/ */
+
+#include "mm/memory.h"
+#include "toolbox/logging.h"
+#include "vm/loader.h"
+#include "vm/tables.h"
+#include "vm/jit/jit.h"
+#include "vm/jit/verify/typeinfo.h"
 
 
 #define CLASS_IMPLEMENTS_INTERFACE(cls,index)                   \
@@ -370,6 +370,14 @@ static
 bool
 classinfo_implements_interface(classinfo *cls,classinfo *interf)
 {
+       if (!cls->loaded)
+               if (!class_load(cls))
+                       return false;
+
+       if (!cls->linked)
+               if (!class_link(cls))
+                       return false;
+
     if (cls->flags & ACC_INTERFACE) {
         /* cls is an interface */
         if (cls == interf)
@@ -745,7 +753,7 @@ typedescriptors_init_from_method_args(typedescriptor *td,
 void
 typeinfo_init_component(typeinfo *srcarray,typeinfo *dst)
 {
-    vftbl *comp = NULL;
+    vftbl_t *comp = NULL;
 
     if (TYPEINFO_IS_NULLTYPE(*srcarray)) {
         TYPEINFO_INIT_NULLTYPE(*dst);
@@ -1031,6 +1039,24 @@ typeinfo_merge_nonarrays(typeinfo *dest,
 #endif
     */ 
 
+       /* check clsx */
+       if (!clsx->loaded)
+               if (!class_load(clsx))
+                       return false;
+
+       if (!clsx->linked)
+               if (!class_link(clsx))
+                       return false;
+
+       /* check clsy */
+       if (!clsy->loaded)
+               if (!class_load(clsy))
+                       return false;
+
+       if (!clsy->linked)
+               if (!class_link(clsy))
+                       return false;
+
     /* Common case: clsx == clsy */
     /* (This case is very simple unless *both* x and y really represent
      *  merges of subclasses of clsx==clsy.)