From: twisti Date: Wed, 25 Apr 2007 19:20:13 +0000 (+0000) Subject: * src/threads/lock-common.h: New file. X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=28ae2be767ce84d4a4c47c92a2ddbd2010cac04f;p=cacao.git * src/threads/lock-common.h: New file. * src/threads/native/lock.h: Removed function prototypes. * src/threads/none/lock.h (LOCK_INIT_OBJECT_LOCK): Added. * src/mm/memory.c, src/native/jni.c, src/native/native.c, src/native/vm/java_lang_Object.c, src/native/vm/java_lang_Thread.c, src/threads/Makefile.am, src/threads/native/threads.c, src/threads/threads-common.c, src/toolbox/avl.c, src/toolbox/hashtable.c, src/toolbox/list.c, src/vm/builtin.c, src/vm/finalizer.c, src/vm/initialize.c, src/vm/jit/inline/inline.c, src/vm/jit/jit.c, src/vm/jit/optimizing/recompile.c, src/vm/jit/parse.c, src/vm/jit/patcher.h, src/vm/jit/show.c, src/vm/jit/x86_64/codegen.c, src/vm/jit/x86_64/emit.c, src/vm/string.c, src/vmcore/class.c, src/vmcore/classcache.c, src/vmcore/linker.c, src/vmcore/loader.c, src/vmcore/suck.c, src/vmcore/utf8.c: Updated headers. --- diff --git a/src/mm/memory.c b/src/mm/memory.c index 0ae00bd6a..0f257dd3f 100644 --- a/src/mm/memory.c +++ b/src/mm/memory.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: memory.c 7811 2007-04-25 18:33:30Z twisti $ + $Id: memory.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -48,22 +48,19 @@ #include "arch.h" #include "mm/memory.h" + #include "native/native.h" -#if defined(ENABLE_THREADS) -# include "threads/threads-common.h" - -# include "threads/native/lock.h" -# include "threads/native/threads.h" -#else -# include "threads/none/lock.h" -#endif +#include "threads/lock-common.h" +#include "threads/threads-common.h" #include "toolbox/logging.h" + #include "vm/exceptions.h" #include "vm/global.h" #include "vm/stringlocal.h" #include "vm/vm.h" + #include "vmcore/options.h" #if defined(ENABLE_STATISTICS) diff --git a/src/native/jni.c b/src/native/jni.c index 8ef0f526f..57b2351dd 100644 --- a/src/native/jni.c +++ b/src/native/jni.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: jni.c 7722 2007-04-16 15:57:21Z twisti $ + $Id: jni.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -84,13 +84,8 @@ # include "native/vm/java_lang_ClassLoader.h" #endif -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -# include "threads/native/threads.h" -#else -# include "threads/none/lock.h" -# include "threads/none/threads.h" -#endif +#include "threads/lock-common.h" +#include "threads/threads-common.h" #include "toolbox/logging.h" diff --git a/src/native/native.c b/src/native/native.c index 10773546b..ede33333b 100644 --- a/src/native/native.c +++ b/src/native/native.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: native.c 7808 2007-04-25 15:12:20Z twisti $ + $Id: native.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -44,11 +44,7 @@ #include "native/include/java_lang_String.h" #include "native/include/java_lang_Throwable.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#else -# include "threads/none/lock.h" -#endif +#include "threads/lock-common.h" #include "toolbox/hashtable.h" #include "toolbox/logging.h" diff --git a/src/native/vm/java_lang_Object.c b/src/native/vm/java_lang_Object.c index 83f5f7570..adadd0d0b 100644 --- a/src/native/vm/java_lang_Object.c +++ b/src/native/vm/java_lang_Object.c @@ -47,9 +47,7 @@ #include "native/include/java_lang_Object.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#endif +#include "threads/lock-common.h" #include "vm/builtin.h" diff --git a/src/native/vm/java_lang_Thread.c b/src/native/vm/java_lang_Thread.c index aeba0e8ec..ee13ad558 100644 --- a/src/native/vm/java_lang_Thread.c +++ b/src/native/vm/java_lang_Thread.c @@ -43,6 +43,7 @@ # include "native/include/java_lang_VMThread.h" #endif +#include "threads/lock-common.h" #include "threads/threads-common.h" #include "toolbox/logging.h" diff --git a/src/threads/Makefile.am b/src/threads/Makefile.am index 412c3f5bf..f8e34c8d0 100644 --- a/src/threads/Makefile.am +++ b/src/threads/Makefile.am @@ -22,7 +22,7 @@ ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -## $Id: Makefile.am 7365 2007-02-15 19:42:13Z twisti $ +## $Id: Makefile.am 7813 2007-04-25 19:20:13Z twisti $ ## Process this file with automake to produce Makefile.in @@ -46,6 +46,7 @@ noinst_LTLIBRARIES = \ libthreads_la_SOURCES = \ critical.c \ critical.h \ + lock-common.h \ threads-common.c \ threads-common.h diff --git a/src/threads/lock-common.h b/src/threads/lock-common.h new file mode 100644 index 000000000..433c16db8 --- /dev/null +++ b/src/threads/lock-common.h @@ -0,0 +1,84 @@ +/* src/threads/lock-common.h - common stuff of lock implementation + + Copyright (C) 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 + + This file is part of CACAO. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + $Id: threads.h 4866 2006-05-01 21:40:38Z edwin $ + +*/ + + +#ifndef _LOCK_COMMON_H +#define _LOCK_COMMON_H + +#include "config.h" +#include "vm/types.h" + +#include "vm/global.h" + +#if defined(ENABLE_THREADS) +# include "threads/native/lock.h" +#else +# include "threads/none/lock.h" +#endif + + +/* functions ******************************************************************/ + +void lock_init(void); + +void lock_init_execution_env(struct threadobject *thread); +void lock_record_free_pools(lock_record_pool_t *pool); + +void lock_init_object_lock(java_objectheader *); +lock_record_t *lock_get_initial_lock_word(void); + +ptrint lock_pre_compute_thinlock(s4 index); + +bool lock_monitor_enter(java_objectheader *); +bool lock_monitor_exit(java_objectheader *); + +#define LOCK_monitor_enter (functionptr) lock_monitor_enter +#define LOCK_monitor_exit (functionptr) lock_monitor_exit + +bool lock_is_held_by_current_thread(java_objectheader *o); + +void lock_wait_for_object(java_objectheader *o, s8 millis, s4 nanos); +void lock_notify_object(java_objectheader *o); +void lock_notify_all_object(java_objectheader *o); + +#endif /* _LOCK_COMMON_H */ + + +/* + * These are local overrides for various environment variables in Emacs. + * Please do not remove this and leave it at the end of the file, where + * Emacs will automagically detect them. + * --------------------------------------------------------------------- + * Local variables: + * mode: c + * indent-tabs-mode: t + * c-basic-offset: 4 + * tab-width: 4 + * End: + * vim:noexpandtab:sw=4:ts=4: + */ diff --git a/src/threads/native/lock.h b/src/threads/native/lock.h index abc5a5810..89eea9c03 100644 --- a/src/threads/native/lock.h +++ b/src/threads/native/lock.h @@ -135,33 +135,13 @@ extern lock_record_pool_t *lock_global_pool; #endif -/* functions ******************************************************************/ +/* defines *********************************************************************/ -void lock_init(void); - -void lock_init_execution_env(struct threadobject *thread); -void lock_record_free_pools(lock_record_pool_t *pool); - -void lock_init_object_lock(java_objectheader *); -lock_record_t *lock_get_initial_lock_word(void); - -ptrint lock_pre_compute_thinlock(s4 index); - -bool lock_monitor_enter(java_objectheader *); -bool lock_monitor_exit(java_objectheader *); - -#define LOCK_monitor_enter (functionptr) lock_monitor_enter -#define LOCK_monitor_exit (functionptr) lock_monitor_exit +#define LOCK_INIT_OBJECT_LOCK(o) lock_init_object_lock((java_objectheader *) (o)) #define LOCK_MONITOR_ENTER(o) lock_monitor_enter((java_objectheader *) (o)) #define LOCK_MONITOR_EXIT(o) lock_monitor_exit((java_objectheader *) (o)) -bool lock_is_held_by_current_thread(java_objectheader *o); - -void lock_wait_for_object(java_objectheader *o, s8 millis, s4 nanos); -void lock_notify_object(java_objectheader *o); -void lock_notify_all_object(java_objectheader *o); - #endif /* _LOCK_H */ diff --git a/src/threads/native/threads.c b/src/threads/native/threads.c index 0d1a6d40c..11e52b4a4 100644 --- a/src/threads/native/threads.c +++ b/src/threads/native/threads.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: threads.c 7811 2007-04-25 18:33:30Z twisti $ + $Id: threads.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -71,6 +71,7 @@ # include "native/include/java_lang_VMThread.h" #endif +#include "threads/lock-common.h" #include "threads/threads-common.h" #include "threads/native/threads.h" diff --git a/src/threads/none/lock.h b/src/threads/none/lock.h index b671bd7e6..c8f8424d2 100644 --- a/src/threads/none/lock.h +++ b/src/threads/none/lock.h @@ -30,7 +30,9 @@ #ifndef _LOCK_H #define _LOCK_H -/* define some stuff we need to no-ops ****************************************/ +/* define some stuff to no-ops *************************************************/ + +#define LOCK_INIT_OBJECT_LOCK(o) #define LOCK_MONITOR_ENTER(o) #define LOCK_MONITOR_EXIT(o) diff --git a/src/threads/threads-common.c b/src/threads/threads-common.c index ff0b7ec16..a32864efd 100644 --- a/src/threads/threads-common.c +++ b/src/threads/threads-common.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: threads-common.c 7811 2007-04-25 18:33:30Z twisti $ + $Id: threads-common.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -43,6 +43,7 @@ # include "native/include/java_lang_VMThread.h" #endif +#include "threads/lock-common.h" #include "threads/threads-common.h" #include "threads/native/threads.h" diff --git a/src/toolbox/avl.c b/src/toolbox/avl.c index 15337fa43..e561d0adf 100644 --- a/src/toolbox/avl.c +++ b/src/toolbox/avl.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: avl.c 7246 2007-01-29 18:49:05Z twisti $ + $Id: avl.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -34,13 +34,10 @@ #include "vm/types.h" #include "mm/memory.h" -#include "toolbox/avl.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#else -# include "threads/none/lock.h" -#endif +#include "threads/lock-common.h" + +#include "toolbox/avl.h" /* avl_create ****************************************************************** @@ -64,7 +61,7 @@ avl_tree *avl_create(avl_comparator *compar) t->lock = NEW(java_objectheader); - lock_init_object_lock(t->lock); + LOCK_INIT_OBJECT_LOCK(t->lock); #endif return t; diff --git a/src/toolbox/hashtable.c b/src/toolbox/hashtable.c index d6d7bf185..4c394c79c 100644 --- a/src/toolbox/hashtable.c +++ b/src/toolbox/hashtable.c @@ -1,4 +1,4 @@ -/* src/vm/hashtable.c - functions for internal hashtables +/* 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, @@ -22,14 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Contact: cacao@cacaojvm.org - - Authors: Reinhard Grafl - Mark Probst - Andreas Krall - Christian Thalinger - - $Id: hashtable.c 7246 2007-01-29 18:49:05Z twisti $ + $Id: hashtable.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -39,11 +32,10 @@ #include "mm/memory.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#endif +#include "threads/lock-common.h" #include "toolbox/hashtable.h" + #include "vm/global.h" @@ -65,7 +57,7 @@ void hashtable_create(hashtable *hash, u4 size) hash->header = NEW(java_objectheader); - lock_init_object_lock(hash->header); + LOCK_INIT_OBJECT_LOCK(hash->header); #endif /* set initial hash values */ diff --git a/src/toolbox/list.c b/src/toolbox/list.c index e5a46d5c3..60ef8d9cb 100644 --- a/src/toolbox/list.c +++ b/src/toolbox/list.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: list.c 7784 2007-04-20 13:51:41Z twisti $ + $Id: list.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -35,11 +35,7 @@ #include "mm/memory.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#else -# include "threads/none/lock.h" -#endif +#include "threads/lock-common.h" #include "toolbox/list.h" diff --git a/src/vm/builtin.c b/src/vm/builtin.c index 9100cb529..da6a392b3 100644 --- a/src/vm/builtin.c +++ b/src/vm/builtin.c @@ -28,7 +28,7 @@ calls instead of machine instructions, using the C calling convention. - $Id: builtin.c 7785 2007-04-21 10:55:30Z edwin $ + $Id: builtin.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -59,9 +59,7 @@ #include "native/include/java_lang_String.h" #include "native/include/java_lang_Throwable.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#endif +#include "threads/lock-common.h" #include "toolbox/logging.h" #include "toolbox/util.h" diff --git a/src/vm/finalizer.c b/src/vm/finalizer.c index f0636efdd..56aa43c7e 100644 --- a/src/vm/finalizer.c +++ b/src/vm/finalizer.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: finalizer.c 7811 2007-04-25 18:33:30Z twisti $ + $Id: finalizer.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -35,15 +35,8 @@ #include "mm/memory.h" -#if defined(ENABLE_THREADS) -# include "threads/threads-common.h" - -# include "threads/native/threads.h" -# include "threads/native/lock.h" -#else -# include "threads/none/threads.h" -# include "threads/none/lock.h" -#endif +#include "threads/lock-common.h" +#include "threads/threads-common.h" #include "vm/builtin.h" #include "vm/exceptions.h" @@ -75,7 +68,7 @@ bool finalizer_init(void) #if defined(ENABLE_THREADS) lock_thread_finalizer = NEW(java_objectheader); - lock_init_object_lock(lock_thread_finalizer); + LOCK_INIT_OBJECT_LOCK(lock_thread_finalizer); #endif /* everything's ok */ diff --git a/src/vm/initialize.c b/src/vm/initialize.c index 366f85f9d..9619b9656 100644 --- a/src/vm/initialize.c +++ b/src/vm/initialize.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: initialize.c 7246 2007-01-29 18:49:05Z twisti $ + $Id: initialize.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -33,11 +33,7 @@ #include "vm/types.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#else -# include "threads/none/lock.h" -#endif +#include "threads/lock-common.h" #include "vm/global.h" #include "vm/initialize.h" diff --git a/src/vm/jit/inline/inline.c b/src/vm/jit/inline/inline.c index cbda14347..b790fe4db 100644 --- a/src/vm/jit/inline/inline.c +++ b/src/vm/jit/inline/inline.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: inline.c 7766 2007-04-19 13:24:48Z michi $ + $Id: inline.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -38,9 +38,8 @@ #include "mm/memory.h" -#if defined(ENABLE_THREADS) -# include "threads/native/threads.h" -#endif +#include "threads/lock-common.h" +#include "threads/threads-common.h" #include "toolbox/logging.h" @@ -340,10 +339,9 @@ static bool inline_jit_compile(inline_node *iln) m = iln->m; assert(m); -#if defined(ENABLE_THREADS) /* enter a monitor on the method */ - lock_monitor_enter((java_objectheader *) m); -#endif + + LOCK_MONITOR_ENTER(m); /* allocate jitdata structure and fill it */ @@ -384,10 +382,9 @@ static bool inline_jit_compile(inline_node *iln) #endif -#if defined(ENABLE_THREADS) /* leave the monitor */ - lock_monitor_exit((java_objectheader *) m ); -#endif + + LOCK_MONITOR_EXIT(m); return r; } diff --git a/src/vm/jit/jit.c b/src/vm/jit/jit.c index 9e5092640..b830a93d6 100644 --- a/src/vm/jit/jit.c +++ b/src/vm/jit/jit.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: jit.c 7692 2007-04-12 14:47:24Z twisti $ + $Id: jit.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -34,14 +34,12 @@ #include "vm/types.h" #include "mm/memory.h" + #include "native/native.h" + #include "toolbox/logging.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#else -# include "threads/none/lock.h" -#endif +#include "threads/lock-common.h" #include "vm/global.h" #include "vm/initialize.h" diff --git a/src/vm/jit/optimizing/recompile.c b/src/vm/jit/optimizing/recompile.c index e1754d5ae..fc04c7337 100644 --- a/src/vm/jit/optimizing/recompile.c +++ b/src/vm/jit/optimizing/recompile.c @@ -36,12 +36,8 @@ #include "mm/memory.h" -#if defined(ENABLE_THREADS) -# include "threads/threads-common.h" - -# include "threads/native/lock.h" -# include "threads/native/threads.h" -#endif +#include "threads/lock-common.h" +#include "threads/threads-common.h" #include "toolbox/list.h" diff --git a/src/vm/jit/parse.c b/src/vm/jit/parse.c index 2575c3308..49655c68c 100644 --- a/src/vm/jit/parse.c +++ b/src/vm/jit/parse.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: parse.c 7766 2007-04-19 13:24:48Z michi $ + $Id: parse.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -35,11 +35,10 @@ #include "vm/types.h" #include "mm/memory.h" + #include "native/native.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#endif +#include "threads/lock-common.h" #include "toolbox/logging.h" diff --git a/src/vm/jit/patcher.h b/src/vm/jit/patcher.h index 9b2c5916c..a321ce7fe 100644 --- a/src/vm/jit/patcher.h +++ b/src/vm/jit/patcher.h @@ -1,6 +1,6 @@ /* src/vm/jit/patcher.h - code patching functions - 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 @@ -22,13 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Contact: cacao@cacaojvm.org - - Authors: Christian Thalinger - - Changes: Edwin Steiner - - $Id: patcher.h 5929 2006-11-06 17:13:40Z twisti $ + $Id: patcher.h 7813 2007-04-25 19:20:13Z twisti $ */ @@ -42,9 +36,7 @@ #include "vm/types.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#endif +#include "threads/lock-common.h" #include "vm/global.h" diff --git a/src/vm/jit/show.c b/src/vm/jit/show.c index d577b2b38..12f28753f 100644 --- a/src/vm/jit/show.c +++ b/src/vm/jit/show.c @@ -35,11 +35,7 @@ #include "mm/memory.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#else -# include "threads/none/lock.h" -#endif +#include "threads/lock-common.h" #include "vm/global.h" #include "vm/builtin.h" @@ -83,7 +79,7 @@ bool show_init(void) show_global_lock = NEW(java_objectheader); - lock_init_object_lock(show_global_lock); + LOCK_INIT_OBJECT_LOCK(show_global_lock); #endif /* everything's ok */ diff --git a/src/vm/jit/x86_64/codegen.c b/src/vm/jit/x86_64/codegen.c index 382aca99a..cc68156a3 100644 --- a/src/vm/jit/x86_64/codegen.c +++ b/src/vm/jit/x86_64/codegen.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: codegen.c 7754 2007-04-17 23:18:15Z twisti $ + $Id: codegen.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -41,12 +41,11 @@ #include "vm/jit/x86_64/emit.h" #include "mm/memory.h" + #include "native/jni.h" #include "native/native.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#endif +#include "threads/lock-common.h" #include "vm/builtin.h" #include "vm/exceptions.h" diff --git a/src/vm/jit/x86_64/emit.c b/src/vm/jit/x86_64/emit.c index a7d9f0017..f7bfc5f90 100644 --- a/src/vm/jit/x86_64/emit.c +++ b/src/vm/jit/x86_64/emit.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: emit.c 7766 2007-04-19 13:24:48Z michi $ + $Id: emit.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -39,9 +39,7 @@ #include "mm/memory.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#endif +#include "threads/lock-common.h" #include "vm/builtin.h" #include "vm/exceptions.h" diff --git a/src/vm/string.c b/src/vm/string.c index a9b1d1a33..1d127f76f 100644 --- a/src/vm/string.c +++ b/src/vm/string.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: string.c 7522 2007-03-14 21:54:49Z twisti $ + $Id: string.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -41,11 +41,7 @@ #include "native/include/java_lang_String.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#else -# include "threads/none/lock.h" -#endif +#include "threads/lock-common.h" #include "vm/builtin.h" #include "vm/exceptions.h" @@ -86,7 +82,7 @@ bool string_init(void) lock_hashtable_string = NEW(java_objectheader); - lock_init_object_lock(lock_hashtable_string); + LOCK_INIT_OBJECT_LOCK(lock_hashtable_string); #endif /* everything's ok */ diff --git a/src/vmcore/class.c b/src/vmcore/class.c index bc77f9130..364b49397 100644 --- a/src/vmcore/class.c +++ b/src/vmcore/class.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: class.c 7783 2007-04-20 13:28:27Z twisti $ + $Id: class.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -40,9 +40,7 @@ #include "mm/memory.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#endif +#include "threads/lock-common.h" #include "toolbox/logging.h" @@ -239,9 +237,7 @@ classinfo *class_create_classinfo(utf *classname) if (classname != utf_not_named_yet) class_set_packagename(c); -#if defined(ENABLE_THREADS) - lock_init_object_lock(&c->object.header); -#endif + LOCK_INIT_OBJECT_LOCK(&c->object.header); return c; } diff --git a/src/vmcore/classcache.c b/src/vmcore/classcache.c index 0b26cc5c1..93107b50b 100644 --- a/src/vmcore/classcache.c +++ b/src/vmcore/classcache.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: classcache.c 7560 2007-03-23 18:51:41Z twisti $ + $Id: classcache.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -35,9 +35,7 @@ #include "mm/memory.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#endif +#include "threads/lock-common.h" #include "toolbox/hashtable.h" #include "toolbox/logging.h" @@ -266,7 +264,7 @@ bool classcache_init(void) lock_hashtable_classcache = NEW(java_objectheader); - lock_init_object_lock(lock_hashtable_classcache); + LOCK_INIT_OBJECT_LOCK(lock_hashtable_classcache); #endif /* everything's ok */ diff --git a/src/vmcore/linker.c b/src/vmcore/linker.c index 54ac99758..cf991f1de 100644 --- a/src/vmcore/linker.c +++ b/src/vmcore/linker.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: linker.c 7810 2007-04-25 16:39:03Z stefan $ + $Id: linker.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -34,13 +34,10 @@ #include "vm/types.h" #include "mm/memory.h" + #include "native/native.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#else -# include "threads/none/lock.h" -#endif +#include "threads/lock-common.h" #include "toolbox/logging.h" @@ -134,10 +131,13 @@ bool linker_init(void) interfaceindex = 0; +#if defined(ENABLE_THREADS) /* create the global lock object */ linker_classrenumber_lock = NEW(java_objectheader); - lock_init_object_lock(linker_classrenumber_lock); + + LOCK_INIT_OBJECT_LOCK(linker_classrenumber_lock); +#endif /* 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 diff --git a/src/vmcore/loader.c b/src/vmcore/loader.c index d95aa34d2..a15f37199 100644 --- a/src/vmcore/loader.c +++ b/src/vmcore/loader.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: loader.c 7692 2007-04-12 14:47:24Z twisti $ + $Id: loader.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -37,9 +37,7 @@ #include "mm/memory.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#endif +#include "threads/lock-common.h" #include "toolbox/logging.h" @@ -94,7 +92,7 @@ bool loader_init(void) for (lce = list_first(list_classpath_entries); lce != NULL; lce = list_next(list_classpath_entries, lce)) if (lce->type == CLASSPATH_ARCHIVE) - lock_init_object_lock((java_objectheader *) lce); + LOCK_INIT_OBJECT_LOCK(lce); #endif /* load some important classes */ diff --git a/src/vmcore/suck.c b/src/vmcore/suck.c index 2fb8fee62..48613d720 100644 --- a/src/vmcore/suck.c +++ b/src/vmcore/suck.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: suck.c 7783 2007-04-20 13:28:27Z twisti $ + $Id: suck.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -40,11 +40,7 @@ #include "mm/memory.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#else -# include "threads/none/lock.h" -#endif +#include "threads/lock-common.h" #include "toolbox/list.h" #include "toolbox/logging.h" diff --git a/src/vmcore/utf8.c b/src/vmcore/utf8.c index 3251e5924..65a412656 100644 --- a/src/vmcore/utf8.c +++ b/src/vmcore/utf8.c @@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: utf8.c 7716 2007-04-16 14:29:53Z twisti $ + $Id: utf8.c 7813 2007-04-25 19:20:13Z twisti $ */ @@ -36,11 +36,7 @@ #include "mm/memory.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#else -# include "threads/none/lock.h" -#endif +#include "threads/lock-common.h" #include "toolbox/hashtable.h"