Commit Graph

26 Commits

Author SHA1 Message Date
Richard Henderson 169bb110d3 posix-threads.h <__alpha__> (_Jv_ThreadId_t): Use void*.
* include/posix-threads.h <__alpha__> (_Jv_ThreadId_t): Use void*.
        (_Jv_ThreadSelf): Use __builtin_thread_pointer.

From-SVN: r88894
2004-10-11 10:49:39 -07:00
Jerry Quinn 16a10fb6fc posix-threads.cc (_Jv_CondNotify,_Jv_CondNotifyAll): Rename _Jv_PthreadCheckMonitor to _Jv_MutexCheckMonitor.
2003-10-21  Jerry Quinn  <jlquinn@optonline.net>

        * posix-threads.cc (_Jv_CondNotify,_Jv_CondNotifyAll): Rename
        _Jv_PthreadCheckMonitor to _Jv_MutexCheckMonitor.
	* include/no-threads.h (_Jv_MutexCheckMonitor): New.
	* include/posix-threads.h (_Jv_MutexCheckMonitor): Rename from
        _Jv_PthreadCheckMonitor.  Simplify code.
	(_Jv_MutexUnlock): Use _Jv_MutexCheckMonitor.
	* include/win32-threads.h (_Jv_MutexCheckMonitor): New.
	* java/lang/Object.h (_Jv_ObjectCheckMonitor): Declare.
	* java/lang/Thread.java (holdsLock): New.
	* java/lang/natObject.cc (_Jv_ObjectCheckMonitor): New, with and
        without JV_HASH_SYNCHRONIZATION.
	* java/lang/natThread.cc (java::lang::Thread::holdsLock): New.

From-SVN: r72741
2003-10-21 04:46:19 +00:00
Bert Deknuydt ad23ad2cbe posix-threads.h: Include <machine/pal.h> on OSF.
2003-06-05  Bert Deknuydt  <Bert.Deknuydt@esat.kuleuven.ac.be>

	* include/posix-threads.h: Include <machine/pal.h> on OSF.

From-SVN: r67491
2003-06-05 15:43:58 +00:00
Richard Henderson 6ad4639794 * include/posix-threads.h [alpha] (_Jv_ThreadSelf): Avoid a copy.
From-SVN: r51468
2002-03-27 11:25:04 -08:00
Loren J. Rittle b4a19310cd * include/posix-threads.h: Support <.../pal.h> on FreeBSD/alpha.
From-SVN: r51383
2002-03-26 11:26:13 +00:00
Bryce McKinlay 4559716751 Hashtable synchronization for PowerPC.
libjava:
	Hashtable synchronization for PowerPC.
	* configure.in: Define SLOW_PTHREAD_SELF if configure.host set
	slow_pthread_self. Set up symlink for sysdeps directory.
	* configure: Rebuild.
	* configure.host: Document more shell variables. Set sysdeps_dir
	for most platforms. Set slow_pthread_self for i686. Set
	enable_hash_synchronization_default and slow_pthread_self for PowerPC.
	* posix-threads.cc (_Jv_ThreadSelf_out_of_line): Use release_set so
	that memory barrier is emitted where required.
	* prims.cc: 64-bit align static primitive class instances.
	* include/posix-threads.h (_Jv_ThreadSelf for SLOW_PTHREAD_SELF): Add
	read_barrier() to enforce ordering of reads.
	* sysdep/powerpc/locks.h: New file. Implementation of synchronization
	primitives for PowerPC.
	* sysdep/i386/locks.h: New file. Synchronization primitives for i386
	moved from natObject.cc.
	* sysdep/alpha/locks.h: Likewise.
	* sysdep/ia64/locks.h: Likewise.
	* sysdep/generic/locks.h: Likewise.
	* java/lang/natObject.cc: Move thread synchronization primitives to
	system-dependent headers.
gcc/java:
	* decl.c (java_init_decl_processing): Make sure class_type_node
	alignment is not less than 64 bits if hash synchronization isenabled.

boehm-gc:
	* include/gc_priv.h: Define ALIGN_DOUBLE on 32 bit targets if GCJ
	support is enabled, for hash synchronization.

