aclocal.m4 (CHECK_FOR_BROKEN_MINGW_LD): added

2002-10-20  Adam Megacz <adam@xwt.org>

        * aclocal.m4 (CHECK_FOR_BROKEN_MINGW_LD): added
        * configure.in: enabled hash sync on Win32
        * include/win32-threads.h (_Jv_ThreadId_t): added.
        * java/lang/natObject.cc (_Jv_MonitorEnter, _Jv_MonitorExit,
        heavy_lock_obj_finalization_proc, wait, notify, notifyAll):
        removed some posix-isms, use Thread::sleep() instead of usleep,
        added code to clear bottom three bits if platform has a broken
        linker.  * include/win32-threads.h (_Jv_ThreadId_t): added.

From-SVN: r58344
This commit is contained in:
Adam Megacz 2002-10-21 01:50:14 +00:00 committed by Adam Megacz
parent 6d0b22ecb0
commit e2a450f6e8
7 changed files with 357 additions and 259 deletions

View File

@ -1,3 +1,14 @@
2002-10-20 Adam Megacz <adam@xwt.org>
* aclocal.m4 (CHECK_FOR_BROKEN_MINGW_LD): added
* configure.in: enabled hash sync on Win32
* include/win32-threads.h (_Jv_ThreadId_t): added.
* java/lang/natObject.cc (_Jv_MonitorEnter, _Jv_MonitorExit,
heavy_lock_obj_finalization_proc, wait, notify, notifyAll):
removed some posix-isms, use Thread::sleep() instead of usleep,
added code to clear bottom three bits if platform has a broken
linker. * include/win32-threads.h (_Jv_ThreadId_t): added.
2002-10-19 Ranjit Mathew <rmathew@hotmail.com>
* java/lang/natRuntime.cc (insertSystemProperties): Added GCJ

23
libjava/aclocal.m4 vendored
View File

