* 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.
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 $
*/
#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)
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 $
*/
# 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"
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 $
*/
#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"
#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"
# include "native/include/java_lang_VMThread.h"
#endif
+#include "threads/lock-common.h"
#include "threads/threads-common.h"
#include "toolbox/logging.h"
## 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
libthreads_la_SOURCES = \
critical.c \
critical.h \
+ lock-common.h \
threads-common.c \
threads-common.h
--- /dev/null
+/* 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:
+ */
#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 */
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 $
*/
# include "native/include/java_lang_VMThread.h"
#endif
+#include "threads/lock-common.h"
#include "threads/threads-common.h"
#include "threads/native/threads.h"
#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)
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 $
*/
# include "native/include/java_lang_VMThread.h"
#endif
+#include "threads/lock-common.h"
#include "threads/threads-common.h"
#include "threads/native/threads.h"
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 $
*/
#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 ******************************************************************
t->lock = NEW(java_objectheader);
- lock_init_object_lock(t->lock);
+ LOCK_INIT_OBJECT_LOCK(t->lock);
#endif
return t;
-/* 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,
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 $
*/
#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"
hash->header = NEW(java_objectheader);
- lock_init_object_lock(hash->header);
+ LOCK_INIT_OBJECT_LOCK(hash->header);
#endif
/* set initial hash values */
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 $
*/
#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"
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 $
*/
#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"
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 $
*/
#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"
#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 */
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 $
*/
#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"
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 $
*/
#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"
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 */
#endif
-#if defined(ENABLE_THREADS)
/* leave the monitor */
- lock_monitor_exit((java_objectheader *) m );
-#endif
+
+ LOCK_MONITOR_EXIT(m);
return r;
}
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 $
*/
#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"
#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"
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 $
*/
#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"
/* 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
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 $
*/
#include "vm/types.h"
-#if defined(ENABLE_THREADS)
-# include "threads/native/lock.h"
-#endif
+#include "threads/lock-common.h"
#include "vm/global.h"
#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"
show_global_lock = NEW(java_objectheader);
- lock_init_object_lock(show_global_lock);
+ LOCK_INIT_OBJECT_LOCK(show_global_lock);
#endif
/* everything's ok */
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 $
*/
#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"
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 $
*/
#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"
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 $
*/
#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"
lock_hashtable_string = NEW(java_objectheader);
- lock_init_object_lock(lock_hashtable_string);
+ LOCK_INIT_OBJECT_LOCK(lock_hashtable_string);
#endif
/* everything's ok */
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 $
*/
#include "mm/memory.h"
-#if defined(ENABLE_THREADS)
-# include "threads/native/lock.h"
-#endif
+#include "threads/lock-common.h"
#include "toolbox/logging.h"
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;
}
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 $
*/
#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"
lock_hashtable_classcache = NEW(java_objectheader);
- lock_init_object_lock(lock_hashtable_classcache);
+ LOCK_INIT_OBJECT_LOCK(lock_hashtable_classcache);
#endif
/* everything's ok */
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 $
*/
#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"
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
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 $
*/
#include "mm/memory.h"
-#if defined(ENABLE_THREADS)
-# include "threads/native/lock.h"
-#endif
+#include "threads/lock-common.h"
#include "toolbox/logging.h"
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 */
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 $
*/
#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"
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 $
*/
#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"