unexpected instructions and parameters for invokevirtual in the inlined method body

后端 未结 1 1589
星月不相逢
星月不相逢 2021-01-22 17:26

I followed the sample code in the \"3.2.6 Inline Method“ in the http://asm.ow2.org/current/asm-transformations.pdf, to inline a MethodNode to a call site.

My problem is

相关标签:
1条回答
  • 2021-01-22 17:36

    The problem is caused when the label (the classreader reads from a class file) is visited by a MethodVisitor pipeline. The label has a field int [] srcAndRefPositions. Two of its consecutive positions (cfr. the end of my original post) are updated once the label is accessed by a MethodVisitor. In my case, the label in the ifeq label holds 2 MethodVisitors. It seems the incorrect position in the srcAndRefPositions is used when generating the class file (using the last MethodVisitor).

    I did not investigate the root cause. Instead, my solution was to clone the label and then use the new label when it is visited by a MethodVisitor.

    0 讨论(0)
提交回复
热议问题