mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-21 09:19:29 +08:00
prims.cc (JvRunMain): Always initialize arithexception.
1999-07-19 Andrew Haley <aph@cygnus.com> * prims.cc (JvRunMain): Always initialize arithexception. (_Jv_divI): New function. (_Jv_remI): New function. (_Jv_divJ): New function. (_Jv_remI): New function. * include/jvm.h: Add these new functions. Makefile.am: add DIVIDESPEC. aclocal.m4: ditto. configure.host: set DIVIDESPEC. libgcj.spec.in: pass DIVIDESPEC to compiler. configure: rebuilt. Makefile.in: rebuilt. From-SVN: r28211
This commit is contained in:
parent
9daca635ba
commit
d342a2e1eb
@ -80,6 +80,8 @@ JC1FLAGS = -g @LIBGCJ_JAVAFLAGS@
|
||||
INCLUDES = -Iinclude -I$(top_srcdir)/include $(GCINCS) $(THREADINCS) \
|
||||
$(EH_COMMON_INCLUDE) $(ZINCS)
|
||||
|
||||
DIVIDESPEC = @DIVIDESPEC@
|
||||
|
||||
|
||||
## ################################################################
|
||||
|
||||
|
@ -160,6 +160,8 @@ INCLUDES = -Iinclude -I$(top_srcdir)/include $(GCINCS) $(THREADINCS) \
|
||||
$(EH_COMMON_INCLUDE) $(ZINCS)
|
||||
|
||||
|
||||
DIVIDESPEC = @DIVIDESPEC@
|
||||
|
||||
nat_files = $(nat_source_files:.cc=.lo)
|
||||
c_files = $(c_source_files:.c=.lo)
|
||||
javao_files = $(java_source_files:.java=.lo) \
|
||||
|
3
libjava/aclocal.m4
vendored
3
libjava/aclocal.m4
vendored
@ -167,6 +167,9 @@ LIBGCJ_JAVAFLAGS="[$]{libgcj_javaflags}"
|
||||
AC_SUBST(LIBGCJ_CFLAGS)
|
||||
AC_SUBST(LIBGCJ_CXXFLAGS)
|
||||
AC_SUBST(LIBGCJ_JAVAFLAGS)
|
||||
|
||||
AC_SUBST(DIVIDESPEC)
|
||||
|
||||
])dnl
|
||||
|
||||
# Do all the work for Automake. This macro actually does too much --
|
||||
|
308
libjava/configure
vendored
308
libjava/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -43,14 +43,17 @@ AM_RUNTESTFLAGS=
|
||||
|
||||
echo "$target"
|
||||
|
||||
DIVIDESPEC=-fuse-divide-subroutine
|
||||
|
||||
case "${host}" in
|
||||
mips-tx39-*|mipstx39-unknown-*)
|
||||
libgcj_flags="${libgcj_flags} -G 0"
|
||||
LDFLAGS="$LDFLAGS -Tjmr3904dram.ld"
|
||||
AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
|
||||
AM_RUNTESTFLAGS="--target_board=jmr3904-sim"
|
||||
;;
|
||||
i686-*|i586-*)
|
||||
libgcj_flags="${libgcj_flags} -ffloat-store"
|
||||
DIVIDESPEC=-fno-use-divide-subroutine
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
|
@ -98,4 +98,13 @@ extern jclass _Jv_FindClassFromSignature (char *,
|
||||
|
||||
extern jobject _Jv_NewMultiArray (jclass, jint ndims, jint* dims);
|
||||
|
||||
/* Checked divide subroutines. */
|
||||
extern "C"
|
||||
{
|
||||
jint _Jv_divI (jint, jint);
|
||||
jint _Jv_remI (jint, jint);
|
||||
jlong _Jv_divJ (jlong, jlong);
|
||||
jlong _Jv_remJ (jlong, jlong);
|
||||
}
|
||||
|
||||
#endif /* __JAVA_JVM_H__ */
|
||||
|
@ -5,3 +5,6 @@
|
||||
#
|
||||
%rename lib liborig
|
||||
*lib: -lgcj -lm @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(liborig)
|
||||
|
||||
%rename cc1 cc1orig
|
||||
*cc1: @DIVIDESPEC@ %(cc1orig)
|
||||
|
@ -64,8 +64,9 @@ SIGNAL_HANDLER (catch_segv)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HANDLE_FPE
|
||||
static java::lang::ArithmeticException *arithexception;
|
||||
|
||||
#ifdef HANDLE_FPE
|
||||
SIGNAL_HANDLER (catch_fpe)
|
||||
{
|
||||
#ifdef HANDLE_DIVIDE_OVERFLOW
|
||||
@ -574,7 +575,12 @@ void
|
||||
JvRunMain (jclass klass, int argc, const char **argv)
|
||||
{
|
||||
INIT_SEGV;
|
||||
#ifdef HANDLE_FPE
|
||||
INIT_FPE;
|
||||
#else
|
||||
arithexception = new java::lang::ArithmeticException
|
||||
(JvNewStringLatin1 ("/ by zero"));
|
||||
#endif
|
||||
|
||||
no_memory = new java::lang::OutOfMemoryError;
|
||||
|
||||
@ -610,3 +616,59 @@ _Jv_Free (void* ptr)
|
||||
{
|
||||
return free (ptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// In theory, these routines can be #ifdef'd away on machines which
|
||||
// support divide overflow signals. However, we never know if some
|
||||
// code might have been compiled with "-fuse-divide-subroutine", so we
|
||||
// always include them in libgcj.
|
||||
|
||||
jint
|
||||
_Jv_divI (jint dividend, jint divisor)
|
||||
{
|
||||
if (divisor == 0)
|
||||
_Jv_Throw (arithexception);
|
||||
|
||||
if (dividend == 0x80000000L && divisor == -1)
|
||||
return dividend;
|
||||
|
||||
return dividend / divisor;
|
||||
}
|
||||
|
||||
jint
|
||||
_Jv_remI (jint dividend, jint divisor)
|
||||
{
|
||||
if (divisor == 0)
|
||||
_Jv_Throw (arithexception);
|
||||
|
||||
if (dividend == 0x80000000L && divisor == -1)
|
||||
return 0;
|
||||
|
||||
return dividend % divisor;
|
||||
}
|
||||
|
||||
jlong
|
||||
_Jv_divJ (jlong dividend, jlong divisor)
|
||||
{
|
||||
if (divisor == 0)
|
||||
_Jv_Throw (arithexception);
|
||||
|
||||
if (dividend == 0x8000000000000000LL && divisor == -1)
|
||||
return dividend;
|
||||
|
||||
return dividend / divisor;
|
||||
}
|
||||
|
||||
jlong
|
||||
_Jv_remJ (jlong dividend, jlong divisor)
|
||||
{
|
||||
if (divisor == 0)
|
||||
_Jv_Throw (arithexception);
|
||||
|
||||
if (dividend == 0x8000000000000000LL && divisor == -1)
|
||||
return 0;
|
||||
|
||||
return dividend % divisor;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user