I am trying to trace into the method handle linking code. I have a program like this:

    // HelloHM.java:8        mh.invokeExact("yo!");
    23:    aload_3;
    24:    ldc    #9; //    String "yo!";
    26:    invokevirtual    #10; //    Method java/lang/invoke/MethodHandle.invokeExact:"(Ljava/lang/String;)V";

I want to be able to set a break point at bytecode 26, do a single step, and then automatically land into the first bytecode of


Well, I can't even figure out a way to display bytecodes inside eclipse, or single step a single bytecode.

Also, I tried setting a breakpoint at MethodHandleNatives.linkMethodbut eclipse simply ignores that. (I can set normal break points in my test program's Java source code view).

So am I out of luck? Do I need to fall back to println() or jdb?

jdb is slightly better -- it doesn't allow single stepping bytecodes, or break at a specific bytecode. I can do this

main[1] stop at HelloMH:8
main[1] cont
Breakpoint hit: "thread=main", HelloMH.main(), line=8 bci=23
8            mh.invokeExact("yo!");

main[1] step
Step completed: "thread=main", jdk.internal.misc.SharedSecrets.setJavaLangInvokeAccess(), line=99 bci=1

main[1] where
  [1] jdk.internal.misc.SharedSecrets.setJavaLangInvokeAccess (SharedSecrets.java:99)   [2] java.lang.invoke.MethodHandleImpl.<clinit> (MethodHandleImpl.java:1,778)
  [3] java.lang.invoke.Invokers.checkCustomized (Invokers.java:571)
  [4] java.lang.invoke.LambdaForm$MH.1359044626.invokeExact_MT (null)
  [5] HelloMH.main (HelloMH.java:8)

But jdb's idea of "step" completely ignores the MH linking code inside MethodHandleNatives.linkMethod. So I have to resort to manually setting a break point at MethodHandleNatives.linkMethod.

- Ioi

mlvm-dev mailing list

Reply via email to