* src/vm/global.h (compiler_lock, compiler_unlock): Removed.
authormichi <none@none>
Thu, 5 Apr 2007 14:23:04 +0000 (14:23 +0000)
committermichi <none@none>
Thu, 5 Apr 2007 14:23:04 +0000 (14:23 +0000)
* src/cacaoh/dummy.c (compiler_lock, compiler_unlock): Removed.
* src/threads/native/threads.c (compiler_lock, compiler_unlock): Removed.

* src/vmcore/linker.h (linker_classrenumber_lock): Added.
* src/vmcore/linker.c (linker_classrenumber_lock): Added.
(linker_compute_subclasses): Uses above lock object instead of compiler_lock.

* src/vm/jit/intrp/asmpart.c (intrp_asm_getclassvalues_atomic): Likewise.

src/cacaoh/dummy.c
src/threads/native/threads.c
src/vm/global.h
src/vm/jit/intrp/asmpart.c
src/vmcore/linker.c
src/vmcore/linker.h

index 7dceda8555b76573b8775eae7dd82bbe74b0790a..6356d0f46b419d9986b2717e3f05d29817cde18c 100644 (file)
 char *_Jv_bootclasspath;
 
 
-void compiler_lock()
-{
-}
-
-void compiler_unlock()
-{
-}
-
 java_objectheader *javastring_new_slash_to_dot(utf *u)
 {
        vm_abort("javastring_new_slash_to_dot");
index d6bb7e9f4f4fe53ffabf5917a1e69811088fea98..4454fca4ec93fc2cdec7f0b5229a55f607c91fd0 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: threads.c 7669 2007-04-05 11:39:58Z twisti $
+   $Id: threads.c 7675 2007-04-05 14:23:04Z michi $
 
 */
 
@@ -240,9 +240,6 @@ pthread_key_t threads_current_threadobject_key;
 /* global threads table                                                       */
 static threads_table_t threads_table;
 
-/* global compiler mutex                                                      */
-static pthread_mutex_t compiler_mutex;
-
 /* global mutex for changing the thread list                                  */
 static pthread_mutex_t threadlistlock;
 
@@ -350,30 +347,6 @@ void threads_sem_post(sem_t *sem)
 }
 
 
-/* compiler_lock ***************************************************************
-
-   Enter the compiler lock.
-
-******************************************************************************/
-
-void compiler_lock(void)
-{
-       pthread_mutex_lock(&compiler_mutex);
-}
-
-
-/* compiler_unlock *************************************************************
-
-   Release the compiler lock.
-
-******************************************************************************/
-
-void compiler_unlock(void)
-{
-       pthread_mutex_unlock(&compiler_mutex);
-}
-
-
 /* lock_stopworld **************************************************************
 
    Enter the stopworld lock, specifying why the world shall be stopped.
@@ -666,12 +639,6 @@ threadobject *threads_get_current_threadobject(void)
 
 void threads_preinit(void)
 {
-       pthread_mutexattr_t mutexattr;
-       pthread_mutexattr_init(&mutexattr);
-       pthread_mutexattr_settype(&mutexattr, PTHREAD_MUTEX_RECURSIVE);
-       pthread_mutex_init(&compiler_mutex, &mutexattr);
-       pthread_mutexattr_destroy(&mutexattr);
-
        pthread_mutex_init(&threadlistlock, NULL);
        pthread_mutex_init(&stopworldlock, NULL);
 
index c85227c5217862331d776f6b035670dbf3465226..a55b753b1e640a9b29af7a720c50fc15e3156586 100644 (file)
@@ -32,7 +32,7 @@
             Joseph Wenninger
             Christian Thalinger
 
-   $Id: global.h 7561 2007-03-23 19:10:35Z twisti $
+   $Id: global.h 7675 2007-04-05 14:23:04Z michi $
 
 */
 
@@ -322,14 +322,6 @@ struct java_objectarray {
 };
 
 
