Temporary disable smap generation

This commit is contained in:
Michael Bogdanov
2015-03-18 10:25:01 +03:00
parent 6e55ea6480
commit ed62e4972f
15 changed files with 69 additions and 32 deletions
@@ -20,6 +20,7 @@ import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.inline.FileMapping;
import org.jetbrains.kotlin.codegen.inline.InlineCodegenUtil;
import org.jetbrains.kotlin.codegen.inline.SMAPBuilder;
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
import org.jetbrains.org.objectweb.asm.*;
@@ -103,7 +104,7 @@ public abstract class AbstractClassBuilder implements ClassBuilder {
@Override
public void done() {
if (!fileMappings.isEmpty()) {
if (!fileMappings.isEmpty() && InlineCodegenUtil.GENERATE_SMAP) {
FileMapping origin = fileMappings.get(0);
assert sourceName == null || origin.getName().equals(sourceName) : "Error " + origin.getName() + " != " + sourceName;
getVisitor().visitSource(origin.getName(), new SMAPBuilder(origin.getName(), origin.getPath(), fileMappings).build());
@@ -167,9 +167,14 @@ public class AnonymousObjectTransformer {
//seems we can't do any clever mapping cause we don't know any about original class name
sourceMapper = IdenticalSourceMapper.INSTANCE$;
}
if (sourceInfo != null && !InlineCodegenUtil.GENERATE_SMAP) {
classBuilder.visitSource(sourceInfo, debugInfo);
}
}
else {
classBuilder.visitSource(sourceInfo, debugInfo);
if (sourceInfo != null) {
classBuilder.visitSource(sourceInfo, debugInfo);
}
sourceMapper = IdenticalSourceMapper.INSTANCE$;
}
@@ -87,7 +87,12 @@ public class InlineAdapter extends InstructionAdapter {
@Override
public void visitLineNumber(int line, Label start) {
sourceMapper.visitLineNumber(mv, line, start);
if (InlineCodegenUtil.GENERATE_SMAP) {
sourceMapper.visitLineNumber(mv, line, start);
}
else {
super.visitLineNumber(line, start);
}
}
@Override
@@ -63,6 +63,7 @@ import static org.jetbrains.kotlin.resolve.DescriptorUtils.getFqName;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isTrait;
public class InlineCodegenUtil {
public static final boolean GENERATE_SMAP = false;
public static final int API = Opcodes.ASM5;
public static final String INVOKE = "invoke";
@@ -124,7 +125,7 @@ public class InlineCodegenUtil {
}
return null;
}
}, ClassReader.SKIP_FRAMES);
}, ClassReader.SKIP_FRAMES | (GENERATE_SMAP ? 0 : ClassReader.SKIP_DEBUG));
SMAP smap = SMAPParser.parseOrCreateDefault(debugInfo[1], debugInfo[0], classId.toString(), lines[0], lines[1]);
return new SMAPAndMethodNode(node[0], smap);
@@ -329,6 +329,13 @@ public class MethodInliner {
super.visitMaxs(maxStack, maxLocals + capturedParamsSize);
}
@Override
public void visitLineNumber(int line, @NotNull Label start) {
if(isInliningLambda || InlineCodegenUtil.GENERATE_SMAP) {
super.visitLineNumber(line, start);
}
}
@Override
public void visitLocalVariable(
@NotNull String name, @NotNull String desc, String signature, @NotNull Label start, @NotNull Label end, int index
@@ -367,5 +367,4 @@ data open public class RangeMapping(val source: Int, val dest: Int, var range: I
return -1
}
}
}
}