Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: loader.c 8299 2007-08-13 08:41:18Z michi $
+ $Id: loader.c 8324 2007-08-16 16:48:12Z michi $
*/
#include "mm/memory.h"
+#include "native/llni.h"
+
#include "threads/lock-common.h"
#include "toolbox/hashtable.h"
*******************************************************************************/
-classloader *loader_hashtable_classloader_add(java_objectheader *cl)
+classloader *loader_hashtable_classloader_add(java_handle_t *cl)
{
hashtable_classloader_entry *cle;
u4 key;
LOCK_MONITOR_ENTER(hashtable_classloader->header);
+ LLNI_CRITICAL_START;
+
/* key for entry is the hashcode of the classloader;
aligned to 16-byte boundaries */
#if defined(ENABLE_GC_CACAO)
- key = heap_get_hashcode(cl) >> 4;
+ key = heap_get_hashcode(LLNI_direct(cl)) >> 4;
#else
key = ((u4) (ptrint) cl) >> 4;
#endif
cle = hashtable_classloader->ptr[slot];
/* search hashchain for existing entry */
- /* XXX no GC collection is allowed here, make this a critical section */
while (cle) {
- if (cle->object == cl)
+ if (cle->object == LLNI_direct(cl))
break;
cle = cle->hashlink;
}
+ LLNI_CRITICAL_END;
+
/* if no classloader was found, we create a new entry here */
if (cle == NULL) {
gc_reference_register(&(cle->object));
#endif
- cle->object = cl;
+ LLNI_CRITICAL_START;
+
+ cle->object = LLNI_direct(cl);
+
+ LLNI_CRITICAL_END;
/* insert entry into hashtable */
*******************************************************************************/
-classloader *loader_hashtable_classloader_find(java_objectheader *cl)
+classloader *loader_hashtable_classloader_find(java_handle_t *cl)
{
hashtable_classloader_entry *cle;
u4 key;
if (cl == NULL)
return NULL;
+ LLNI_CRITICAL_START;
+
/* key for entry is the hashcode of the classloader;
aligned to 16-byte boundaries */
#if defined(ENABLE_GC_CACAO)
- key = heap_get_hashcode(cl) >> 4;
+ key = heap_get_hashcode(LLNI_direct(cl)) >> 4;
#else
key = ((u4) (ptrint) cl) >> 4;
#endif
cle = hashtable_classloader->ptr[slot];
/* search hashchain for existing entry */
- /* XXX no GC collection is allowed here, make this a critical section */
while (cle) {
- if (cle->object == cl)
+ if (cle->object == LLNI_direct(cl))
break;
cle = cle->hashlink;
}
+ LLNI_CRITICAL_END;
+
return cle;
}
RT_TIMING_GET_TIME(time_prepare);
- o = vm_call_method(lc, cl->object, string);
+ o = vm_call_method(lc, (java_handle_t *) cl, string);
RT_TIMING_GET_TIME(time_java);