-/* Synchronization ************************************************************/
-
-#if defined(ENABLE_THREADS)
-void compiler_lock();
-void compiler_unlock();
-#endif
-
-
 /* global constants related to the verifier ***********************************/
 
 /* The verifier needs additional variables in the variable array. Since these */
index 52ec0d470acac331d8535efd2928a613aa5a3c4d..085c39deca064cc5a9b963fab34960284061ca5b 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: asmpart.c 7357 2007-02-14 11:35:59Z twisti $
+   $Id: asmpart.c 7675 2007-04-05 14:23:04Z michi $
 
 */
 
@@ -50,6 +50,7 @@
 #include "vm/jit/dseg.h"
 
 #include "vmcore/class.h"
+#include "vmcore/linker.h"
 #include "vmcore/loader.h"
 #include "vmcore/options.h"
 
@@ -307,17 +308,13 @@ void intrp_asm_getclassvalues_atomic(vftbl_t *super, vftbl_t *sub, castinfo *out
 {
        s4 sbv, sdv, sv;
 
-#if defined(ENABLE_THREADS)
-       compiler_lock();
-#endif
+       LOCK_MONITOR_ENTER(linker_classrenumber_lock);
 
        sbv = super->baseval;
        sdv = super->diffval;
        sv  = sub->baseval;
 
-#if defined(ENABLE_THREADS)
-       compiler_unlock();
-#endif
+       LOCK_MONITOR_EXIT(linker_classrenumber_lock);
 
        out->super_baseval = sbv;
        out->super_diffval = sdv;
index 4bd8aacf82faa09ea6bc8d30e7d9df61ad933862..1cfcfe91537ed96974a0950959a57277f212683e 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: linker.c 7561 2007-03-23 19:10:35Z twisti $
+   $Id: linker.c 7675 2007-04-05 14:23:04Z michi $
 
 */
 
@@ -77,6 +77,8 @@ classinfo *resolve_classref_or_classinfo_eager(classref_or_classinfo cls, bool c
 static s4 interfaceindex;       /* sequential numbering of interfaces         */
 static s4 classvalue;
 
+java_objectheader *linker_classrenumber_lock;
+
 
 /* primitivetype_table *********************************************************
 
@@ -132,6 +134,10 @@ bool linker_init(void)
 
        interfaceindex = 0;
 
+       /* create the global lock object */
+
+       linker_classrenumber_lock = NEW(java_objectheader);
+
        /* link java.lang.Class as first class of the system, because we
        need it's vftbl for all other classes so we can use a class as
        object */
@@ -1205,9 +1211,7 @@ static arraydescriptor *link_array(classinfo *c)
 
 static void linker_compute_subclasses(classinfo *c)
 {
-#if defined(ENABLE_THREADS)
-       compiler_lock();
-#endif
+       LOCK_MONITOR_ENTER(linker_classrenumber_lock);
 
        if (!(c->flags & ACC_INTERFACE)) {
                c->nextsub = NULL;
@@ -1225,9 +1229,7 @@ static void linker_compute_subclasses(classinfo *c)
 
        linker_compute_class_values(class_java_lang_Object);
 
-#if defined(ENABLE_THREADS)
-       compiler_unlock();
-#endif
+       LOCK_MONITOR_EXIT(linker_classrenumber_lock);
 }
 
 
index efd6b2ed2721664b0ed62e1f17e25e56f0e90f0a..f2b5b7e808f8cecb9c5e5f0d78c31b4f742cd0b8 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: linker.h 7246 2007-01-29 18:49:05Z twisti $
+   $Id: linker.h 7675 2007-04-05 14:23:04Z michi $
 */
 
 
@@ -155,6 +155,11 @@ struct primitivetypeinfo {
 
 extern primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT];
 
+/* This lock must be taken while renumbering classes or while atomically      */
+/* accessing classes.                                                         */
+
+extern java_objectheader *linker_classrenumber_lock;
+
 
 /* function prototypes ********************************************************/