/* src/toolbox/hashtable.c - functions for internal hashtables
- 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.
#include "config.h"
#include "vm/types.h"
-#include "mm/memory.h"
+#include "mm/memory.hpp"
-#include "threads/lock-common.h"
+#include "threads/mutex.hpp"
#include "toolbox/hashtable.h"
Initializes a hashtable structure and allocates memory. The
parameter size specifies the initial size of the hashtable.
-
+
*******************************************************************************/
void hashtable_create(hashtable *hash, u4 size)
/* initialize locking pointer */
#if defined(ENABLE_THREADS)
- /* We need to seperately allocate a java_object_t here, as we
- need to store the lock object in the new hashtable if it's
- resized. Otherwise we get an IllegalMonitorStateException. */
-
- hash->header = NEW(java_object_t);
+ /* We need to seperately allocate a mutex here, as we need to
+ store the lock object in the new hashtable if it's resized.
+ Otherwise we get an IllegalMonitorStateException. */
- LOCK_INIT_OBJECT_LOCK(hash->header);
+ hash->mutex = Mutex_new();
#endif
/* set initial hash values */
/* We need to store the old lock object in the new hashtable.
Otherwise we get an IllegalMonitorStateException. */
- FREE(newhash->header, java_object_t);
+ Mutex_delete(newhash->mutex);
- newhash->header = hash->header;
+ newhash->mutex = hash->mutex;
#endif
/* store the number of entries in the new hashtable */