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
};
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++;
}
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;
break;
}
}
-#if defined(ENABLE_THREADS)
- builtin_monitorexit(lock_hashtable_patchersupers);
-#endif
+
+ LOCK_MONITOR_EXIT(lock_hashtable_patchersupers);
}
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++;
}