* Added ENABLE_INTRP define (this is more like a hack, maybe this should be
[cacao.git] / src / vm / tables.c
index 71e18b637e4447964830be7237ca300dc9b5deb1..21437fbe09b1782f864fb163c016ff2f2bb5dd6a 100644 (file)
@@ -1,4 +1,4 @@
-/* vm/tables.c - 
+/* src/vm/tables.c - 
 
    Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
    R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
@@ -28,6 +28,7 @@
 
    Changes: Mark Probst
             Andreas Krall
+            Christian Thalinger
 
    Contains support functions for:
        - Reading of Java class files
@@ -35,7 +36,7 @@
        - the heap
        - additional support functions
 
-   $Id: tables.c 1930 2005-02-10 10:54:28Z twisti $
+   $Id: tables.c 2505 2005-05-23 08:23:40Z twisti $
 
 */
 
@@ -59,6 +60,7 @@
 #include "vm/statistics.h"
 #include "vm/stringlocal.h"
 #include "vm/tables.h"
+#include "vm/classcache.h"
 
 
 hashtable string_hash;  /* hashtable for javastrings  */
@@ -105,7 +107,8 @@ void tables_init()
 {
        init_hashtable(&utf_hash,    UTF_HASHSTART);  /* hashtable for utf8-symbols */
        init_hashtable(&string_hash, HASHSTART);      /* hashtable for javastrings */
-       init_hashtable(&class_hash,  HASHSTART);      /* hashtable for classes */ 
+
+       classcache_init();
 
 /*     if (opt_eager) */
 /*             list_init(&unlinkedclasses, OFFSET(classinfo, listnode)); */
@@ -128,6 +131,8 @@ void tables_close()
        utf *u = NULL;
        literalstring *s;
        u4 i;
+
+       classcache_free();
        
        /* dispose utf symbols */
        for (i = 0; i < utf_hash.size; i++) {
@@ -156,7 +161,6 @@ void tables_close()
        /* dispose hashtable structures */
        MFREE(utf_hash.ptr,    void*, utf_hash.size);
        MFREE(string_hash.ptr, void*, string_hash.size);
-       MFREE(class_hash.ptr,  void*, class_hash.size);
 }
 
 
@@ -175,9 +179,11 @@ void tables_close()
 u2 desc_to_type(utf *descriptor)
 {
        char *utf_ptr = descriptor->text;  /* current position in utf text */
-       char logtext[MAXLOGTEXT];
 
-       if (descriptor->blength < 1) panic("Type-Descriptor is empty string");
+       if (descriptor->blength < 1) {
+               log_text("Type-Descriptor is empty string");
+               assert(0);
+       }
        
        switch (*utf_ptr++) {
        case 'B': 
@@ -192,9 +198,7 @@ u2 desc_to_type(utf *descriptor)
        case '[':  return TYPE_ADDRESS;
        }
                        
-       sprintf(logtext, "Invalid Type-Descriptor: ");
-       utf_sprint(logtext+strlen(logtext), descriptor);
-       error("%s",logtext);
+       assert(0);
 
        return 0;
 }