/* src/vm/classcache.h - loaded class cache and loading constraints
- 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
+ Copyright (C) 1996-2005, 2006, 2007, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA.
-
- Contact: cacao@complang.tuwien.ac.at
-
- Authors: Edwin Steiner
-
- Changes:
-
- $Id: classcache.h 3808 2005-11-26 22:28:43Z edwin $
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
*/
#ifndef _CLASSCACHE_H
#define _CLASSCACHE_H
+#include "config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "vm/types.h"
+
#include <stdio.h> /* for FILE */
+#if defined(ENABLE_JVMTI)
+# include "native/jni.h"
+#endif
+
+#include "toolbox/hashtable.h"
+
+#include "vm/class.h"
+#include "vm/global.h"
+#include "vm/loader.h"
#include "vm/references.h"
-#include "vm/tables.h"
/* forward declarations *******************************************************/
typedef struct classcache_class_entry classcache_class_entry;
typedef struct classcache_loader_entry classcache_loader_entry;
-typedef java_objectheader classloader;
-
/* global variables ***********************************************************/
-extern hashtable classcache_hash;
+extern hashtable hashtable_classcache;
-/* structs ********************************************************************/
+/* structs ********************************************************************/
/*----------------------------------------------------------------------------*/
/* The Loaded Class Cache */
/* class name to this class object in the future */
/* */
/* The classcache_class_entry:s approximate the equivalence classes created */
-/* by the loading constraints and (XXX?) the equivalence of loaded classes. */
+/* by the loading constraints and the equivalence of loaded classes. */
/* */
/* When a loading constraint (loaderA,loaderB,NAME) is added, then the */
/* classcache_class_entry:s for NAME containing loaderA and loaderB resp. */
struct classcache_loader_entry
{
- classloader *loader; /* class loader object */
+ classloader_t *loader; /* class loader object */
classcache_loader_entry *next; /* next loader entry in the list */
};
+
+/* callback function type for classcache_foreach_loaded_class */
+
+typedef void (*classcache_foreach_functionptr_t)(classinfo *, void *);
+
+
/* function prototypes ********************************************************/
/* initialize the loaded class cache */
bool classcache_init(void);
-void classcache_free();
+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);
+classinfo * classcache_lookup(classloader_t *initloader,utf *classname);
+classinfo * classcache_lookup_defined(classloader_t *defloader,utf *classname);
+classinfo * classcache_lookup_defined_or_initiated(classloader_t *loader,utf *classname);
bool classcache_store_unique(classinfo *cls);
-classinfo * classcache_store(classloader *initloader,classinfo *cls,bool mayfree);
+classinfo * classcache_store(classloader_t *initloader,classinfo *cls,bool mayfree);
classinfo * classcache_store_defined(classinfo *cls);
-bool classcache_add_constraint(classloader *a,classloader *b,utf *classname);
+#if defined(ENABLE_VERIFIER)
+bool classcache_add_constraint(classloader_t *a,classloader_t *b,utf *classname);
+bool classcache_add_constraints_for_params(classloader_t *a,classloader_t *b,
+ methodinfo *m);
+#endif
+
+s4 classcache_get_loaded_class_count(void);
+
+void classcache_foreach_loaded_class(classcache_foreach_functionptr_t func,
+ void *data);
-void classcache_debug_dump(FILE *file);
+#if defined(ENABLE_JVMTI)
+void classcache_get_loaded_classes(s4 *class_count_ptr,
+ classinfo ***classes_ptr);
+#endif
+
+#ifndef NDEBUG
+void classcache_debug_dump(FILE *file,utf *only);
+#endif
+#ifdef __cplusplus
+}
+#endif
+
#endif /* _CLASSCACHE_H */
/*