Class KotlinSafeCallOperatorFilter
- java.lang.Object
-
- org.jacoco.core.internal.analysis.filter.KotlinSafeCallOperatorFilter
-
-
Constructor Summary
Constructors Constructor Description KotlinSafeCallOperatorFilter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfilter(org.objectweb.asm.tree.MethodNode methodNode, IFilterContext context, IFilterOutput output)This method is called for every method.private static java.util.Collection<java.util.ArrayList<org.objectweb.asm.tree.JumpInsnNode>>findChains(org.objectweb.asm.tree.MethodNode methodNode)"optimized" chain:private static booleanisUnoptimizedSafeCallFollowedByElvis(org.objectweb.asm.tree.JumpInsnNode jump, org.objectweb.asm.tree.AbstractInsnNode target, java.util.ArrayList<org.objectweb.asm.tree.JumpInsnNode> chain)private static org.objectweb.asm.tree.AbstractInsnNodepreceding(org.objectweb.asm.tree.AbstractInsnNode i, int opcode)
-
-
-
Method Detail
-
filter
public void filter(org.objectweb.asm.tree.MethodNode methodNode, IFilterContext context, IFilterOutput output)Description copied from interface:IFilterThis method is called for every method. The filter implementation is expected to inspect the provided method and report its result to the givenIFilterOutputinstance.
-
findChains
private static java.util.Collection<java.util.ArrayList<org.objectweb.asm.tree.JumpInsnNode>> findChains(org.objectweb.asm.tree.MethodNode methodNode)
"optimized" chain:DUP IFNULL label ... // call 0 ... DUP IFNULL label ... // call N label: POP
"unoptimized" chain:ALOAD v0 IFNULL label ... // call 0 ... ASTORE v1 ALOAD v1 IFNULL label ... // call N label: ACONST_NULL
"unoptimized" safe call operator(s) followed by elvis operator:ALOAD v0 IFNULL nullCase ... // call 0 ASTORE v1 ALOAD v1 IFNULL nullCase ... // call 1 ... ASTORE vN ALOAD vN IFNULL nullCase ALOAD vN GOTO nonNullCase nullCase: ... // right hand side of elvis operator nonNullCase: ...
-
isUnoptimizedSafeCallFollowedByElvis
private static boolean isUnoptimizedSafeCallFollowedByElvis(org.objectweb.asm.tree.JumpInsnNode jump, org.objectweb.asm.tree.AbstractInsnNode target, java.util.ArrayList<org.objectweb.asm.tree.JumpInsnNode> chain)
-
preceding
private static org.objectweb.asm.tree.AbstractInsnNode preceding(org.objectweb.asm.tree.AbstractInsnNode i, int opcode)- Returns:
- non pseudo-instruction preceding given if it has given opcode,
nullotherwise
-
-