* Removed all Id tags.
[cacao.git] / src / vm / jit / intrp / dynamic-super.c
index 8f01b4e5be47dada53aaaf9f557d559af32027d6..923a9f510a7f2339d4a6dfe21e0f6811824ddae5 100644 (file)
@@ -3,7 +3,7 @@
    Copyright (C) 1995,1996,1997,1998,2000,2003,2004 Free Software Foundation, Inc.
    Taken from Gforth.
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   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
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
-
-   Contact: cacao@cacaojvm.org
-
-   Authors: Christian Thalinger
-            Anton Ertl
-
-   Changes:
-
-   $Id: dynamic-super.c 4953 2006-05-25 12:28:51Z twisti $
 */
 
 
 #include <stdlib.h>
 #include <assert.h>
 
+#include "vm/types.h"
+
 #include "mm/memory.h"
 
 #if defined(ENABLE_THREADS)
-# include "threads/native/threads.h"
+# include "threads/native/lock.h"
+#else
+# include "threads/none/lock.h"
 #endif
 
+#include "toolbox/hashtable.h"
 #include "toolbox/logging.h"
-#include "vm/builtin.h"
-#include "vm/hashtable.h"
-#include "vm/options.h"
-#include "vm/types.h"
+
 #include "vm/jit/disass.h"
 #include "vm/jit/intrp/intrp.h"
 
+#include "vmcore/options.h"
+
 
 s4 no_super=0;   /* option: just use replication, but no dynamic superinsts */
 
 static char MAYBE_UNUSED superend[]={
-#include "java-superend.i"
+#include <java-superend.i>
 };
 
 const char * const prim_names[]={
-#include "java-names.i"
+#include <java-names.i>
 };
 
 enum {
 #define INST_ADDR(_inst) N_##_inst
-#include "java-labels.i"
+#include <java-labels.i>
 #undef INST_ADDR
 };
 
@@ -372,14 +367,14 @@ static void superreuse_insert(u1 *code, u4 length)
   superreuse *sr = NEW(superreuse);
   sr->code = code;
   sr->length = length;
-#if defined(ENABLE_THREADS)
-  builtin_monitorenter(lock_hashtable_superreuse);
-#endif
+
+  LOCK_MONITOR_ENTER(lock_hashtable_superreuse);
+
   sr->next = *listp;
   *listp = sr;
-#if defined(ENABLE_THREADS)
-  builtin_monitorexit(lock_hashtable_superreuse);
-#endif
+
+  LOCK_MONITOR_EXIT(lock_hashtable_superreuse);
+
   count_supers_unique++;
 }
 
@@ -410,9 +405,9 @@ void patchersuper_rewrite(Inst *p)
   superstart **listp = (superstart **)&hashtable_patchersupers.ptr[slot];
   superstart *ss;
   count_patchers_exec++;
-#if defined(ENABLE_THREADS)
-  builtin_monitorenter(lock_hashtable_patchersupers);
-#endif
+
+  LOCK_MONITOR_ENTER(lock_hashtable_patchersupers);
+
   for (; ss=*listp,  ss!=NULL; listp = &(ss->next)) {
     if (p == ((Inst *)(ss->mcodebase + ss->patcherm))) {
       Inst target;
@@ -429,9 +424,8 @@ void patchersuper_rewrite(Inst *p)
       break;
     }
   }
-#if defined(ENABLE_THREADS)
-  builtin_monitorexit(lock_hashtable_patchersupers);
-#endif
+
+  LOCK_MONITOR_EXIT(lock_hashtable_patchersupers);
 }
 
 static void hashtable_patchersupers_insert(superstart *ss)
@@ -440,14 +434,14 @@ static void hashtable_patchersupers_insert(superstart *ss)
   u4 slot = ((key + (key>>HASHTABLE_PATCHERSUPERS_BITS)) & 
              ((1<<HASHTABLE_PATCHERSUPERS_BITS)-1));
   void **listp = &hashtable_patchersupers.ptr[slot];
-#if defined(ENABLE_THREADS)
-  builtin_monitorenter(lock_hashtable_patchersupers);
-#endif
+
+  LOCK_MONITOR_ENTER(lock_hashtable_patchersupers);
+
   ss->next = (superstart *)*listp;
   *listp = (void *)ss;
-#if defined(ENABLE_THREADS)
-  builtin_monitorexit(lock_hashtable_patchersupers);
-#endif
+
+  LOCK_MONITOR_EXIT(lock_hashtable_patchersupers);
+
   count_patchers_ins++;
 }