This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFA PATCH: Enable MIPS SIGFPE handling...


When I made my initial series of MIPS patches my misunderstanding of how
GCC generates divide by zero checks led me to omit SIGFPE handling.

Now since I have seen the light, I present this patch to enable use of
SIGFPE for generation of ArithmeticException("/ by zero");


Tested on --host=i686-pc-linux-gnu --target=mipsel-linux with no
regressions in top level make check.

And yes it is correct to #undef HANDLE_DIVIDE_OVERFLOW as MIPS does
division according to the JLS without any of the mickey-mouse stuff that
has to be done with the x86.

O.K to commit?

David Daney.
2004-09-03  David Daney  <ddaney@avtrex.com>

	* configure.host: Use -fno-use-divide-subroutine for mips*-*-linux*.
	* include/mips-signal.h: Added HANDLE_FPE support.
	
Index: configure.host
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.host,v
retrieving revision 1.61
diff -c -p -r1.61 configure.host
*** configure.host	14 Jul 2004 13:09:06 -0000	1.61
--- configure.host	3 Sep 2004 16:52:44 -0000
*************** EOF
*** 227,232 ****
--- 227,233 ----
    	sysdeps_dir=mips
    	can_unwind_signal=yes
  	libgcj_flags="${libgcj_flags} -mxgot"
+ 	DIVIDESPEC=-fno-use-divide-subroutine
  	case "${host}" in
  	    mipsel*-linux* | mipsisa32el*-linux*)
  		enable_hash_synchronization_default=yes
Index: include/mips-signal.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/mips-signal.h,v
retrieving revision 1.1
diff -c -p -r1.1 mips-signal.h
*** include/mips-signal.h	22 Oct 2003 16:35:16 -0000	1.1
--- include/mips-signal.h	3 Sep 2004 16:52:44 -0000
*************** details.  */
*** 22,28 ****
     sys/ucontext.h included by java-signal.h from prims.cc */
  
  #define HANDLE_SEGV 1
! #undef HANDLE_FPE
  
  /* The third parameter to the signal handler points to something with
   * this structure defined in asm/ucontext.h, but the name clashes with
--- 22,28 ----
     sys/ucontext.h included by java-signal.h from prims.cc */
  
  #define HANDLE_SEGV 1
! #define HANDLE_FPE 1
  
  /* The third parameter to the signal handler points to something with
   * this structure defined in asm/ucontext.h, but the name clashes with
*************** do                                      
*** 83,89 ****
      syscall (SYS_sigaction, SIGSEGV, &kact, NULL);   \
    }                                                  \
  while (0)
! 								
  
  #endif /* JAVA_SIGNAL_H */
    
--- 83,101 ----
      syscall (SYS_sigaction, SIGSEGV, &kact, NULL);   \
    }                                                  \
  while (0)
! 
! #define INIT_FPE                                     \
! do                                                   \
!   {                                                  \
!     struct kernel_sigaction kact;                    \
!     kact.k_sa_handler = catch_fpe;                   \
!     kact.k_sa_flags = SA_SIGINFO | SA_NODEFER;       \
!     sigemptyset (&kact.k_sa_mask);                   \
!     syscall (SYS_sigaction, SIGFPE, &kact, NULL);    \
!   }                                                  \
! while (0)
! 
! #undef HANDLE_DIVIDE_OVERFLOW
  
  #endif /* JAVA_SIGNAL_H */
    

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]