/* src/vmcore/loader.c - class loader functions
- 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
+ Copyright (C) 1996-2005, 2006, 2007, 2008
+ CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
{
#if defined(ENABLE_THREADS)
list_classpath_entry *lce;
+#endif
+
+ TRACESUBSYSTEMINITIALIZATION("loader_preinit");
+#if defined(ENABLE_THREADS)
/* Initialize the monitor pointer for zip/jar file locking. */
for (lce = list_first(list_classpath_entries); lce != NULL;
void loader_init(void)
{
+ TRACESUBSYSTEMINITIALIZATION("loader_init");
+
/* Load primitive-type wrapping classes. */
assert(vm_initializing == true);
load_class_bootstrap(utf_new_char("java/lang/VMThrowable"));
#endif
+ /* Important system exceptions. */
+
+ class_java_lang_Exception = load_class_bootstrap(utf_java_lang_Exception);
+
+ class_java_lang_ClassNotFoundException =
+ load_class_bootstrap(utf_java_lang_ClassNotFoundException);
+
+ class_java_lang_RuntimeException =
+ load_class_bootstrap(utf_java_lang_RuntimeException);
+
/* Some classes which may be used often. */
#if defined(ENABLE_JAVASE)
class_java_security_PrivilegedAction =
load_class_bootstrap(utf_new_char("java/security/PrivilegedAction"));
+ class_java_util_HashMap =
+ load_class_bootstrap(utf_new_char("java/util/HashMap"));
+
class_java_util_Vector = load_class_bootstrap(utf_java_util_Vector);
# if defined(WITH_CLASSPATH_SUN)
/* key for entry is the hashcode of the classloader;
aligned to 16-byte boundaries */
-#if defined(ENABLE_GC_CACAO)
- key = heap_get_hashcode(LLNI_DIRECT(cl)) >> 4;
-#else
- key = ((u4) (ptrint) cl) >> 4;
-#endif
-
+ key = heap_hashcode(LLNI_DIRECT(cl)) >> 4;
slot = key & (hashtable_classloader->size - 1);
cle = hashtable_classloader->ptr[slot];
/* key for entry is the hashcode of the classloader;
aligned to 16-byte boundaries */
-#if defined(ENABLE_GC_CACAO)
- key = heap_get_hashcode(LLNI_DIRECT(cl)) >> 4;
-#else
- key = ((u4) (ptrint) cl) >> 4;
-#endif
-
+ key = heap_hashcode(LLNI_DIRECT(cl)) >> 4;
slot = key & (hashtable_classloader->size - 1);
cle = hashtable_classloader->ptr[slot];
/* XXX This should be done better. */
tc = resolve_classref_or_classinfo_eager(CLASSREF_OR_CLASSINFO(cr), false);
- if (tc == NULL)
+ if (tc == NULL) {
+ resolve_handle_pending_exception(true);
return false;
+ }
/* Interfaces are not allowed as super classes. */
/* XXX This should be done better. */
tc = resolve_classref_or_classinfo_eager(CLASSREF_OR_CLASSINFO(cr), false);
- if (tc == NULL)
+ if (tc == NULL) {
+ resolve_handle_pending_exception(true);
return false;
+ }
/* Detect circularity. */
classinfo *load_class_from_classbuffer(classbuffer *cb)
{
classinfo *c;
- int32_t dumpsize;
bool result;
+ int32_t dumpmarker;
/* Get the classbuffer's class. */
/* Mark start of dump memory area. */
- dumpsize = dump_size();
+ DMARKER;
/* Class is currently loading. */
/* Release dump area. */
- dump_release(dumpsize);
+ DRELEASE;
/* An error occurred. */