@@ -97,16 +97,20 @@ class MethodNodeBuilder(
9797 mn.maxLocals = localIndex
9898 mn.maxStack = maxStack + 1
9999 // At this moment, we're just copying annotations from original method without any modifications
100- // with(method.asmNode()) {
101- // mn.visibleAnnotations = visibleAnnotations
102- // mn.visibleTypeAnnotations = visibleTypeAnnotations
103- // mn.visibleLocalVariableAnnotations = visibleLocalVariableAnnotations
104- // mn.visibleParameterAnnotations = visibleParameterAnnotations
105- // mn.invisibleAnnotations = invisibleAnnotations
106- // mn.invisibleTypeAnnotations = invisibleTypeAnnotations
107- // mn.invisibleLocalVariableAnnotations = invisibleLocalVariableAnnotations
108- // mn.invisibleParameterAnnotations = invisibleParameterAnnotations
109- // }
100+ with (method.asmNode()) {
101+ mn.visibleAnnotations = visibleAnnotations
102+ mn.visibleTypeAnnotations = visibleTypeAnnotations
103+ mn.visibleParameterAnnotations = visibleParameterAnnotations
104+ mn.invisibleAnnotations = invisibleAnnotations
105+ mn.invisibleTypeAnnotations = invisibleTypeAnnotations
106+ mn.invisibleParameterAnnotations = invisibleParameterAnnotations
107+
108+ // this two line of code relies on labels in method body properly organized.
109+
110+ // mn.visibleLocalVariableAnnotations = visibleLocalVariableAnnotations
111+ // mn.invisibleLocalVariableAnnotations = invisibleLocalVariableAnnotations
112+
113+ }
110114 return mn
111115 }
112116
@@ -265,16 +269,27 @@ class MethodNodeBuilder(
265269 var shouldReverse = false
266270 val (zeroValue, zeroCmpOpcode, defaultOpcode) = when (cond) {
267271 is JcRawEqExpr -> when {
268- cond.lhv.typeName == PredefinedPrimitives .Null .typeName() -> Triple (JcRawNull (), Opcodes .IFNULL , Opcodes .IF_ACMPEQ )
272+ cond.lhv.typeName == PredefinedPrimitives .Null .typeName() -> Triple (
273+ JcRawNull (),
274+ Opcodes .IFNULL ,
275+ Opcodes .IF_ACMPEQ
276+ )
277+
269278 cond.lhv.typeName.isPrimitive -> Triple (JcRawInt (0 ), Opcodes .IFEQ , Opcodes .IF_ICMPEQ )
270279 else -> Triple (JcRawNull (), Opcodes .IFNULL , Opcodes .IF_ACMPEQ )
271280 }
272281
273282 is JcRawNeqExpr -> when {
274- cond.lhv.typeName == PredefinedPrimitives .Null .typeName() -> Triple (JcRawNull (), Opcodes .IFNONNULL , Opcodes .IF_ACMPNE )
283+ cond.lhv.typeName == PredefinedPrimitives .Null .typeName() -> Triple (
284+ JcRawNull (),
285+ Opcodes .IFNONNULL ,
286+ Opcodes .IF_ACMPNE
287+ )
288+
275289 cond.lhv.typeName.isPrimitive -> Triple (JcRawInt (0 ), Opcodes .IFNE , Opcodes .IF_ICMPNE )
276290 else -> Triple (JcRawNull (), Opcodes .IFNONNULL , Opcodes .IF_ACMPNE )
277291 }
292+
278293 is JcRawGeExpr -> Triple (JcRawInt (0 ), Opcodes .IFGE , Opcodes .IF_ICMPGE )
279294 is JcRawGtExpr -> Triple (JcRawInt (0 ), Opcodes .IFGT , Opcodes .IF_ICMPGT )
280295 is JcRawLeExpr -> Triple (JcRawInt (0 ), Opcodes .IFLE , Opcodes .IF_ICMPLE )
@@ -295,10 +310,12 @@ class MethodNodeBuilder(
295310 }
296311 JumpInsnNode (invertedZeroCmpOpcode, trueTarget)
297312 }
313+
298314 cond.rhv == zeroValue -> {
299315 cond.lhv.accept(this )
300316 JumpInsnNode (zeroCmpOpcode, trueTarget)
301317 }
318+
302319 else -> {
303320 cond.lhv.accept(this )
304321 cond.rhv.accept(this )
@@ -571,7 +588,7 @@ class MethodNodeBuilder(
571588 declaringClass.jvmClassName,
572589 name,
573590 if (argTypes.isEmpty() && tag <= H_GETSTATIC ) {
574- returnType.jvmTypeName
591+ returnType.jvmTypeName
575592 } else {
576593 " (${argTypes.joinToString(" " ) { it.jvmTypeName }} )${returnType.jvmTypeName} "
577594 },
@@ -819,6 +836,7 @@ class MethodNodeBuilder(
819836 }
820837 nodesBetweenLabels.clear()
821838 }
839+
822840 else -> nodesBetweenLabels.add(curInst)
823841 }
824842 ++ i
0 commit comments