From-SVN: r50523
2002-03-10 03:53:16 +00:00
Jeff Sturm 092a1f5ab3 configure.host: Enable hash synchronization for alpha*-*.
* configure.host: Enable hash synchronization for alpha*-*.
* include/posix-threads.h (_Jv_ThreadSelf): Added inline function for alpha.
* java/lang/natObject.cc (compare_and_swap, release_set,
compare_and_swap_release): Added inline functions for alpha.

From-SVN: r44251
2001-07-23 03:51:17 +00:00
Tom Tromey 3610e0d548 [multiple changes]
2001-05-23  Tom Tromey  <tromey@redhat.com>

	* posix-threads.cc (_Jv_self_cache): Renamed from self_cache.
	* gcj/Makefile.in: Rebuilt.
	* gcj/Makefile.am (gcj_HEADERS): Added libgcj-config.h.
	* gcj/javaprims.h: Include gcj/libgcj-config.h.
	* gcj/libgcj-config.h.in: New file.
	* libgcj.spec.in (*jc1): Added @HASH_SYNC_SPEC@.
	* configure: Rebuilt.
	* configure.in: Enable hash synchronization by default on some
	platforms.
	(HASH_SYNC_SPEC): New subst.
	(AC_CONFIG_HEADER): Added gcj/libgcj-config.h.
	Correctly use `test -z' instead of `test -n' in a couple places.
	(JV_HASH_SYNCHRONIZATION): Use AC_DEFINE; don't add to
	LIBGCJ_CXXFLAGS.
	* configure.host (enable_java_net_default): Initialize.
	(enable_hash_synchronization_default): New variable.

2001-05-23  Hans Boehm <Hans_Boehm@hp.com>

	* boehm.cc (_Jv_MarkObj): Don't mark sync_info when hash
	synchronization in use.
	(_Jv_MarkArray): Likewise.
	(_Jv_AllocBytes): Don't check return result.
	(handle_out_of_memory): New function.
	(_Jv_InitGC): Set GC_oom_fn.
	(trace_one_vtable): New global.
	(_Jv_AllocTraceOne): New function.
	* configure.in: Added --enable-hash-synchronization.
	* defineclass.cc, prims.cc, resolve.cc, java/lang/natString.cc,
	java/net/natInetAddress.cc: Remove _Jv_AllocBytesChecked.
	* nogc.cc (_Jv_AllocObj): Throw out-of-memory.
	(_Jv_AllocArray): Likewise.
	(_Jv_AllocBytes): Likewise.
	(_Jv_AllocPtrFreeObject): New function.
	(_Jv_AllocTraceOne): Likewise.
	* posix-threads.cc (_Jv_ThreadRegister): Handle slow
	pthread_self().
	(self_cache): New global.
	(_Jv_ThreadSelf_out_of_line): New function.
	* prims.cc (_Jv_AllocBytesChecked): Removed.
	(_Jv_ThrowNoMemory): New function.
	(_Jv_AllocObject): Don't check for null return from allocator.
	(_Jv_NewObjectArray): Likewise.
	(_Jv_AllocPtrFreeObject): New function.
	(_Jv_NewPrimArray): Allocate pointer-free object if possible.
	* include/javaprims.h (_Jv_AllocPtrFreeObject): Declare.
	(_Jv_MonitorEnter, _Jv_MonitorExit): Don't return value.
	* include/boehm-gc.h (_Jv_AllocObj): Define.
	(_Jv_AllocPtrFreeObj): Define.
	* include/jvm.h (_Jv_AllocPtrFreeObj): Declare.
	(_Jv_ThrowNoMemory): Declare.
	(_Jv_AllocTraceOne): Declare.
	(_Jv_AllocBytesChecked): Removed.
	* include/posix-threads.h (_Jv_MutexInit, _Jv_MutexLock,
	_Jv_MutexUnlock): Handle LOCK_DEBUG.
	(_Jv_ThreadSelf): Handle case where system pthread_self() is
	slow.
	* java/lang/Class.h (Class): Declare _Jv_AllocPtrFreeObj as
	friend.
	* java/lang/Object.h (sync_info): Conditional upon presence of
	hash synchronization.
	* java/lang/natObject.cc: Much new code to handle thin locks and
	hash synchronization.
	* java/lang/natString.cc (_Jv_AllocString): Allocate pointer-free
	object if possible.

