This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH/RFA] libjava: SH support
- From: kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Cc: aoliva at redhat dot com, aph at cambridge dot redhat dot com, jsturm at one-point dot com, tromey at redhat dot com, joern dot rennecke at superh dot com
- Date: Sat, 10 Aug 2002 08:48:26 +0900
- Subject: Re: [PATCH/RFA] libjava: SH support
- References: <orsn1otp4e.fsf@free.redhat.lsd.ic.unicamp.br>
Alexandre Oliva <aoliva@redhat.com> wrote:
> On Jul 26, 2002, kaz Kojima <kkojima@rr.iij4u.or.jp> wrote:
[snip]
>> I've found a cause of many gij failures on SH port.
>> Interpreter takes JVM stack and local variables as variable
>> sized arrays:
>
> Do you have a testcase that easily exposes the problem (even if one
> has to inspect the assembly code to verify it)?
OK. Here is a small example.
_Unwind_SjLj_Resume is called before allocating array aa. It seems
that the stack pointer is set higher than aa when the exception
handler invoked.
kaz
--
-- aa.cc --
void foo (int);
void bar (int *) throw (int);
int a;
void
f (int max_stack)
{
int aa[max_stack];
int *sp = aa;
try
{
bar (aa);
return;
}
catch (int e)
{
foo (e);
a = *sp;
}
}
-- aa.s --
.file "aa.cc"
.text
.little
.global a
.global a
.section .bss
.align 2
.type a, @object
.size a, 4
a:
.zero 4
.global _Unwind_SjLj_Resume
.global __gxx_personality_sj0
.global _Unwind_SjLj_Register
.global _Unwind_SjLj_Unregister
.text
.align 5
.global _Z1fi
.type _Z1fi, @function
_Z1fi:
.LFB3:
mov.l r8,@-r15
.LCFI0:
mov.l r9,@-r15
.LCFI1:
mov.l r10,@-r15
.LCFI2:
mov.l r11,@-r15
.LCFI3:
mov.l r12,@-r15
.LCFI4:
mov.l r13,@-r15
.LCFI5:
mov.l r14,@-r15
.LCFI6:
fmov.s fr12,@-r15
.LCFI7:
fmov.s fr13,@-r15
.LCFI8:
fmov.s fr14,@-r15
.LCFI9:
fmov.s fr15,@-r15
.LCFI10:
sts.l pr,@-r15
.LCFI11:
add #-60,r15
.LCFI12:
mov.l .L13,r1
mov r15,r14
.LCFI13:
mov.l r1,@(24,r14)
mov.l .L14,r1
mov.l r1,@(28,r14)
mov.l .L15,r1
mov.l r1,@(36,r14)
mov.l .L16,r1
mov.l r4,@(44,r14)
mov r14,r4
mov.l r15,@(40,r14)
jsr @r1
mov.l r14,@(32,r14)
mov.l @(44,r14),r1
shll2 r1
mov.l r15,@(48,r14)
sub r1,r15
mov #2,r1
mov.l r1,@(4,r14)
mov r15,r4
mov.l .L17,r1
jsr @r1
mov.l r15,@(52,r14)
.L10:
.L1:
mov.l .L18,r1
mov r14,r4
jsr @r1
mov.l @(48,r14),r15
add #60,r14
mov r14,r15
lds.l @r15+,pr
fmov.s @r15+,fr15
fmov.s @r15+,fr14
fmov.s @r15+,fr13
fmov.s @r15+,fr12
mov.l @r15+,r14
mov.l @r15+,r13
mov.l @r15+,r12
mov.l @r15+,r11
mov.l @r15+,r10
mov.l @r15+,r9
rts
mov.l @r15+,r8
.align 5
.L8:
mov r1,r0
cmp/eq #1,r0
bt/s .L12
mov #-1,r1
.L6:
.L26:
mov.l @(56,r14),r4
mov.l r1,@(4,r14)
mov.l .L19,r1
jsr @r1
nop
.L3:
.align 5
.L12:
mov.l .L20,r0
jsr @r0
mov.l @(56,r14),r4
mov #1,r1
mov.l r1,@(4,r14)
mov.l @r0,r4
mov.l .L21,r1
jsr @r1
nop
mov.l @(52,r14),r1
mov.l @r1,r2
mov.l .L22,r1
mov.l r2,@r1
mov.l .L24,r1
jsr @r1
nop
bra .L10
nop
.align 5
.L9:
mov.l @(8,r14),r1
mov.l @(4,r14),r0
cmp/eq #1,r0
mov.l r1,@(56,r14)
bt/s .L8
mov.l @(12,r14),r1
.L4:
mov.l .L24,r1
jsr @r1
nop
bra .L26
mov #-1,r1
.L25:
.align 2
.L13:
.long __gxx_personality_sj0
.L14:
.long .LLSDA3
.L15:
.long .L9
.L16:
.long _Unwind_SjLj_Register
.L17:
.long _Z3barPi
.L18:
.long _Unwind_SjLj_Unregister
.L19:
.long _Unwind_SjLj_Resume
.L20:
.long __cxa_begin_catch
.L21:
.long _Z3fooi
.L22:
.long a
.L24:
.long __cxa_end_catch
.LFE3:
.size _Z1fi, .-_Z1fi
.section .gcc_except_table,"aw",@progbits
.align 2
.LLSDA3:
.byte 0xff
.byte 0x0
.uleb128 .LLSDATT3-.LLSDATTD3
.LLSDATTD3:
.byte 0x1
.uleb128 .LLSDACSE3-.LLSDACSB3
.LLSDACSB3:
.uleb128 0x0
.uleb128 0x0
.uleb128 0x1
.uleb128 0x1
.LLSDACSE3:
.byte 0x1
.byte 0x0
.align 2
.long _ZTIi
.LLSDATT3:
.text
.ident "GCC: (GNU) 3.3 20020804 (experimental)"