@ -434,3 +434,26 @@ for am_file in <<$1>>; do
done<<>>dnl>>)
changequote([,]))])
AC_DEFUN([CHECK_FOR_BROKEN_MINGW_LD],
[
AC_MSG_CHECKING(whether 'ld' is at least 2.13)
LD_PROG=`$CC --print-prog-name=ld`
LD_VERSION=`$LD_PROG --version`
LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2`
if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then
LD_OK="ok"
else
if expr "$LD_VERSION_MAJOR" = 2 && expr "$LD_VERSION_MINOR" \>= 13 > /dev/null; then
LD_OK="ok"
fi
fi
if test "x$LD_OK" != x; then
AC_MSG_RESULT([yes; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
else
AC_MSG_RESULT([no; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR])
AC_MSG_WARN([ld <2.13 detected; enabling JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS hack...])
AC_DEFINE(JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS, 1,
[Indicate that linker is not able to 8-byte align static data])
fi[]dnl
])# CHECK_FOR_BROKEN_MINGW_LD

524
libjava/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -226,6 +226,7 @@ case "$TARGET_ECOS" in
PLATFORM=Win32
PLATFORMOBJS=win32.lo
PLATFORMH=win32.h
CHECK_FOR_BROKEN_MINGW_LD
;;
*)
PLATFORM=Posix
@ -444,7 +445,7 @@ AC_LINK_FILES(sysdep/$sysdeps_dir/locks.h, sysdep/locks.h)
HASH_SYNC_SPEC=
# Hash synchronization is only useful with posix threads right now.
if test "$enable_hash_synchronization" = yes && test "$THREADS" = "posix"; then
if test "$enable_hash_synchronization" = yes; then
HASH_SYNC_SPEC=-fhash-synchronization
AC_DEFINE(JV_HASH_SYNCHRONIZATION, 1, [Define if hash synchronization is in use])
fi

View File

@ -1,4 +1,4 @@
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
/* include/config.h.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define if using alloca.c. */
#undef C_ALLOCA
@ -343,12 +343,12 @@
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define if you have the <net/if.h> header file. */
#undef HAVE_NET_IF_H
/* Define if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
@ -394,6 +394,9 @@
/* Define if the compiler is configured for setjmp/longjmp exceptions. */
#undef SJLJ_EXCEPTIONS
/* Indicate that linker is not able to 8-byte align static data */
#undef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
/* Required define if using POSIX threads */
#undef _REENTRANT

View File

@ -33,6 +33,14 @@ typedef struct
java::lang::Thread *thread_obj;
} _Jv_Thread_t;
typedef DWORD _Jv_ThreadId_t;
inline _Jv_ThreadId_t
_Jv_ThreadSelf (void)
{
return GetCurrentThreadId();
}
typedef void _Jv_ThreadStartFunc (java::lang::Thread *);
//

View File

@ -305,9 +305,9 @@ _Jv_MonitorExit (jobject obj)
#include <assert.h>
#include <limits.h>
#include <unistd.h> // for usleep, sysconf.
#include <sched.h> // for sched_yield.
#include <gcj/javaprims.h>
#include <sysdep/locks.h>
#include <java/lang/Thread.h>
// Try to determine whether we are on a multiprocessor, i.e. whether
// spinning may be profitable.
@ -525,14 +525,14 @@ spin(unsigned n)
}
else if (n < yield_limit)
{
sched_yield();
_Jv_ThreadYield();
}
else
{
unsigned duration = MIN_SLEEP_USECS << (n - yield_limit);
if (n >= 15 + yield_limit || duration > MAX_SLEEP_USECS)
duration = MAX_SLEEP_USECS;
usleep(duration);
duration = MAX_SLEEP_USECS;
java::lang::Thread::sleep(0, duration);
}
}
@ -574,7 +574,15 @@ static void
heavy_lock_obj_finalization_proc (void *obj, void *cd)
{
heavy_lock *hl = (heavy_lock *)cd;
// This only addresses misalignment of statics, not heap objects. It
// works only because registering statics for finalization is a noop,
// no matter what the least significant bits are.
#ifdef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
obj_addr_t addr = (obj_addr_t)obj & ~((obj_addr_t)0x7);
#else
obj_addr_t addr = (obj_addr_t)obj;
#endif
hash_entry *he = light_locks + JV_SYNC_HASH(addr);
obj_addr_t he_address = (he -> address & ~LOCKED);
@ -753,7 +761,11 @@ get_heavy(obj_addr_t addr, hash_entry *he)
void
_Jv_MonitorEnter (jobject obj)
{
#ifdef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
obj_addr_t addr = (obj_addr_t)obj & ~((obj_addr_t)FLAGS);
#else
obj_addr_t addr = (obj_addr_t)obj;
#endif
obj_addr_t address;
unsigned hash = JV_SYNC_HASH(addr);
hash_entry * he = light_locks + hash;
@ -898,7 +910,11 @@ retry:
void
_Jv_MonitorExit (jobject obj)
{
#ifdef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
obj_addr_t addr = (obj_addr_t)obj & ~((obj_addr_t)FLAGS);
#else
obj_addr_t addr = (obj_addr_t)obj;
#endif
_Jv_ThreadId_t self = _Jv_ThreadSelf();
unsigned hash = JV_SYNC_HASH(addr);
hash_entry * he = light_locks + hash;
@ -1078,7 +1094,11 @@ retry:
void
java::lang::Object::wait (jlong timeout, jint nanos)
{
#ifdef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
obj_addr_t addr = (obj_addr_t)this & ~((obj_addr_t)FLAGS);
#else
obj_addr_t addr = (obj_addr_t)this;
#endif
_Jv_ThreadId_t self = _Jv_ThreadSelf();
unsigned hash = JV_SYNC_HASH(addr);
hash_entry * he = light_locks + hash;
@ -1155,7 +1175,11 @@ retry:
void
java::lang::Object::notify (void)
{
#ifdef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
obj_addr_t addr = (obj_addr_t)this & ~((obj_addr_t)FLAGS);
#else
obj_addr_t addr = (obj_addr_t)this;
#endif
_Jv_ThreadId_t self = _Jv_ThreadSelf();
unsigned hash = JV_SYNC_HASH(addr);
hash_entry * he = light_locks + hash;
@ -1200,7 +1224,11 @@ retry:
void
java::lang::Object::notifyAll (void)
{
#ifdef JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS
obj_addr_t addr = (obj_addr_t)this & ~((obj_addr_t)FLAGS);
#else
obj_addr_t addr = (obj_addr_t)this;
#endif
_Jv_ThreadId_t self = _Jv_ThreadSelf();
unsigned hash = JV_SYNC_HASH(addr);
hash_entry * he = light_locks + hash;