From-SVN: r42519
2001-05-24 05:40:37 +00:00
Per Bothner c93d7fae7b Implement invocation interface; don't create new thread for main.
From-SVN: r42428
2001-05-21 23:47:48 -07:00
Alexandre Petit-Bianco ec54a908e5 posix-threads.h (_Jv_CondInit): `0' used in place of `NULL.'
2001-05-18  Alexandre Petit-Bianco  <apbianco@redhat.com>

        * include/posix-threads.h (_Jv_CondInit): `0' used in place of `NULL.'
        (_Jv_MutexInit): Likewise.

(http://gcc.gnu.org/ml/java-patches/2001-q2/msg00245.html )

From-SVN: r42303
2001-05-18 22:43:00 -07:00
Bryce McKinlay e301621d19 For boehm-gc:
* configure.in: Rename THREADLIB to THREADLIBS.
	* Makefile.am (LINK): Add $(THREADLIBS) to libtool command line. This
	ensures that we link the correct version of the linuxthreads semaphore
	functions.
	* Makefile.in: Rebuilt.
	* configure: Rebuilt.

	* linux_thread.c (GC_thr_init, GC_suspend_handler): Add SIGABRT to the
	list of signals which are not blocked during suspend in the NO_SIGNALS
	case.

For libjava:
	* Makefile.am (libgcj_la_LIBADD): Add $(THREADLIBS). This ensures that
	the correct versions of various linuxthreads functions get linked.
	* Makefile.in: Rebuilt.
	* java/lang/natThread.cc (finalize_native): New static function. Call
	_Jv_ThreadDestroyData.
	(initialize_native): Register finalizer for "data".
	* include/posix-threads.h (_Jv_ThreadInitData): New simpler prototype.
	(_Jv_ThreadDestroyData): New prototype.
	* include/win32-threads.h: Ditto.
	* include/no-threads.h: Ditto.
	* posix-threads.cc (_Jv_ThreadInitData): Implement new prototype.
	(_Jv_ThreadDestroyData): New function. Free native thread "data" and
	move mutex and condition variable destroy code from:
	(really_start): ...here.
	(_Jv_ThreadStart): Set PTHREAD_CREATE_DETACHED.
	* win32-threads.cc (_Jv_ThreadInitData): Implement new prototype.
	(_Jv_ThreadDestroyData): Implemented.
	* nogc.cc (_Jv_AllocObject): Use "void *" not "ptr_t".
	(_Jv_AllocArray): Ditto.

From-SVN: r38557
2000-12-30 12:18:39 +00:00
Anthony Green e472b4f96b posix-threads.h (_Jv_MutexUnlock): Replace _JV_NOT_OWNER.
2000-04-08  Anthony Green  <green@cygnus.com>

	* include/posix-threads.h (_Jv_MutexUnlock): Replace
	_JV_NOT_OWNER.

From-SVN: r33039
2000-04-09 06:53:00 +00:00
Anthony Green 568fe067bc posix-threads.cc (_Jv_MutexLock): Moved back to posix-threads.h.
2000-04-08  Anthony Green  <green@cygnus.com>

	* posix-threads.cc (_Jv_MutexLock): Moved back to posix-threads.h.
	(_Jv_MutexUnlock): Ditto.
	* include/posix-threads.h (_Jv_MutexLock): From posix-threads.cc.
	(_Jv_MutexUnlock): Ditto.

From-SVN: r33037
2000-04-09 05:41:56 +00:00
Bryce McKinlay b834f1fa06 Makefile.in: New #defines and friends for Thread.h.
* Makefile.in: New #defines and friends for Thread.h.
        * posix-threads.cc: (struct starter): Remove `object'.
        (_Jv_CondWait): Use interruptable condition variables and new
        recursive mutexes. New return codes on interrupt or non-ownership
        of mutex.
        (_Jv_CondNotify): Ditto.
        (_Jv_CondNotifyAll): Ditto.
        (_Jv_ThreadInterrupt): Set thread interrupt flag directly. Interrupt
        the target thread by signaling its wait condition.
        (_Jv_ThreadInitData): Set `thread_obj' in the thread data struct,
        not the starter struct. Initialize wait_mutex and wait_cond.
        (_Jv_MutexLock): New recursive mutex implementation. Moved from
        posix-threads.h.
        (_Jv_MutexUnlock): Ditto.
        (really_start): Set info->data->thread from pthread_self() to work
        around a race condition. Destroy wait_mutex and wait_cond when run()
        returns.
        * java/lang/Thread.java: (isInterrupted_): Renamed to overloaded
        `isInterrupted(boolean)'. Clear interrupted flag if clear_flag is
        set.
        startable_flag: New private field.
        (Thread): Initialize `startable_flag'.
        (toString): Check for null thread group.
        * java/lang/natThread.cc: (struct natThread): New fields
        `join_mutex', `join_cond'. Removed fields `joiner', `next'.
        (class locker): Removed.
        (initialize_native): Initialize `join_cond' and `join_mutex'.
        (interrupt): Now just calls _Jv_ThreadInterrupt().
        (join): Simplified. Just wait on the target thread's join condition.
        (finish_): Remove join list code. Unset thread group. Signal
        potential joiners by notifying the dying threads join_cond.
        (start): Check for illegal restarts.
        * java/lang/natObject.cc: Check for return value of _Jv_CondWait and
        act appropriatly.
        * include/posix-threads.h: Remove all HAVE_RECURSIVE_MUTEX related
        #defines and #ifdefs.
        (struct _Jv_Thread_t): New fields `thread_obj', `wait_cond',
        `wait_mutex', `next'.
        (struct _Jv_ConditionVariable_t): Define as a struct instead of
        directly mapping to pthread_cond_t.
        (struct _Jv_Mutex_t): New recursive implementation.
        (_Jv_PthreadCheckMonitor): Reimplemented. Simple `owner' check.
        _Jv_HaveCondDestroy: Never define this for posix-threads.
        (_Jv_CondNotify): Remove inline implementation(s), prototype instead.
        (_Jv_CondNotifyAll): Ditto.
        (_Jv_MutexLock): Ditto.
        (_Jv_MutexUnlock): Ditto.
        (_Jv_MutexInit): Changed to reflect new mutex implementation.
        (_Jv_MutexDestroy): Ditto.
        (_Jv_CondDestroy): Removed.
        (_Jv_PthreadGetMutex): Removed.
        * include/win32-threads.h: (_Jv_CondNotify): Guess _JV_NOT_OWNER on an
        error. Add a FIXME about this.
        (_Jv_CondNotifyAll): Ditto.
        * win32-threads.cc: (_Jv_CondWait): Return 0 on a timeout. Guess
        _JV_NOT_OWNER on other errors. Add FIXME.

From-SVN: r32773
2000-03-28 03:22:24 +01:00
Tom Tromey 2ba5f77454 All files: Updated copyright information.
* All files: Updated copyright information.
	* COPYING: New file.
	* COPYING.LIB: Removed.
	* LIBGCJ_LICENSE: We now use GPL + special exception.

From-SVN: r32387
2000-03-07 19:55:28 +00:00
Tom Tromey 7c734b1758 * All files: Updated copyright to reflect Cygnus purchase.
From-SVN: r31504
2000-01-19 18:39:27 +00:00
Tom Tromey c97e511d31 re GNATS libgcj/117 (_Jv_PthreadCheckMonitor test is not portable.)
* include/posix-threads.h (_Jv_PthreadCheckMonitor): Handle case
	where no recursive mutexes exist.  Fixes PR libgcj/117.

From-SVN: r30847
1999-12-09 16:57:27 +00:00
Tom Tromey 16f39e241a quick-threads.h (_Jv_ThreadCancel): Removed.
* include/quick-threads.h (_Jv_ThreadCancel): Removed.
	(_Jv_ThreadDestroy): Likewise.
	* include/no-threads.h (_Jv_ThreadCancel): Removed.
	(_Jv_ThreadDestroy): Likewise.
	* include/posix-threads.h (struct _Jv_Thread_t): Removed
	`exception' field.
	(_Jv_ThreadCancel): Removed decl.
	(_Jv_ThreadDestroy): Removed.
	* posix-threads.cc (_Jv_ThreadCancel): Removed.
	(throw_cleanup): Removed.
	(really_start): Don't push or pop cleanup.
	(_Jv_ThreadInitData): Don't initialize `exception' field.
	* java/lang/Thread.java (stop): Officially unimplemented.
	* java/lang/natThread.cc (stop): Officially unimplemented.

From-SVN: r30392
1999-11-04 16:45:11 +00:00
Tom Tromey 5057b5e8d1 posix-threads.h (_Jv_MutexDestroy): Use _Jv_PthreadGetMutex.
* include/posix-threads.h (_Jv_MutexDestroy): Use
	_Jv_PthreadGetMutex.
	(_Jv_MutexLock): Likewise.
	(_Jv_MutexUnlock): Likewise.

From-SVN: r29569
1999-09-21 23:01:23 +00:00
Tom Tromey c45a8466e6 posix-threads.h (_Jv_PthreadCheckMonitor): Reverted previous change and implemented a correct test in the __m_count case.
* include/posix-threads.h (_Jv_PthreadCheckMonitor): Reverted
	previous change and implemented a correct test in the __m_count
	case.

From-SVN: r29209
1999-09-08 17:10:22 +00:00
Tom Tromey 400ec27079 posix-threads.h (_Jv_PthreadCheckMonitor): Changed test in __m_count case.
* include/posix-threads.h (_Jv_PthreadCheckMonitor): Changed test
	in __m_count case.

From-SVN: r29193
1999-09-08 07:01:32 +00:00
Tom Tromey fd59e3a04e posix-threads.cc (_Jv_CondWait): Check `errno' against EINTR, not `r'.
1999-09-07  Tom Tromey  <tromey@cygnus.com>

	* posix-threads.cc (_Jv_CondWait): Check `errno' against EINTR,
	not `r'.  Changed `done_sleeping' to a `bool'.

1999-09-07  Matt Welsh <mdw@cs.berkeley.edu

	* libjava/posix-threads.cc: Added _Jv_ThreadDataKey.
	Added FLAG_INTERRUPTED to indicate that a thread was interrupted
	by another thread, rather than by the GC.
	(_Jv_CondWait): Prevent premature thread wakeup by GC.
	(_Jv_InitThreads): Initialize _Jv_ThreadDataKey.
	* libjava/include/posix-threads.h (_Jv_ThreadCurrentData): New
	function.

From-SVN: r29177
1999-09-08 00:43:06 +00:00
Tom Tromey bc5afba452 posix-threads.h (PTHREAD_MUTEX_IS_STRUCT): New define.
* include/posix-threads.h (PTHREAD_MUTEX_IS_STRUCT): New define.
	(_Jv_PthreadGetMutex): Use it.
	(_Jv_PthreadCheckMonitor): Use new M_COUNT macros.
	(_Jv_MutexInit): Use PTHREAD_MUTEX_IS_STRUCT.
	(_Jv_MutexLock): Likewise.
	(_Jv_MutexUnlock): Likewise.
	* include/config.h.in: Rebuilt.
	* acconfig.h (PTHREAD_MUTEX_HAVE_M_COUNT,
	PTHREAD_MUTEX_HAVE___M_COUNT): New undefs.
	* configure: Rebuilt.
	* libgcj.spec.in: Don't mention INTERPSPEC.
	* configure.in (INTERPSPEC): Removed.
	Only run pthreads-related checks when using POSIX threads.  Check
	for m_count and __m_count in mutex structure.

From-SVN: r29048
1999-09-02 06:27:00 +00:00
Tom Tromey 45329b398e posix-threads.cc (_Jv_CondWait): Use _Jv_PthreadGetMutex.
* posix-threads.cc (_Jv_CondWait): Use _Jv_PthreadGetMutex.
	* include/posix-threads.h (_Jv_Mutex_t): Define as structure,
	except on Linux.
	(_Jv_PthreadGetMutex): New function.
	(_Jv_PthreadCheckMonitor): Use it.
	(_Jv_MutexInit): Likewise.  ALso, initialize `count'.
	(_Jv_MutexLock): Update `count'.
	(_Jv_MutexUnlock): Likewise.
	(_Jv_PthreadCheckMonitor): Use Linux-specific knowledge when
	appropriate.

From-SVN: r29032
1999-09-01 21:03:18 +00:00
Tom Tromey 6e87747b6d posix-threads.cc (_Jv_CondWait): Call _Jv_PthreadCheckMonitor.
* posix-threads.cc (_Jv_CondWait): Call _Jv_PthreadCheckMonitor.
	* include/posix-threads.h (_Jv_PthreadCheckMonitor): New
	function.
	(_Jv_CondNotify): Use it.
	(_Jv_CondNotifyAll): Likewise.

	* java/lang/Class.h (JV_STATE_NOTHING): Correct misspelling.

From-SVN: r29030
1999-09-01 18:29:39 +00:00
Tom Tromey ee9dd3721b Initial revision
From-SVN: r26263
1999-04-07 14:42:40 +00:00