Generate local var table
This commit is contained in:
@@ -63,7 +63,7 @@ import static org.jetbrains.kotlin.resolve.DescriptorUtils.getFqName;
|
|||||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isTrait;
|
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isTrait;
|
||||||
|
|
||||||
public class InlineCodegenUtil {
|
public class InlineCodegenUtil {
|
||||||
public static final boolean GENERATE_SMAP = false;
|
public static final boolean GENERATE_SMAP = true;
|
||||||
public static final int API = Opcodes.ASM5;
|
public static final int API = Opcodes.ASM5;
|
||||||
public static final String INVOKE = "invoke";
|
public static final String INVOKE = "invoke";
|
||||||
|
|
||||||
|
|||||||
@@ -97,9 +97,14 @@ public class LocalVarRemapper {
|
|||||||
|
|
||||||
public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index, MethodVisitor mv) {
|
public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index, MethodVisitor mv) {
|
||||||
RemapInfo info = doRemap(index);
|
RemapInfo info = doRemap(index);
|
||||||
|
//add entries only for shifted vars
|
||||||
if (SHIFT == info.status) {
|
if (SHIFT == info.status) {
|
||||||
//add entries only for shifted vars
|
int newIndex = ((StackValue.Local) info.value).index;
|
||||||
mv.visitLocalVariable(name, desc, signature, start, end, ((StackValue.Local) info.value).index);
|
if (newIndex != 0 && "this".equals(name)) {
|
||||||
|
/*skip additional this for now*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mv.visitLocalVariable(name, desc, signature, start, end, newIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ public class MethodInliner {
|
|||||||
public void visitLocalVariable(
|
public void visitLocalVariable(
|
||||||
@NotNull String name, @NotNull String desc, String signature, @NotNull Label start, @NotNull Label end, int index
|
@NotNull String name, @NotNull String desc, String signature, @NotNull Label start, @NotNull Label end, int index
|
||||||
) {
|
) {
|
||||||
if (isInliningLambda) {
|
if (isInliningLambda || InlineCodegenUtil.GENERATE_SMAP) {
|
||||||
super.visitLocalVariable(name, desc, signature, start, end, getNewIndex(index));
|
super.visitLocalVariable(name, desc, signature, start, end, getNewIndex(index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,4 +17,5 @@ class A {
|
|||||||
// VARIABLE : NAME=l TYPE=I INDEX=3
|
// VARIABLE : NAME=l TYPE=I INDEX=3
|
||||||
// VARIABLE : NAME=zzz TYPE=I INDEX=4
|
// VARIABLE : NAME=zzz TYPE=I INDEX=4
|
||||||
// VARIABLE : NAME=l TYPE=I INDEX=3
|
// VARIABLE : NAME=l TYPE=I INDEX=3
|
||||||
|
// VARIABLE : NAME=p TYPE=I INDEX=2
|
||||||
// VARIABLE : NAME=this TYPE=LA; INDEX=0
|
// VARIABLE : NAME=this TYPE=LA; INDEX=0
|
||||||
|
|||||||
Reference in New Issue
Block a user