Merged subtype branch to new head.
[cacao.git] / src / toolbox / hashtable.c
index fa3519266676ba0822cbc8d7f40b5e136baac8e1..dd49f3de543a65e191c909da805d04ab9c5764df 100644 (file)
@@ -1,9 +1,7 @@
 /* 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.
 
@@ -22,8 +20,6 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: hashtable.c 8295 2007-08-11 17:57:24Z michi $
-
 */
 
 
@@ -32,7 +28,7 @@
 
 #include "mm/memory.h"
 
-#include "threads/lock-common.h"
+#include "threads/mutex.hpp"
 
 #include "toolbox/hashtable.h"
 
@@ -43,7 +39,7 @@
 
    Initializes a hashtable structure and allocates memory. The
    parameter size specifies the initial size of the hashtable.
-       
+
 *******************************************************************************/
 
 void hashtable_create(hashtable *hash, u4 size)
@@ -51,13 +47,11 @@ 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 */
@@ -91,9 +85,9 @@ hashtable *hashtable_resize(hashtable *hash, u4 size)
        /* 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 */