This is the mail archive of the java@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]

Re: Bug on Solaris


Hi Andrew,

On Tue, Jan 08, 2002 at 02:26:37PM +0000, Andrew Haley wrote:
> Andrew Haley writes:
>  > It looks to me like the Java source compiler is miscompiling your test
>  > case.  java.lang.Double looks fine.
>  > 
>  > The first thing I'd try is recompiling gcj with no optimizations.  Go
>  > into gcc/gcc and do make clean; make; make install.
>  > 
>  > Andrew.
> 
> P.S.  I take it that the Linux gcj and the Solaris gcj have been built
> from exactly the same source.

Nearly ;-)
Of course, they use the same java-source file hello.java.

The 'linux-c' linux version was from snapshot gcc-20020107.
I now use gcc-20011231 on Linux, too, and the resulting disassambly
of hello.java is *exactly* the same as the one i gave to you produced by
gcc-20020107.

Now, the two gcc-20011231 sources differ by a patch from Richard Henderson
which was applied on Solaris to survive an assembler error. (IIRC,
it is in mainline now an it is also in gcc-20020107).

This was the patch:

Re: java/5183: reorg.c fix for sparc

   * From: Richard Henderson <rth at redhat dot com>
   * To: Jeff Sturm <jsturm at one-point dot com>
   * Cc: gcc-patches at gcc dot gnu dot org
   * Date: Tue, 1 Jan 2002 15:07:57 -0800
   * Subject: Re: java/5183: reorg.c fix for sparc
   * References:
     <Pine.LNX.4.10.10201011301130.9390-100000@mars.deadcafe.org>

  ------------------------------------------------------------------------

On Tue, Jan 01, 2002 at 02:29:05PM -0500, Jeff Sturm wrote:
> In fill_slots_from_thread we remove an insn from the branch target before
> reinserting into the delay slot.  If the insn has a REG_LABEL note that
> may cause LABEL_NUSES to fall to zero momentarily (and delete the label).
>
> As I understand it, delete_related_insns is deprecated, and shouldn't be
> used anyhow.  Assuming a bootstrap completes on sparc-sun-solaris2.8, OK
> to commit?

I think a safer idea is to keep the label reference count up to date.

Tested briefly with your java test case.  I'll run it through a
complete sparc bootstrap in a moment.

r~

        * reorg.c (emit_delay_sequence): Increment label reference count
        if any REG_LABEL notes.
        (fill_slots_from_thread): Fob LABEL_NUSES around delete_related_insns.

Index: reorg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reorg.c,v
retrieving revision 1.67
diff -u -p -r1.67 reorg.c
--- reorg.c     2001/10/11 03:16:03     1.67
+++ reorg.c     2002/01/01 23:04:02
@@ -489,7 +489,7 @@ emit_delay_sequence (insn, list, length)
   for (li = list; li; li = XEXP (li, 1), i++)
     {
       rtx tem = XEXP (li, 0);
-      rtx note;
+      rtx note, next;

       /* Show that this copy of the insn isn't deleted.  */
       INSN_DELETED_P (tem) = 0;
@@ -498,11 +498,26 @@ emit_delay_sequence (insn, list, length)
       PREV_INSN (tem) = XVECEXP (seq, 0, i - 1);
       NEXT_INSN (XVECEXP (seq, 0, i - 1)) = tem;

-      /* Remove any REG_DEAD notes because we can't rely on them now
-        that the insn has been moved.  */
-      for (note = REG_NOTES (tem); note; note = XEXP (note, 1))
-       if (REG_NOTE_KIND (note) == REG_DEAD)
-         XEXP (note, 0) = const0_rtx;
+      for (note = REG_NOTES (tem); note; note = next)
+       {
+         next = XEXP (note, 1);
+         switch (REG_NOTE_KIND (note))
+           {
+           case REG_DEAD:
+             /* Remove any REG_DEAD notes because we can't rely on them now
+                that the insn has been moved.  */
+             remove_note (tem, note);
+             break;
+
+           case REG_LABEL:
+             /* Keep the label reference count up to date.  */
+             LABEL_NUSES (XEXP (note, 0)) ++;
+             break;
+
+           default:
+             break;
+           }
+       }
     }

   NEXT_INSN (XVECEXP (seq, 0, length)) = NEXT_INSN (seq_insn);
@@ -2703,6 +2718,8 @@ fill_slots_from_thread (insn, condition,
                     starting point of this thread.  */
                  if (own_thread)
                    {
+                     rtx note;
+
                      update_block (trial, thread);
                      if (trial == thread)
                        {
@@ -2710,7 +2727,18 @@ fill_slots_from_thread (insn, condition,
                          if (new_thread == trial)
                            new_thread = thread;
                        }
+
+                     /* We are moving this insn, not deleting it.  We must
+                        temporarily increment the use count on any referenced
+                        label lest it be deleted by delete_related_insns.  */
+                     note = find_reg_note (trial, REG_LABEL, 0);
+                     if (note)
+                       LABEL_NUSES (XEXP (note, 0))++;
+
                      delete_related_insns (trial);
+
+                     if (note)
+                       LABEL_NUSES (XEXP (note, 0))--;
                    }
                  else
                    new_thread = next_active_insn (trial);

  ------------------------------------------------------------------------


Hope that clears up things,
Martin.

-- 
The early bird catches the worm. If you want something else for       
breakfast, get up later.


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