public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/28423]  New: multianewarray not always evaluated when compiling from bytecode
@ 2006-07-18 17:16 aph at gcc dot gnu dot org
  2006-07-18 17:21 ` [Bug java/28423] " tromey at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: aph at gcc dot gnu dot org @ 2006-07-18 17:16 UTC (permalink / raw)
  To: java-prs

In this test case (from jakarta-commons-collections) we expect to see an
OutOfMemoryError thrown.  This doesn't always happen as it should, but only
when compiling from bytecode.  And only with ecj...


public class OutOfMemoryError
{
  private static void fail(String msg)
  {
    System.err.println(msg);
    System.exit(1);
  }

  private static void gc() {
    try {
      // trigger GC
      byte[][] tooLarge = new byte[1000000000][1000000000];
      fail("you have too much RAM");
    } catch (java.lang.OutOfMemoryError ex) {
      System.gc(); // ignore
    }
  }

  public static void main(String[] argv)
  {
    gc();
  }
}

It depends on exactly how the bytecode compiler generates code.

This one fails:

Method name:"gc" private static Signature: ()void
Attribute "Code", length:70, max_stack:2, max_locals:0, code_length:22
  0: ldc <Integer 1000000000>
  2: ldc <Integer 1000000000>
  4: multianewarray <Class [[B> 2
  8: pop

This one doesn't fail:

Method name:"gc" private static Signature: ()void
Attribute "Code", length:66, max_stack:2, max_locals:1, code_length:22
  0: ldc <Integer 1000000000>
  2: ldc <Integer 1000000000>
  4: multianewarray <Class [[B> 2
  8: astore_0

It seems that the pop instruction in the first version causes the
multianewarray never to be invoked.  The "oh so clever" ecj notices that
tooLarge is never used, so doesn't generate a slot for it.


-- 
           Summary: multianewarray not always evaluated when compiling from
                    bytecode
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aph at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28423


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug java/28423] multianewarray not always evaluated when compiling from bytecode
  2006-07-18 17:16 [Bug java/28423] New: multianewarray not always evaluated when compiling from bytecode aph at gcc dot gnu dot org
@ 2006-07-18 17:21 ` tromey at gcc dot gnu dot org
  2006-08-06 22:43 ` tromey at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at gcc dot gnu dot org @ 2006-07-18 17:21 UTC (permalink / raw)
  To: java-prs



------- Comment #1 from tromey at gcc dot gnu dot org  2006-07-18 17:21 -------
I suspect this was solved on the gcj-eclipse branch
by flushing the quick stack in some cases.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28423


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug java/28423] multianewarray not always evaluated when compiling from bytecode
  2006-07-18 17:16 [Bug java/28423] New: multianewarray not always evaluated when compiling from bytecode aph at gcc dot gnu dot org
  2006-07-18 17:21 ` [Bug java/28423] " tromey at gcc dot gnu dot org
@ 2006-08-06 22:43 ` tromey at gcc dot gnu dot org
  2006-08-07  9:54 ` aph at gcc dot gnu dot org
  2007-01-30 21:03 ` tromey at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at gcc dot gnu dot org @ 2006-08-06 22:43 UTC (permalink / raw)
  To: java-prs



------- Comment #2 from tromey at gcc dot gnu dot org  2006-08-06 22:43 -------
Shouldn't we just pull in the fix from the gcj-eclipse branch?


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-08-06 22:43:47
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28423


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug java/28423] multianewarray not always evaluated when compiling from bytecode
  2006-07-18 17:16 [Bug java/28423] New: multianewarray not always evaluated when compiling from bytecode aph at gcc dot gnu dot org
  2006-07-18 17:21 ` [Bug java/28423] " tromey at gcc dot gnu dot org
  2006-08-06 22:43 ` tromey at gcc dot gnu dot org
@ 2006-08-07  9:54 ` aph at gcc dot gnu dot org
  2007-01-30 21:03 ` tromey at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: aph at gcc dot gnu dot org @ 2006-08-07  9:54 UTC (permalink / raw)
  To: java-prs



------- Comment #3 from aph at gcc dot gnu dot org  2006-08-07 09:54 -------
Sure, we should import the change.


-- 

aph at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor
   Last reconfirmed|2006-08-06 22:43:47         |2006-08-07 09:54:08
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28423


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug java/28423] multianewarray not always evaluated when compiling from bytecode
  2006-07-18 17:16 [Bug java/28423] New: multianewarray not always evaluated when compiling from bytecode aph at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2006-08-07  9:54 ` aph at gcc dot gnu dot org
@ 2007-01-30 21:03 ` tromey at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-01-30 21:03 UTC (permalink / raw)
  To: java-prs



------- Comment #4 from tromey at gcc dot gnu dot org  2007-01-30 21:03 -------
Fixed in 4.3.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28423


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-01-30 21:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-18 17:16 [Bug java/28423] New: multianewarray not always evaluated when compiling from bytecode aph at gcc dot gnu dot org
2006-07-18 17:21 ` [Bug java/28423] " tromey at gcc dot gnu dot org
2006-08-06 22:43 ` tromey at gcc dot gnu dot org
2006-08-07  9:54 ` aph at gcc dot gnu dot org
2007-01-30 21:03 ` tromey at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).