Re: Enabling unit-at-a-time by default for Java

Andrew Haley <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
Andrew Haley wrote:
> Jan Hubicka wrote:

>>  2) I get libjava.lang/StackTrace2 failure at -O3.  This testcase tests
>>  that unwind info reports proper name of function doing non-call EH
>>  (at least in my understnading of Java).  Inlining of the throwing
>>  function naturally changes its name in unwind info, yet I don't see how
>>  inliner can work out that inlining is not supposed to happen.
>>
>>  I guess StackFrame feature is not really compatible with inlining, but
>>  I might be missing something.  It is definitly latent problem and
>>  probably minor one.
>>
>> OK for mainline?
> 
> OK, thanks.  I'll fix the StackTrace2 problem.

The only way to fix that test case is to disable all inlining in gcj.
I'm not prepared to do that.  When the gcj user asks for functions to be
inlined, they want gcj to obey them.  It is much more valuable to have
inlining where possible than perfect stack traces.

I fixed the test case by replacing all inlinable calls with non-inlinable
ones.

Andrew.


2008-08-07  Andrew Haley  <[email protected]>

	* testsuite/libjava.lang/StackTrace2.java: Rewrite to prevent
	spurious failure when some methods are inlined.

Index: StackTrace2.out
===================================================================
--- StackTrace2.out	(revision 138796)
+++ StackTrace2.out	(working copy)
@@ -1,5 +1,5 @@
 Trace length = 4
 StackTrace2$Inner.doCrash:OK
-StackTrace2$Inner.<init>:OK
+StackTrace2$Inner.foo:OK
 StackTrace2.a:OK
 StackTrace2.main:OK
Index: StackTrace2.java
===================================================================
--- StackTrace2.java	(revision 138796)
+++ StackTrace2.java	(working copy)
@@ -7,7 +7,7 @@
   {
     try
     {
-      a();
+      new StackTrace2().a();
     }
     catch (Exception x)
     {
@@ -16,14 +16,14 @@
     }
   }

-  static void a()
+  void a()
   {
-    new Inner();
+    new Inner().foo();
   }

-  static class Inner
+  class Inner
   {
-    public Inner()
+    public void foo()
     {
       doCrash(null);
     }
@@ -38,7 +38,7 @@
   {
     System.out.println("Trace length = " + trace.length);
     checkLine(trace[0], "StackTrace2$Inner", "doCrash", 33);
-    checkLine(trace[1], "StackTrace2$Inner", "<init>", 28);
+    checkLine(trace[1], "StackTrace2$Inner", "foo", 28);
     checkLine(trace[2], "StackTrace2", "a", 21);
     checkLine(trace[3], "StackTrace2", "main", 10);
   }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.