Long standing groovy step into issue

Egor Ushakov egor.ushakov at jetbrains.com
Thu Jan 30 05:00:46 PST 2014


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 at 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20140130/1478cd69/attachment.html 


More information about the serviceability-dev mailing list