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


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

Re: Exception handling: reload insns


Richard Henderson writes:
 > On Thu, May 03, 2001 at 07:47:53PM +0100, Andrew Haley wrote:
 > > 	* reload1.c (copy_eh_notes): New function.
 > > 	(emit_input_reload_insns): Call it.
 > > 	(emit_output_reload_insns): Call it.
 > 
 > Um, which sort of test case requires this?  I'd have thought
 > most of the reloads would be coming from the stack, and so
 > would not be may_trap_p loads.

Most of them, but not all.

Consider these insns from libjava/testsuite/libjava.lang/Invoke_1.java
(x86, no optimization.)  This test makes a virtual method call on a
null object.

The faulting memory read is on insn 37:


(insn 33 31 35 (set (reg/f:SI 61)
        (mem/f:SI (plus:SI (reg/f:SI 20 frame)
                (const_int -8 [0xfffffff8])) 0)) 45 {*movsi_1} (nil)
    (nil))

(insn 35 33 37 (parallel[ 
            (set (reg/f:SI 7 esp)
                (plus:SI (reg/f:SI 7 esp)
                    (const_int -12 [0xfffffff4])))
            (clobber (reg:CC 17 flags))
        ] ) 199 {*addsi_1} (nil)
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))

(insn 37 35 104 (parallel[ 
            (set (reg/f:SI 62)
                (plus:SI (mem/s:SI (reg/f:SI 61) 0)
                    (const_int 28 [0x1c])))
            (clobber (reg:CC 17 flags))
        ] ) 199 {*addsi_1} (nil)
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (expr_list:REG_EH_REGION (const_int 1 [0x1])
            (nil))))


Reload does this:


(insn 33 31 135 (set (reg:SI 0 eax)
        (mem/f:SI (plus:SI (reg/f:SI 6 ebp)
                (const_int -8 [0xfffffff8])) 0)) 45 {*movsi_1} (nil)
    (nil))

(insn 135 33 35 (set (mem:SI (plus:SI (reg/f:SI 6 ebp)
                (const_int -20 [0xffffffec])) 0)
        (reg:SI 0 eax)) 45 {*movsi_1} (nil)
    (nil))

(insn 35 135 138 (parallel[ 
            (set (reg/f:SI 7 esp)
                (plus:SI (reg/f:SI 7 esp)
                    (const_int -12 [0xfffffff4])))
            (clobber (reg:CC 17 flags))
        ] ) 199 {*addsi_1} (nil)
    (nil))

(insn 138 35 141 (set (reg:SI 1 edx)
        (mem:SI (plus:SI (reg/f:SI 6 ebp)
                (const_int -20 [0xffffffec])) 0)) 45 {*movsi_1} (nil)
    (nil))

(insn 141 138 37 (set (reg:SI 0 eax)
        (mem/s:SI (reg:SI 1 edx) 0)) 45 {*movsi_1} (nil)
    (nil))

(insn 37 141 144 (parallel[ 
            (set (reg:SI 0 eax)
                (plus:SI (reg:SI 0 eax)
                    (const_int 28 [0x1c])))
            (clobber (reg:CC 17 flags))
        ] ) 199 {*addsi_1} (nil)
    (expr_list:REG_EH_REGION (const_int 1 [0x1])
        (nil)))


The faulting memory read has been moved from insn 37 to insn 141: now
the REG_EH_REGION note is attached to an insn that won't fault, and
the insn that will fault has no note.  I suppose I could have written
a patch that also deletes the note on insn 37 as well as adding it to
insn 141, but I was being conservative.

Andrew.


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