[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    Re: Long standing groovy step into issue
From:       Egor Ushakov <egor.ushakov () jetbrains ! com>
Date:       2014-01-30 13:00:46
Message-ID: 52EA4CFE.2020300 () jetbrains ! com
[Download RAW message or body]

Tried it with the latest jdk 7 and jdk8 b124, no luck.
It works fine with groovy version that use invokedynamic, but regular 
version does not work.
Stopped working several years ago when groovy changed the way they 
generate classes.
However from what's in bytecode it is not obvious what's confusing the 
debugger, consider the code:

class T {
   private static void subfunction(Some some) {
         println "sub"
     }
}

*groovy *generates:
// access flags 0xA
   private static subfunction(Lxxx/Some;)V
    L0
     INVOKESTATIC xxx/Some.$getCallSiteArray 
()[Lorg/codehaus/groovy/runtime/callsite/CallSite;
     ASTORE 1
    L1
     LINENUMBER 21 L1
     ALOAD 1
     LDC 3
     AALOAD
     LDC Lxxx/Some;.class
     LDC "sub"
     INVOKEINTERFACE 
org/codehaus/groovy/runtime/callsite/CallSite.callStatic 
(Ljava/lang/Class;Ljava/lang/Object;)Ljava/lang/Object;
     POP
    L2
     RETURN
     LOCALVARIABLE some Lxxx/Some; L0 L2 0
     MAXSTACK = 3
     MAXLOCALS = 2

*javac* generates: (I replaced println with System.out.printl)
// access flags 0xA
   private static subfunction(Lxxx/Some;)V
    L0
     LINENUMBER 21 L0
     GETSTATIC java/lang/System.out : Ljava/io/PrintStream;
     LDC "sub"
     INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/String;)V
    L1
     LINENUMBER 22 L1
     RETURN
    L2
     LOCALVARIABLE some Lxxx/Some; L0 L2 0
     MAXSTACK = 2
     MAXLOCALS = 1

Egor

On 30.01.2014 15:53, Staffan Larsen wrote:
> What version of Hotspot have you tried this with? There was a bug fix for \
> invokedynamic and line numbers that may or may not be relevant in jdk8-b115: \
> https://bugs.openjdk.java.net/browse/JDK-8026508 
> /Staffan
> 
> On 30 jan 2014, at 11:33, Egor Ushakov <egor.ushakov@jetbrains.com> wrote:
> 
> > Hi guys!
> > 
> > there is a long standing issue (on groovy) \
> > https://jira.codehaus.org/browse/GROOVY-4063, that does not allow to do correct \
> > step into: java debugger just skips the user code together with the code in \
> > stepping filters. If breakpoint is set in user code it stops where expected.
> > Could someone please give a hint on how groovy should correctly generate the code \
> > not to confuse debugger step filters. 
> > Thanks in advance,
> > Egor


[Attachment #3 (text/html)]

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Tried it with the latest jdk 7 and jdk8 b124, no luck.<br>
    It works fine with groovy version that use invokedynamic, but
    regular version does not work.<br>
    Stopped working several years ago when groovy changed the way they
    generate classes.<br>
    However from what's in bytecode it is not obvious what's confusing
    the debugger, consider the code:<br>
    <pre class="code-java" style="margin: 0px; padding: 0px; max-height: 30em; \
overflow: auto; white-space: pre-wrap; word-wrap: normal; color: rgb(51, 51, 51); \
font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; \
letter-spacing: normal; line-height: 12.799999237060547px; orphans: auto; text-align: \
start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; \
-webkit-text-stroke-width: 0px; background-color: rgb(245, 245, 245);">class T {  \
<span class="code-keyword" style="color: rgb(0, 0, 145);">private static void \
subfunction(Some some) {  println "sub"
    }</span>
}</pre>
    <b>groovy </b>generates:<br>
    // access flags 0xA<br>
    &nbsp; private static subfunction(Lxxx/Some;)V<br>
    &nbsp;&nbsp; L0<br>
    &nbsp;&nbsp;&nbsp; INVOKESTATIC xxx/Some.$getCallSiteArray
    ()[Lorg/codehaus/groovy/runtime/callsite/CallSite;<br>
    &nbsp;&nbsp;&nbsp; ASTORE 1<br>
    &nbsp;&nbsp; L1<br>
    &nbsp;&nbsp;&nbsp; LINENUMBER 21 L1<br>
    &nbsp;&nbsp;&nbsp; ALOAD 1<br>
    &nbsp;&nbsp;&nbsp; LDC 3<br>
    &nbsp;&nbsp;&nbsp; AALOAD<br>
    &nbsp;&nbsp;&nbsp; LDC Lxxx/Some;.class<br>
    &nbsp;&nbsp;&nbsp; LDC "sub"<br>
    &nbsp;&nbsp;&nbsp; INVOKEINTERFACE
    org/codehaus/groovy/runtime/callsite/CallSite.callStatic
    (Ljava/lang/Class;Ljava/lang/Object;)Ljava/lang/Object;<br>
    &nbsp;&nbsp;&nbsp; POP<br>
    &nbsp;&nbsp; L2<br>
    &nbsp;&nbsp;&nbsp; RETURN<br>
    &nbsp;&nbsp;&nbsp; LOCALVARIABLE some Lxxx/Some; L0 L2 0<br>
    &nbsp;&nbsp;&nbsp; MAXSTACK = 3<br>
    &nbsp;&nbsp;&nbsp; MAXLOCALS = 2<br>
    <br>
    <b>javac</b> generates: (I replaced println with System.out.printl)<br>
    // access flags 0xA<br>
    &nbsp; private static subfunction(Lxxx/Some;)V<br>
    &nbsp;&nbsp; L0<br>
    &nbsp;&nbsp;&nbsp; LINENUMBER 21 L0<br>
    &nbsp;&nbsp;&nbsp; GETSTATIC java/lang/System.out : Ljava/io/PrintStream;<br>
    &nbsp;&nbsp;&nbsp; LDC "sub"<br>
    &nbsp;&nbsp;&nbsp; INVOKEVIRTUAL java/io/PrintStream.println \
(Ljava/lang/String;)V<br>  &nbsp;&nbsp; L1<br>
    &nbsp;&nbsp;&nbsp; LINENUMBER 22 L1<br>
    &nbsp;&nbsp;&nbsp; RETURN<br>
    &nbsp;&nbsp; L2<br>
    &nbsp;&nbsp;&nbsp; LOCALVARIABLE some Lxxx/Some; L0 L2 0<br>
    &nbsp;&nbsp;&nbsp; MAXSTACK = 2<br>
    &nbsp;&nbsp;&nbsp; MAXLOCALS = 1<br>
    <br>
    Egor<br>
    <br>
    <div class="moz-cite-prefix">On 30.01.2014 15:53, Staffan Larsen
      wrote:<br>
    </div>
    <blockquote
      cite="mid:BAA1E244-19C4-481C-ABDF-E15ACD79DD7C@oracle.com"
      type="cite">
      <pre wrap="">What version of Hotspot have you tried this with? There was a bug \
fix for invokedynamic and line numbers that may or may not be relevant in jdk8-b115: \
<a class="moz-txt-link-freetext" \
href="https://bugs.openjdk.java.net/browse/JDK-8026508">https://bugs.openjdk.java.net/browse/JDK-8026508</a>


/Staffan

On 30 jan 2014, at 11:33, Egor Ushakov <a class="moz-txt-link-rfc2396E" \
href="mailto:egor.ushakov@jetbrains.com">&lt;egor.ushakov@jetbrains.com&gt;</a> \
wrote:

</pre>
      <blockquote type="cite">
        <pre wrap="">Hi guys!

there is a long standing issue (on groovy) <a class="moz-txt-link-freetext" \
href="https://jira.codehaus.org/browse/GROOVY-4063">https://jira.codehaus.org/browse/GROOVY-4063</a>,
 that does not allow to do correct step into: java debugger just skips the user code \
together with the code in stepping filters. If breakpoint is set in user code it \
stops where expected. Could someone please give a hint on how groovy should correctly \
generate the code not to confuse debugger step filters.

Thanks in advance,
Egor
</pre>
      </blockquote>
      <pre wrap="">
</pre>
    </blockquote>
    <br>
  </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic