public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/23500] New: Optimization: Skip _Jv_InitClass for intra-class static method calls
@ 2005-08-20 20:00 greenrd at greenrd dot org
  2005-08-20 20:10 ` [Bug java/23500] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: greenrd at greenrd dot org @ 2005-08-20 20:00 UTC (permalink / raw)
  To: java-prs

Java requires a class initialization check when any public static method is
called. But when we are calling from another method in the _same_ class, we
already know that the class has been initialized, so we can optimize away the
call to _Jv_InitClass, even if we're not inlining. Here's how:

Reorder the call, so that this (on x86):

.globl _ZN4Test10assertHackEb
        .type   _ZN4Test10assertHackEb, @function
_ZN4Test10assertHackEb:
.LFB5:
        .file 1 "Test.java"
        .loc 1 43 0
.LVL0:
        pushl   %ebp
.LCFI0:
        movl    %esp, %ebp
.LCFI1:
        pushl   %ebx
.LCFI2:
        subl    $16, %esp
.LCFI3:
        movb    8(%ebp), %bl
        .loc 1 43 0
        pushl   $_ZN4Test6class$E
.LCFI4:
        call    _Jv_InitClass


becomes something like this:

.globl _ZN4Test10assertHackEb
        .type   _ZN4Test10assertHackEb, @function
_ZN4Test10assertHackEb:
.LFB5:
        .file 1 "Test.java"
        .loc 1 43 0
        pushl   $_ZN4Test6class$E
.LCFI4:
        call    _Jv_InitClass
.LVL0:
        pushl   %ebp
.LCFI0:
        movl    %esp, %ebp
.LCFI1:
        pushl   %ebx
.LCFI2:
        subl    $16, %esp
.LCFI3:
        movb    8(%ebp), %bl

and intra-class method calls to that method, call to .LVL0 instead of
_ZN4Test10assertHackEb.

-- 
           Summary: Optimization: Skip _Jv_InitClass for intra-class static
                    method calls
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: greenrd at greenrd dot org
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


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


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

* [Bug java/23500] Optimization: Skip _Jv_InitClass for intra-class static method calls
  2005-08-20 20:00 [Bug java/23500] New: Optimization: Skip _Jv_InitClass for intra-class static method calls greenrd at greenrd dot org
@ 2005-08-20 20:10 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-20 20:10 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-20 20:10 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2005-08-20 20:10:24
               date|                            |


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


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

end of thread, other threads:[~2005-08-20 20:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-20 20:00 [Bug java/23500] New: Optimization: Skip _Jv_InitClass for intra-class static method calls greenrd at greenrd dot org
2005-08-20 20:10 ` [Bug java/23500] " pinskia 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).