* renamed CACAO_TYPECHECK to ENABLE_VERIFIER
[cacao.git] / src / vm / classcache.h
index 127e85bd8450f7aa5e75cc0921add15bb39bc08e..3907c9aab7d8a46a6fdcc2709f1126fe173a5a44 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: classcache.h 2181 2005-04-01 16:53:33Z edwin $
+   $Id: classcache.h 3810 2005-11-27 14:11:44Z edwin $
 
 */
 
@@ -39,6 +39,7 @@
 #include <stdio.h>  /* for FILE */
 
 #include "vm/references.h"
+#include "vm/tables.h"
 
 
 /* forward declarations *******************************************************/
@@ -49,6 +50,10 @@ typedef struct classcache_loader_entry classcache_loader_entry;
 
 typedef java_objectheader classloader;
 
+/* global variables ***********************************************************/
+
+extern hashtable classcache_hash;
+
 /* structs ********************************************************************/
 
 
@@ -92,7 +97,7 @@ typedef java_objectheader classloader;
 struct classcache_name_entry
 {
        utf                     *name;        /* class name                       */
-       classcache_name_entry   *hashlink;        /* link for external chaining       */
+       classcache_name_entry   *hashlink;    /* link for external chaining       */
        classcache_class_entry  *classes;     /* equivalence classes for this name*/
 };
 
@@ -112,85 +117,20 @@ struct classcache_loader_entry
 
 /* function prototypes ********************************************************/
 
-/* classcache_init *************************************************************
-   Initialize the loaded class cache
-  
-*******************************************************************************/
-
-void classcache_init();
-
-/* classcache_free *************************************************************
-   Free the memory used by the class cache
-
-   NOTE:
-       The class cache may not be used any more after this call, except
-          when it is reinitialized with classcache_init.
-  
-*******************************************************************************/
-
-void classcache_free();
-
-/* classcache_lookup ***********************************************************
-   Lookup a possibly loaded class
-  
-   IN:
-       initloader.......initiating loader for resolving the class name
-       classname........class name to look up
-  
-   RETURN VALUE:
-       The return value is a pointer to the cached class object,
-       or NULL, if the class is not in the cache.
-   
-*******************************************************************************/
+/* initialize the loaded class cache */
+bool classcache_init(void);
+void classcache_free(void);
 
 classinfo * classcache_lookup(classloader *initloader,utf *classname);
+classinfo * classcache_lookup_defined(classloader *defloader,utf *classname);
+classinfo * classcache_lookup_defined_or_initiated(classloader *loader,utf *classname);
 
-/* classcache_store ************************************************************
-   
-   Store a loaded class
-  
-   IN:
-       initloader.......initiating loader used to load the class
-       cls..............class object to cache
-  
-   RETURN VALUE:
-       true.............everything ok, the class was stored in
-                        the cache if necessary,
-       false............an exception has been thrown.
-   
-*******************************************************************************/
-
-bool classcache_store(classloader *initloader,classinfo *cls);
-
-/* classcache_add_constraint ***************************************************
-   Add a loading constraint
-  
-   IN:
-       a................first initiating loader
-       b................second initiating loader
-       classname........class name
-  
-   RETURN VALUE:
-       true.............everything ok, the constraint has been added,
-       false............an exception has been thrown.
-   
-*******************************************************************************/
+bool classcache_store_unique(classinfo *cls);
+classinfo * classcache_store(classloader *initloader,classinfo *cls,bool mayfree);
+classinfo * classcache_store_defined(classinfo *cls);
 
 bool classcache_add_constraint(classloader *a,classloader *b,utf *classname);
 
-/* classcache_debug_dump *******************************************************
-   Print the contents of the loaded class cache to a stream
-  
-   IN:
-       file.............output stream
-  
-*******************************************************************************/
-
 void classcache_debug_dump(FILE *file);
        
 #endif /* _CLASSCACHE_H */