Merge remote branch 'origin/master'
This commit is contained in:
@@ -7,9 +7,8 @@ import com.intellij.openapi.util.io.FileUtil;
|
|||||||
import com.intellij.openapi.util.text.StringUtil;
|
import com.intellij.openapi.util.text.StringUtil;
|
||||||
import com.intellij.util.Function;
|
import com.intellij.util.Function;
|
||||||
import com.intellij.util.Processor;
|
import com.intellij.util.Processor;
|
||||||
import jet.ExtensionFunction0;
|
import jet.modules.AllModules;
|
||||||
import jet.modules.IModuleBuilder;
|
import jet.modules.Module;
|
||||||
import jet.modules.IModuleSetBuilder;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.codegen.ClassFileFactory;
|
import org.jetbrains.jet.codegen.ClassFileFactory;
|
||||||
import org.jetbrains.jet.codegen.GeneratedClassLoader;
|
import org.jetbrains.jet.codegen.GeneratedClassLoader;
|
||||||
@@ -19,7 +18,7 @@ import org.jetbrains.jet.lang.resolve.java.JvmAbi;
|
|||||||
import org.jetbrains.jet.plugin.JetMainDetector;
|
import org.jetbrains.jet.plugin.JetMainDetector;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -174,13 +173,14 @@ public class CompileEnvironment {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
final IModuleSetBuilder moduleSetBuilder = loadModuleScript(moduleFile);
|
final List<Module> modules = loadModuleScript(moduleFile);
|
||||||
if (moduleSetBuilder == null) {
|
|
||||||
return;
|
if (modules == null) {
|
||||||
|
throw new CompileEnvironmentException("Module script " + moduleFile + " compilation failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
final String directory = new File(moduleFile).getParent();
|
final String directory = new File(moduleFile).getParent();
|
||||||
for (IModuleBuilder moduleBuilder : moduleSetBuilder.getModules()) {
|
for (Module moduleBuilder : modules) {
|
||||||
ClassFileFactory moduleFactory = compileModule(moduleBuilder, directory);
|
ClassFileFactory moduleFactory = compileModule(moduleBuilder, directory);
|
||||||
final String path = jarPath != null ? jarPath : new File(directory, moduleBuilder.getModuleName() + ".jar").getPath();
|
final String path = jarPath != null ? jarPath : new File(directory, moduleBuilder.getModuleName() + ".jar").getPath();
|
||||||
try {
|
try {
|
||||||
@@ -191,7 +191,7 @@ public class CompileEnvironment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IModuleSetBuilder loadModuleScript(String moduleFile) {
|
public List<Module> loadModuleScript(String moduleFile) {
|
||||||
CompileSession scriptCompileSession = new CompileSession(myEnvironment);
|
CompileSession scriptCompileSession = new CompileSession(myEnvironment);
|
||||||
scriptCompileSession.addSources(moduleFile);
|
scriptCompileSession.addSources(moduleFile);
|
||||||
scriptCompileSession.addStdLibSources(true);
|
scriptCompileSession.addStdLibSources(true);
|
||||||
@@ -204,34 +204,25 @@ public class CompileEnvironment {
|
|||||||
return runDefineModules(moduleFile, factory);
|
return runDefineModules(moduleFile, factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IModuleSetBuilder runDefineModules(String moduleFile, ClassFileFactory factory) {
|
private static List<Module> runDefineModules(String moduleFile, ClassFileFactory factory) {
|
||||||
GeneratedClassLoader loader = new GeneratedClassLoader(factory);
|
GeneratedClassLoader loader = new GeneratedClassLoader(factory);
|
||||||
try {
|
try {
|
||||||
Class moduleSetBuilderClass = loader.loadClass("kotlin.modules.ModuleSetBuilder");
|
|
||||||
final IModuleSetBuilder moduleSetBuilder = (IModuleSetBuilder) moduleSetBuilderClass.newInstance();
|
|
||||||
|
|
||||||
Class namespaceClass = loader.loadClass(JvmAbi.PACKAGE_CLASS);
|
Class namespaceClass = loader.loadClass(JvmAbi.PACKAGE_CLASS);
|
||||||
final Field[] fields = namespaceClass.getDeclaredFields();
|
final Method method = namespaceClass.getDeclaredMethod("project");
|
||||||
boolean modulesDefined = false;
|
if (method == null) {
|
||||||
for (Field field : fields) {
|
throw new CompileEnvironmentException("Module script " + moduleFile + " must define project() function");
|
||||||
if (field.getName().equals("modules")) {
|
|
||||||
field.setAccessible(true);
|
|
||||||
ExtensionFunction0 defineMudules = (ExtensionFunction0) field.get(null);
|
|
||||||
defineMudules.invoke(moduleSetBuilder);
|
|
||||||
modulesDefined = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!modulesDefined) {
|
method.setAccessible(true);
|
||||||
throw new CompileEnvironmentException("Module script " + moduleFile + " must define a modules() property");
|
method.invoke(null);
|
||||||
}
|
|
||||||
return moduleSetBuilder;
|
return AllModules.modules;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new CompileEnvironmentException(e);
|
throw new CompileEnvironmentException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClassFileFactory compileModule(IModuleBuilder moduleBuilder, String directory) {
|
public ClassFileFactory compileModule(Module moduleBuilder, String directory) {
|
||||||
CompileSession moduleCompileSession = new CompileSession(myEnvironment);
|
CompileSession moduleCompileSession = new CompileSession(myEnvironment);
|
||||||
if (!"stdlib".equals(moduleBuilder.getModuleName())) {
|
if (!"stdlib".equals(moduleBuilder.getModuleName())) {
|
||||||
moduleCompileSession.addStdLibSources(false);
|
moduleCompileSession.addStdLibSources(false);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public interface JetControlFlowBuilder {
|
|||||||
|
|
||||||
void bindLabel(@NotNull Label label);
|
void bindLabel(@NotNull Label label);
|
||||||
void allowDead();
|
void allowDead();
|
||||||
|
void stopAllowDead();
|
||||||
|
|
||||||
// Jumps
|
// Jumps
|
||||||
void jump(@NotNull Label label);
|
void jump(@NotNull Label label);
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ public class JetControlFlowBuilderAdapter implements JetControlFlowBuilder {
|
|||||||
builder.allowDead();
|
builder.allowDead();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopAllowDead() {
|
||||||
|
assert builder != null;
|
||||||
|
builder.stopAllowDead();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void jump(@NotNull Label label) {
|
public void jump(@NotNull Label label) {
|
||||||
assert builder != null;
|
assert builder != null;
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.cfg.pseudocode.*;
|
import org.jetbrains.jet.lang.cfg.pseudocode.*;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author svtk
|
* @author svtk
|
||||||
@@ -140,7 +137,6 @@ public class JetControlFlowGraphTraverser<D> {
|
|||||||
Collections.reverse(instructions);
|
Collections.reverse(instructions);
|
||||||
}
|
}
|
||||||
for (Instruction instruction : instructions) {
|
for (Instruction instruction : instructions) {
|
||||||
if (instruction.isDead()) continue;
|
|
||||||
if (lookInside && instruction instanceof LocalDeclarationInstruction) {
|
if (lookInside && instruction instanceof LocalDeclarationInstruction) {
|
||||||
traverseAndAnalyzeInstructionGraph(((LocalDeclarationInstruction) instruction).getBody(), instructionDataAnalyzeStrategy);
|
traverseAndAnalyzeInstructionGraph(((LocalDeclarationInstruction) instruction).getBody(), instructionDataAnalyzeStrategy);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,6 +153,8 @@ public class JetControlFlowProcessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitParenthesizedExpression(JetParenthesizedExpression expression) {
|
public void visitParenthesizedExpression(JetParenthesizedExpression expression) {
|
||||||
|
builder.read(expression);
|
||||||
|
|
||||||
JetExpression innerExpression = expression.getExpression();
|
JetExpression innerExpression = expression.getExpression();
|
||||||
if (innerExpression != null) {
|
if (innerExpression != null) {
|
||||||
value(innerExpression, inCondition);
|
value(innerExpression, inCondition);
|
||||||
@@ -340,6 +342,7 @@ public class JetControlFlowProcessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitTryExpression(JetTryExpression expression) {
|
public void visitTryExpression(JetTryExpression expression) {
|
||||||
|
builder.read(expression);
|
||||||
final JetFinallySection finallyBlock = expression.getFinallyBlock();
|
final JetFinallySection finallyBlock = expression.getFinallyBlock();
|
||||||
if (finallyBlock != null) {
|
if (finallyBlock != null) {
|
||||||
builder.enterTryFinally(new GenerationTrigger() {
|
builder.enterTryFinally(new GenerationTrigger() {
|
||||||
@@ -408,10 +411,12 @@ public class JetControlFlowProcessor {
|
|||||||
builder.exitTryFinally();
|
builder.exitTryFinally();
|
||||||
value(finallyBlock.getFinalExpression(), inCondition);
|
value(finallyBlock.getFinalExpression(), inCondition);
|
||||||
}
|
}
|
||||||
|
builder.stopAllowDead();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitWhileExpression(JetWhileExpression expression) {
|
public void visitWhileExpression(JetWhileExpression expression) {
|
||||||
|
builder.read(expression);
|
||||||
LoopInfo loopInfo = builder.enterLoop(expression, null, null);
|
LoopInfo loopInfo = builder.enterLoop(expression, null, null);
|
||||||
|
|
||||||
builder.bindLabel(loopInfo.getConditionEntryPoint());
|
builder.bindLabel(loopInfo.getConditionEntryPoint());
|
||||||
@@ -433,6 +438,7 @@ public class JetControlFlowProcessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitDoWhileExpression(JetDoWhileExpression expression) {
|
public void visitDoWhileExpression(JetDoWhileExpression expression) {
|
||||||
|
builder.read(expression);
|
||||||
LoopInfo loopInfo = builder.enterLoop(expression, null, null);
|
LoopInfo loopInfo = builder.enterLoop(expression, null, null);
|
||||||
|
|
||||||
builder.bindLabel(loopInfo.getBodyEntryPoint());
|
builder.bindLabel(loopInfo.getBodyEntryPoint());
|
||||||
@@ -452,6 +458,7 @@ public class JetControlFlowProcessor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visitForExpression(JetForExpression expression) {
|
public void visitForExpression(JetForExpression expression) {
|
||||||
|
builder.read(expression);
|
||||||
JetExpression loopRange = expression.getLoopRange();
|
JetExpression loopRange = expression.getLoopRange();
|
||||||
if (loopRange != null) {
|
if (loopRange != null) {
|
||||||
value(loopRange, false);
|
value(loopRange, false);
|
||||||
|
|||||||
@@ -252,7 +252,10 @@ public class JetFlowInformationProvider {
|
|||||||
analyzeLocalDeclarations(processLocalDeclaration, pseudocode);
|
analyzeLocalDeclarations(processLocalDeclaration, pseudocode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkIsInitialized(@NotNull VariableDescriptor variableDescriptor, @NotNull JetElement element, @NotNull VariableInitializers variableInitializers, @NotNull Collection<VariableDescriptor> varWithUninitializedErrorGenerated) {
|
private void checkIsInitialized(@NotNull VariableDescriptor variableDescriptor,
|
||||||
|
@NotNull JetElement element,
|
||||||
|
@NotNull VariableInitializers variableInitializers,
|
||||||
|
@NotNull Collection<VariableDescriptor> varWithUninitializedErrorGenerated) {
|
||||||
if (!(element instanceof JetSimpleNameExpression)) return;
|
if (!(element instanceof JetSimpleNameExpression)) return;
|
||||||
|
|
||||||
boolean isInitialized = variableInitializers.isInitialized();
|
boolean isInitialized = variableInitializers.isInitialized();
|
||||||
@@ -272,7 +275,10 @@ public class JetFlowInformationProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkValReassignment(@NotNull VariableDescriptor variableDescriptor, @NotNull JetExpression expression, @NotNull VariableInitializers enterInitializers, @NotNull Collection<VariableDescriptor> varWithValReassignErrorGenerated) {
|
private boolean checkValReassignment(@NotNull VariableDescriptor variableDescriptor,
|
||||||
|
@NotNull JetExpression expression,
|
||||||
|
@NotNull VariableInitializers enterInitializers,
|
||||||
|
@NotNull Collection<VariableDescriptor> varWithValReassignErrorGenerated) {
|
||||||
boolean isInitializedNotHere = enterInitializers.isInitialized();
|
boolean isInitializedNotHere = enterInitializers.isInitialized();
|
||||||
Set<JetElement> possibleLocalInitializers = enterInitializers.getPossibleLocalInitializers();
|
Set<JetElement> possibleLocalInitializers = enterInitializers.getPossibleLocalInitializers();
|
||||||
if (possibleLocalInitializers.size() == 1) {
|
if (possibleLocalInitializers.size() == 1) {
|
||||||
|
|||||||
@@ -20,6 +20,4 @@ public interface Instruction {
|
|||||||
Collection<Instruction> getNextInstructions();
|
Collection<Instruction> getNextInstructions();
|
||||||
|
|
||||||
void accept(InstructionVisitor visitor);
|
void accept(InstructionVisitor visitor);
|
||||||
|
|
||||||
boolean isDead();
|
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-1
@@ -190,7 +190,7 @@ public class JetControlFlowInstructionsGenerator extends JetControlFlowBuilderAd
|
|||||||
bindLabel(getExitPoint(subroutine));
|
bindLabel(getExitPoint(subroutine));
|
||||||
pseudocode.addExitInstruction(new SubroutineExitInstruction(subroutine, "<END>"));
|
pseudocode.addExitInstruction(new SubroutineExitInstruction(subroutine, "<END>"));
|
||||||
bindLabel(error);
|
bindLabel(error);
|
||||||
add(new SubroutineExitInstruction(subroutine, "<ERROR>"));
|
pseudocode.addErrorInstruction(new SubroutineExitInstruction(subroutine, "<ERROR>"));
|
||||||
bindLabel(sink);
|
bindLabel(sink);
|
||||||
pseudocode.addSinkInstruction(new SubroutineSinkInstruction(subroutine, "<SINK>"));
|
pseudocode.addSinkInstruction(new SubroutineSinkInstruction(subroutine, "<SINK>"));
|
||||||
elementToBlockInfo.remove(subroutine);
|
elementToBlockInfo.remove(subroutine);
|
||||||
@@ -266,6 +266,13 @@ public class JetControlFlowInstructionsGenerator extends JetControlFlowBuilderAd
|
|||||||
pseudocode.allowDead(allowedDeadLabel);
|
pseudocode.allowDead(allowedDeadLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopAllowDead() {
|
||||||
|
Label allowedDeadLabel = createUnboundLabel();
|
||||||
|
bindLabel(allowedDeadLabel);
|
||||||
|
pseudocode.stopAllowDead(allowedDeadLabel);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void nondeterministicJump(Label label) {
|
public void nondeterministicJump(Label label) {
|
||||||
handleJumpInsideTryFinally(label);
|
handleJumpInsideTryFinally(label);
|
||||||
|
|||||||
@@ -56,12 +56,16 @@ public class Pseudocode {
|
|||||||
|
|
||||||
private final List<Instruction> mutableInstructionList = new ArrayList<Instruction>();
|
private final List<Instruction> mutableInstructionList = new ArrayList<Instruction>();
|
||||||
private final List<Instruction> instructions = new ArrayList<Instruction>();
|
private final List<Instruction> instructions = new ArrayList<Instruction>();
|
||||||
|
private List<Instruction> deadInstructions;
|
||||||
|
|
||||||
private final List<PseudocodeLabel> labels = new ArrayList<PseudocodeLabel>();
|
private final List<PseudocodeLabel> labels = new ArrayList<PseudocodeLabel>();
|
||||||
private final List<PseudocodeLabel> allowedDeadLabels = new ArrayList<PseudocodeLabel>();
|
private final List<PseudocodeLabel> allowedDeadLabels = new ArrayList<PseudocodeLabel>();
|
||||||
|
private final List<PseudocodeLabel> stopAllowDeadLabels = new ArrayList<PseudocodeLabel>();
|
||||||
|
|
||||||
private final JetElement correspondingElement;
|
private final JetElement correspondingElement;
|
||||||
private SubroutineExitInstruction exitInstruction;
|
private SubroutineExitInstruction exitInstruction;
|
||||||
private SubroutineSinkInstruction sinkInstruction;
|
private SubroutineSinkInstruction sinkInstruction;
|
||||||
|
private SubroutineExitInstruction errorInstruction;
|
||||||
private boolean postPrecessed = false;
|
private boolean postPrecessed = false;
|
||||||
|
|
||||||
public Pseudocode(JetElement correspondingElement) {
|
public Pseudocode(JetElement correspondingElement) {
|
||||||
@@ -82,6 +86,10 @@ public class Pseudocode {
|
|||||||
allowedDeadLabels.add((PseudocodeLabel) label);
|
allowedDeadLabels.add((PseudocodeLabel) label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stopAllowDead(Label label) {
|
||||||
|
stopAllowDeadLabels.add((PseudocodeLabel) label);
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<Instruction> getInstructions() {
|
public List<Instruction> getInstructions() {
|
||||||
return instructions;
|
return instructions;
|
||||||
@@ -95,12 +103,19 @@ public class Pseudocode {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public List<Instruction> getDeadInstructions() {
|
public List<Instruction> getDeadInstructions() {
|
||||||
List<Instruction> deadInstructions = Lists.newArrayList();
|
if (deadInstructions != null) {
|
||||||
for (Instruction instruction : instructions) {
|
return deadInstructions;
|
||||||
if (instruction.isDead()) {
|
}
|
||||||
|
deadInstructions = Lists.newArrayList();
|
||||||
|
Collection<Instruction> allowedDeadInstructions = collectAllowedDeadInstructions();
|
||||||
|
|
||||||
|
for (Instruction instruction : mutableInstructionList) {
|
||||||
|
if (((InstructionImpl)instruction).isDead()) {
|
||||||
|
if (!allowedDeadInstructions.contains(instruction)) {
|
||||||
deadInstructions.add(instruction);
|
deadInstructions.add(instruction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return deadInstructions;
|
return deadInstructions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,6 +137,12 @@ public class Pseudocode {
|
|||||||
this.sinkInstruction = sinkInstruction;
|
this.sinkInstruction = sinkInstruction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addErrorInstruction(SubroutineExitInstruction errorInstruction) {
|
||||||
|
addInstruction(errorInstruction);
|
||||||
|
assert this.errorInstruction == null;
|
||||||
|
this.errorInstruction = errorInstruction;
|
||||||
|
}
|
||||||
|
|
||||||
public void addInstruction(Instruction instruction) {
|
public void addInstruction(Instruction instruction) {
|
||||||
mutableInstructionList.add(instruction);
|
mutableInstructionList.add(instruction);
|
||||||
instruction.setOwner(this);
|
instruction.setOwner(this);
|
||||||
@@ -151,8 +172,19 @@ public class Pseudocode {
|
|||||||
if (postPrecessed) return;
|
if (postPrecessed) return;
|
||||||
postPrecessed = true;
|
postPrecessed = true;
|
||||||
for (int i = 0, instructionsSize = mutableInstructionList.size(); i < instructionsSize; i++) {
|
for (int i = 0, instructionsSize = mutableInstructionList.size(); i < instructionsSize; i++) {
|
||||||
Instruction instruction = mutableInstructionList.get(i);
|
processInstruction(mutableInstructionList.get(i), i);
|
||||||
final int currentPosition = i;
|
}
|
||||||
|
getExitInstruction().setSink(getSinkInstruction());
|
||||||
|
Set<Instruction> reachableInstructions = collectReachableInstructions();
|
||||||
|
for (Instruction instruction : mutableInstructionList) {
|
||||||
|
if (reachableInstructions.contains(instruction)) {
|
||||||
|
instructions.add(instruction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
markDeadInstructions();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processInstruction(Instruction instruction, final int currentPosition) {
|
||||||
instruction.accept(new InstructionVisitor() {
|
instruction.accept(new InstructionVisitor() {
|
||||||
@Override
|
@Override
|
||||||
public void visitInstructionWithNext(InstructionWithNext instruction) {
|
public void visitInstructionWithNext(InstructionWithNext instruction) {
|
||||||
@@ -210,30 +242,38 @@ public class Pseudocode {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getExitInstruction().setSink(getSinkInstruction());
|
|
||||||
Set<Instruction> allowedDeadStartInstructions = prepareAllowedDeadInstructions();
|
|
||||||
markDeadInstructions();
|
|
||||||
Collection<Instruction> allowedDeadInstructions = collectAllowedDeadInstructions(allowedDeadStartInstructions);
|
|
||||||
instructions.addAll(mutableInstructionList);
|
|
||||||
instructions.removeAll(allowedDeadInstructions);
|
|
||||||
|
|
||||||
|
private Set<Instruction> collectReachableInstructions() {
|
||||||
|
Set<Instruction> visited = Sets.newHashSet();
|
||||||
|
traverseNextInstructions(getEnterInstruction(), visited);
|
||||||
|
if (!visited.contains(getExitInstruction())) {
|
||||||
|
visited.add(getExitInstruction());
|
||||||
|
}
|
||||||
|
if (!visited.contains(errorInstruction)) {
|
||||||
|
visited.add(errorInstruction);
|
||||||
|
}
|
||||||
|
if (!visited.contains(getSinkInstruction())) {
|
||||||
|
visited.add(getSinkInstruction());
|
||||||
|
}
|
||||||
|
return visited;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void traverseNextInstructions(Instruction instruction, Set<Instruction> visited) {
|
||||||
|
if (visited.contains(instruction)) return;
|
||||||
|
visited.add(instruction);
|
||||||
|
for (Instruction nextInstruction : instruction.getNextInstructions()) {
|
||||||
|
traverseNextInstructions(nextInstruction, visited);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void markDeadInstructions() {
|
private void markDeadInstructions() {
|
||||||
boolean hasRemovedInstruction = true;
|
Set<Instruction> instructionSet = Sets.newHashSet(instructions);
|
||||||
Collection<Instruction> processedInstructions = Sets.newHashSet();
|
|
||||||
while (hasRemovedInstruction) {
|
|
||||||
hasRemovedInstruction = false;
|
|
||||||
for (Instruction instruction : mutableInstructionList) {
|
for (Instruction instruction : mutableInstructionList) {
|
||||||
if (!(instruction instanceof SubroutineEnterInstruction || instruction instanceof SubroutineExitInstruction || instruction instanceof SubroutineSinkInstruction) &&
|
if (!instructionSet.contains(instruction)) {
|
||||||
instruction.getPreviousInstructions().isEmpty() && !processedInstructions.contains(instruction)) {
|
((InstructionImpl)instruction).die();
|
||||||
hasRemovedInstruction = true;
|
|
||||||
for (Instruction nextInstruction : instruction.getNextInstructions()) {
|
for (Instruction nextInstruction : instruction.getNextInstructions()) {
|
||||||
nextInstruction.getPreviousInstructions().remove(instruction);
|
nextInstruction.getPreviousInstructions().remove(instruction);
|
||||||
}
|
}
|
||||||
((InstructionImpl)instruction).die();
|
|
||||||
processedInstructions.add(instruction);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,7 +283,7 @@ public class Pseudocode {
|
|||||||
Set<Instruction> allowedDeadStartInstructions = Sets.newHashSet();
|
Set<Instruction> allowedDeadStartInstructions = Sets.newHashSet();
|
||||||
for (PseudocodeLabel allowedDeadLabel : allowedDeadLabels) {
|
for (PseudocodeLabel allowedDeadLabel : allowedDeadLabels) {
|
||||||
Instruction allowedDeadInstruction = getJumpTarget(allowedDeadLabel);
|
Instruction allowedDeadInstruction = getJumpTarget(allowedDeadLabel);
|
||||||
if (allowedDeadInstruction.getPreviousInstructions().isEmpty()) {
|
if (((InstructionImpl)allowedDeadInstruction).isDead()) {
|
||||||
allowedDeadStartInstructions.add(allowedDeadInstruction);
|
allowedDeadStartInstructions.add(allowedDeadInstruction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,19 +291,35 @@ public class Pseudocode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private Collection<Instruction> collectAllowedDeadInstructions(@NotNull Set<Instruction> allowedDeadStartInstructions) {
|
private Set<Instruction> prepareStopAllowedDeadInstructions() {
|
||||||
|
Set<Instruction> stopAllowedDeadInstructions = Sets.newHashSet();
|
||||||
|
for (PseudocodeLabel stopAllowedDeadLabel : stopAllowDeadLabels) {
|
||||||
|
Instruction stopAllowDeadInsruction = getJumpTarget(stopAllowedDeadLabel);
|
||||||
|
if (((InstructionImpl)stopAllowDeadInsruction).isDead()) {
|
||||||
|
stopAllowedDeadInstructions.add(stopAllowDeadInsruction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stopAllowedDeadInstructions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Collection<Instruction> collectAllowedDeadInstructions() {
|
||||||
|
Set<Instruction> allowedDeadStartInstructions = prepareAllowedDeadInstructions();
|
||||||
|
Set<Instruction> stopAllowDeadInstructions = prepareStopAllowedDeadInstructions();
|
||||||
Set<Instruction> allowedDeadInstructions = Sets.newHashSet();
|
Set<Instruction> allowedDeadInstructions = Sets.newHashSet();
|
||||||
|
|
||||||
for (Instruction allowedDeadStartInstruction : allowedDeadStartInstructions) {
|
for (Instruction allowedDeadStartInstruction : allowedDeadStartInstructions) {
|
||||||
collectAllowedDeadInstructions(allowedDeadStartInstruction, allowedDeadInstructions);
|
collectAllowedDeadInstructions(allowedDeadStartInstruction, allowedDeadInstructions, stopAllowDeadInstructions);
|
||||||
}
|
}
|
||||||
return allowedDeadInstructions;
|
return allowedDeadInstructions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void collectAllowedDeadInstructions(Instruction allowedDeadInstruction, Set<Instruction> instructionSet) {
|
private void collectAllowedDeadInstructions(Instruction allowedDeadInstruction, Set<Instruction> instructionSet, Set<Instruction> stopAllowDeadInstructions) {
|
||||||
if (allowedDeadInstruction.isDead()) {
|
if (stopAllowDeadInstructions.contains(allowedDeadInstruction)) return;
|
||||||
|
if (((InstructionImpl)allowedDeadInstruction).isDead()) {
|
||||||
instructionSet.add(allowedDeadInstruction);
|
instructionSet.add(allowedDeadInstruction);
|
||||||
for (Instruction instruction : allowedDeadInstruction.getNextInstructions()) {
|
for (Instruction instruction : allowedDeadInstruction.getNextInstructions()) {
|
||||||
collectAllowedDeadInstructions(instruction, instructionSet);
|
collectAllowedDeadInstructions(instruction, instructionSet, stopAllowDeadInstructions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,17 @@ fun t1() {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[r(1)] PREV:[]
|
<START> NEXT:[r(try { 1 } finally { 2 }) ] PREV:[]
|
||||||
r(1) NEXT:[r(2)] PREV:[<START>]
|
r(try {
|
||||||
|
1
|
||||||
|
} finally {
|
||||||
|
2
|
||||||
|
}) NEXT:[r(1)] PREV:[<START>]
|
||||||
|
r(1) NEXT:[r(2)] PREV:[r(try { 1 } finally { 2 }) ]
|
||||||
l2:
|
l2:
|
||||||
r(2) NEXT:[<END>] PREV:[r(1)]
|
r(2) NEXT:[<END>] PREV:[r(1)]
|
||||||
l1:
|
l1:
|
||||||
|
l3:
|
||||||
<END> NEXT:[<SINK>] PREV:[r(2)]
|
<END> NEXT:[<SINK>] PREV:[r(2)]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
@@ -32,8 +38,16 @@ fun t2() {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[r(1)] PREV:[]
|
<START> NEXT:[r(try { 1 if (2 > 3) { retur..)] PREV:[]
|
||||||
r(1) NEXT:[r(2)] PREV:[<START>]
|
r(try {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
2
|
||||||
|
}) NEXT:[r(1)] PREV:[<START>]
|
||||||
|
r(1) NEXT:[r(2)] PREV:[r(try { 1 if (2 > 3) { retur..)]
|
||||||
r(2) NEXT:[r(3)] PREV:[r(1)]
|
r(2) NEXT:[r(3)] PREV:[r(1)]
|
||||||
r(3) NEXT:[r(>)] PREV:[r(2)]
|
r(3) NEXT:[r(>)] PREV:[r(2)]
|
||||||
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
||||||
@@ -41,13 +55,14 @@ l0:
|
|||||||
jf(l2) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
|
jf(l2) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
|
||||||
r(2) NEXT:[ret l1] PREV:[jf(l2)]
|
r(2) NEXT:[ret l1] PREV:[jf(l2)]
|
||||||
ret l1 NEXT:[<END>] PREV:[r(2)]
|
ret l1 NEXT:[<END>] PREV:[r(2)]
|
||||||
* jmp(l3) NEXT:[r(2)] PREV:[]
|
- jmp(l3) NEXT:[r(2)] PREV:[]
|
||||||
l2:
|
l2:
|
||||||
read (Unit) NEXT:[r(2)] PREV:[jf(l2)]
|
read (Unit) NEXT:[r(2)] PREV:[jf(l2)]
|
||||||
l3:
|
l3:
|
||||||
l4:
|
l4:
|
||||||
r(2) NEXT:[<END>] PREV:[read (Unit)]
|
r(2) NEXT:[<END>] PREV:[read (Unit)]
|
||||||
l1:
|
l1:
|
||||||
|
l5:
|
||||||
<END> NEXT:[<SINK>] PREV:[ret l1, r(2)]
|
<END> NEXT:[<SINK>] PREV:[ret l1, r(2)]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
@@ -62,14 +77,15 @@ sink:
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l3:
|
l3:
|
||||||
<START> NEXT:[r(2)] PREV:[]
|
<START> NEXT:[r(())] PREV:[]
|
||||||
r(2) NEXT:[r(3)] PREV:[<START>]
|
r(()) NEXT:[r(2)] PREV:[<START>]
|
||||||
|
r(2) NEXT:[r(3)] PREV:[r(())]
|
||||||
r(3) NEXT:[r(>)] PREV:[r(2)]
|
r(3) NEXT:[r(>)] PREV:[r(2)]
|
||||||
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
||||||
r(2 > 3) NEXT:[jf(l5)] PREV:[r(>)]
|
r(2 > 3) NEXT:[jf(l5)] PREV:[r(>)]
|
||||||
jf(l5) NEXT:[read (Unit), ret l4] PREV:[r(2 > 3)]
|
jf(l5) NEXT:[read (Unit), ret l4] PREV:[r(2 > 3)]
|
||||||
ret l4 NEXT:[<END>] PREV:[jf(l5)]
|
ret l4 NEXT:[<END>] PREV:[jf(l5)]
|
||||||
* jmp(l6) NEXT:[<END>] PREV:[]
|
- jmp(l6) NEXT:[<END>] PREV:[]
|
||||||
l5:
|
l5:
|
||||||
read (Unit) NEXT:[<END>] PREV:[jf(l5)]
|
read (Unit) NEXT:[<END>] PREV:[jf(l5)]
|
||||||
l4:
|
l4:
|
||||||
@@ -95,8 +111,18 @@ fun t3() {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[r(1)] PREV:[]
|
<START> NEXT:[r(try { 1 @{ () => if (2 > 3..)] PREV:[]
|
||||||
r(1) NEXT:[jmp?(l2)] PREV:[<START>]
|
r(try {
|
||||||
|
1
|
||||||
|
@{ () =>
|
||||||
|
if (2 > 3) {
|
||||||
|
return@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
2
|
||||||
|
}) NEXT:[r(1)] PREV:[<START>]
|
||||||
|
r(1) NEXT:[jmp?(l2)] PREV:[r(try { 1 @{ () => if (2 > 3..)]
|
||||||
jmp?(l2) NEXT:[r({ () => if (2 > 3) { retur..), d({ () => if (2 > 3) { retur..)] PREV:[r(1)]
|
jmp?(l2) NEXT:[r({ () => if (2 > 3) { retur..), d({ () => if (2 > 3) { retur..)] PREV:[r(1)]
|
||||||
d({ () =>
|
d({ () =>
|
||||||
if (2 > 3) {
|
if (2 > 3) {
|
||||||
@@ -112,20 +138,22 @@ l2:
|
|||||||
l7:
|
l7:
|
||||||
r(2) NEXT:[<END>] PREV:[r({ () => if (2 > 3) { retur..)]
|
r(2) NEXT:[<END>] PREV:[r({ () => if (2 > 3) { retur..)]
|
||||||
l1:
|
l1:
|
||||||
|
l8:
|
||||||
<END> NEXT:[<SINK>] PREV:[r(2)]
|
<END> NEXT:[<SINK>] PREV:[r(2)]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
sink:
|
sink:
|
||||||
<SINK> NEXT:[] PREV:[d({ () => if (2 > 3) { retur..), <END>]
|
<SINK> NEXT:[] PREV:[d({ () => if (2 > 3) { retur..), <END>]
|
||||||
l3:
|
l3:
|
||||||
<START> NEXT:[r(2)] PREV:[]
|
<START> NEXT:[r(())] PREV:[]
|
||||||
r(2) NEXT:[r(3)] PREV:[<START>]
|
r(()) NEXT:[r(2)] PREV:[<START>]
|
||||||
|
r(2) NEXT:[r(3)] PREV:[r(())]
|
||||||
r(3) NEXT:[r(>)] PREV:[r(2)]
|
r(3) NEXT:[r(>)] PREV:[r(2)]
|
||||||
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
||||||
r(2 > 3) NEXT:[jf(l5)] PREV:[r(>)]
|
r(2 > 3) NEXT:[jf(l5)] PREV:[r(>)]
|
||||||
jf(l5) NEXT:[read (Unit), ret l4] PREV:[r(2 > 3)]
|
jf(l5) NEXT:[read (Unit), ret l4] PREV:[r(2 > 3)]
|
||||||
ret l4 NEXT:[<END>] PREV:[jf(l5)]
|
ret l4 NEXT:[<END>] PREV:[jf(l5)]
|
||||||
* jmp(l6) NEXT:[<END>] PREV:[]
|
- jmp(l6) NEXT:[<END>] PREV:[]
|
||||||
l5:
|
l5:
|
||||||
read (Unit) NEXT:[<END>] PREV:[jf(l5)]
|
read (Unit) NEXT:[<END>] PREV:[jf(l5)]
|
||||||
l4:
|
l4:
|
||||||
@@ -149,8 +177,17 @@ sink:
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l3:
|
l3:
|
||||||
<START> NEXT:[r(1)] PREV:[]
|
<START> NEXT:[r(())] PREV:[]
|
||||||
r(1) NEXT:[r(2)] PREV:[<START>]
|
r(()) NEXT:[r(try { 1 if (2 > 3) { retur..)] PREV:[<START>]
|
||||||
|
r(try {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
return@
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
2
|
||||||
|
}) NEXT:[r(1)] PREV:[r(())]
|
||||||
|
r(1) NEXT:[r(2)] PREV:[r(try { 1 if (2 > 3) { retur..)]
|
||||||
r(2) NEXT:[r(3)] PREV:[r(1)]
|
r(2) NEXT:[r(3)] PREV:[r(1)]
|
||||||
r(3) NEXT:[r(>)] PREV:[r(2)]
|
r(3) NEXT:[r(>)] PREV:[r(2)]
|
||||||
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
||||||
@@ -158,13 +195,14 @@ l3:
|
|||||||
jf(l5) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
|
jf(l5) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
|
||||||
r(2) NEXT:[ret l4] PREV:[jf(l5)]
|
r(2) NEXT:[ret l4] PREV:[jf(l5)]
|
||||||
ret l4 NEXT:[<END>] PREV:[r(2)]
|
ret l4 NEXT:[<END>] PREV:[r(2)]
|
||||||
* jmp(l6) NEXT:[r(2)] PREV:[]
|
- jmp(l6) NEXT:[r(2)] PREV:[]
|
||||||
l5:
|
l5:
|
||||||
read (Unit) NEXT:[r(2)] PREV:[jf(l5)]
|
read (Unit) NEXT:[r(2)] PREV:[jf(l5)]
|
||||||
l6:
|
l6:
|
||||||
l7:
|
l7:
|
||||||
r(2) NEXT:[<END>] PREV:[read (Unit)]
|
r(2) NEXT:[<END>] PREV:[read (Unit)]
|
||||||
l4:
|
l4:
|
||||||
|
l8:
|
||||||
<END> NEXT:[<SINK>] PREV:[ret l4, r(2)]
|
<END> NEXT:[<SINK>] PREV:[ret l4, r(2)]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
@@ -216,8 +254,17 @@ error:
|
|||||||
sink:
|
sink:
|
||||||
<SINK> NEXT:[] PREV:[d({ () => try { 1 if (2 > 3)..), <END>]
|
<SINK> NEXT:[] PREV:[d({ () => try { 1 if (2 > 3)..), <END>]
|
||||||
l3:
|
l3:
|
||||||
<START> NEXT:[r(1)] PREV:[]
|
<START> NEXT:[r(())] PREV:[]
|
||||||
r(1) NEXT:[r(2)] PREV:[<START>]
|
r(()) NEXT:[r(try { 1 if (2 > 3) { retur..)] PREV:[<START>]
|
||||||
|
r(try {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
return@
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
2
|
||||||
|
}) NEXT:[r(1)] PREV:[r(())]
|
||||||
|
r(1) NEXT:[r(2)] PREV:[r(try { 1 if (2 > 3) { retur..)]
|
||||||
r(2) NEXT:[r(3)] PREV:[r(1)]
|
r(2) NEXT:[r(3)] PREV:[r(1)]
|
||||||
r(3) NEXT:[r(>)] PREV:[r(2)]
|
r(3) NEXT:[r(>)] PREV:[r(2)]
|
||||||
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
||||||
@@ -225,13 +272,14 @@ l3:
|
|||||||
jf(l5) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
|
jf(l5) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
|
||||||
r(2) NEXT:[ret l4] PREV:[jf(l5)]
|
r(2) NEXT:[ret l4] PREV:[jf(l5)]
|
||||||
ret l4 NEXT:[<END>] PREV:[r(2)]
|
ret l4 NEXT:[<END>] PREV:[r(2)]
|
||||||
* jmp(l6) NEXT:[r(2)] PREV:[]
|
- jmp(l6) NEXT:[r(2)] PREV:[]
|
||||||
l5:
|
l5:
|
||||||
read (Unit) NEXT:[r(2)] PREV:[jf(l5)]
|
read (Unit) NEXT:[r(2)] PREV:[jf(l5)]
|
||||||
l6:
|
l6:
|
||||||
l7:
|
l7:
|
||||||
r(2) NEXT:[<END>] PREV:[read (Unit)]
|
r(2) NEXT:[<END>] PREV:[read (Unit)]
|
||||||
l4:
|
l4:
|
||||||
|
l8:
|
||||||
<END> NEXT:[<SINK>] PREV:[ret l4, r(2)]
|
<END> NEXT:[<SINK>] PREV:[ret l4, r(2)]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
@@ -253,13 +301,31 @@ fun t5() {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[r(true)] PREV:[]
|
<START> NEXT:[r(while(true) { try { 1 if (..)] PREV:[]
|
||||||
|
r(while(true) {
|
||||||
|
try {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
break @
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
2
|
||||||
|
}
|
||||||
|
}) NEXT:[r(true)] PREV:[<START>]
|
||||||
l2:
|
l2:
|
||||||
l5:
|
l5:
|
||||||
r(true) NEXT:[jf(l3)] PREV:[<START>, jmp(l2)]
|
r(true) NEXT:[jf(l3)] PREV:[r(while(true) { try { 1 if (..), jmp(l2)]
|
||||||
jf(l3) NEXT:[read (Unit), r(1)] PREV:[r(true)]
|
jf(l3) NEXT:[read (Unit), r(try { 1 if (2 > 3) { break..)] PREV:[r(true)]
|
||||||
l4:
|
l4:
|
||||||
r(1) NEXT:[r(2)] PREV:[jf(l3)]
|
r(try {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
break @
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
2
|
||||||
|
}) NEXT:[r(1)] PREV:[jf(l3)]
|
||||||
|
r(1) NEXT:[r(2)] PREV:[r(try { 1 if (2 > 3) { break..)]
|
||||||
r(2) NEXT:[r(3)] PREV:[r(1)]
|
r(2) NEXT:[r(3)] PREV:[r(1)]
|
||||||
r(3) NEXT:[r(>)] PREV:[r(2)]
|
r(3) NEXT:[r(>)] PREV:[r(2)]
|
||||||
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
||||||
@@ -267,12 +333,13 @@ l4:
|
|||||||
jf(l6) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
|
jf(l6) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
|
||||||
r(2) NEXT:[jmp(l3)] PREV:[jf(l6)]
|
r(2) NEXT:[jmp(l3)] PREV:[jf(l6)]
|
||||||
jmp(l3) NEXT:[read (Unit)] PREV:[r(2)]
|
jmp(l3) NEXT:[read (Unit)] PREV:[r(2)]
|
||||||
* jmp(l7) NEXT:[r(2)] PREV:[]
|
- jmp(l7) NEXT:[r(2)] PREV:[]
|
||||||
l6:
|
l6:
|
||||||
read (Unit) NEXT:[r(2)] PREV:[jf(l6)]
|
read (Unit) NEXT:[r(2)] PREV:[jf(l6)]
|
||||||
l7:
|
l7:
|
||||||
l8:
|
l8:
|
||||||
r(2) NEXT:[jmp(l2)] PREV:[read (Unit)]
|
r(2) NEXT:[jmp(l2)] PREV:[read (Unit)]
|
||||||
|
l9:
|
||||||
jmp(l2) NEXT:[r(true)] PREV:[r(2)]
|
jmp(l2) NEXT:[r(true)] PREV:[r(2)]
|
||||||
l3:
|
l3:
|
||||||
read (Unit) NEXT:[<END>] PREV:[jf(l3), jmp(l3)]
|
read (Unit) NEXT:[<END>] PREV:[jf(l3), jmp(l3)]
|
||||||
@@ -299,10 +366,27 @@ fun t6() {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[r(true)] PREV:[]
|
<START> NEXT:[r(try { @ while(true) { 1 if..)] PREV:[]
|
||||||
|
r(try {
|
||||||
|
@ while(true) {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
break @
|
||||||
|
}
|
||||||
|
}
|
||||||
|
5
|
||||||
|
} finally {
|
||||||
|
2
|
||||||
|
}) NEXT:[r(while(true) { 1 if (2 > 3)..)] PREV:[<START>]
|
||||||
|
r(while(true) {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
break @
|
||||||
|
}
|
||||||
|
}) NEXT:[r(true)] PREV:[r(try { @ while(true) { 1 if..)]
|
||||||
l2:
|
l2:
|
||||||
l5:
|
l5:
|
||||||
r(true) NEXT:[jf(l3)] PREV:[<START>, jmp(l2)]
|
r(true) NEXT:[jf(l3)] PREV:[r(while(true) { 1 if (2 > 3)..), jmp(l2)]
|
||||||
jf(l3) NEXT:[read (Unit), r(1)] PREV:[r(true)]
|
jf(l3) NEXT:[read (Unit), r(1)] PREV:[r(true)]
|
||||||
l4:
|
l4:
|
||||||
r(1) NEXT:[r(2)] PREV:[jf(l3)]
|
r(1) NEXT:[r(2)] PREV:[jf(l3)]
|
||||||
@@ -312,7 +396,7 @@ l4:
|
|||||||
r(2 > 3) NEXT:[jf(l6)] PREV:[r(>)]
|
r(2 > 3) NEXT:[jf(l6)] PREV:[r(>)]
|
||||||
jf(l6) NEXT:[read (Unit), jmp(l3)] PREV:[r(2 > 3)]
|
jf(l6) NEXT:[read (Unit), jmp(l3)] PREV:[r(2 > 3)]
|
||||||
jmp(l3) NEXT:[read (Unit)] PREV:[jf(l6)]
|
jmp(l3) NEXT:[read (Unit)] PREV:[jf(l6)]
|
||||||
* jmp(l7) NEXT:[jmp(l2)] PREV:[]
|
- jmp(l7) NEXT:[jmp(l2)] PREV:[]
|
||||||
l6:
|
l6:
|
||||||
read (Unit) NEXT:[jmp(l2)] PREV:[jf(l6)]
|
read (Unit) NEXT:[jmp(l2)] PREV:[jf(l6)]
|
||||||
l7:
|
l7:
|
||||||
@@ -323,6 +407,7 @@ l3:
|
|||||||
l8:
|
l8:
|
||||||
r(2) NEXT:[<END>] PREV:[r(5)]
|
r(2) NEXT:[<END>] PREV:[r(5)]
|
||||||
l1:
|
l1:
|
||||||
|
l9:
|
||||||
<END> NEXT:[<SINK>] PREV:[r(2)]
|
<END> NEXT:[<SINK>] PREV:[r(2)]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
@@ -344,10 +429,26 @@ fun t7() {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[r(true)] PREV:[]
|
<START> NEXT:[r(try { @ while(true) { 1 if..)] PREV:[]
|
||||||
|
r(try {
|
||||||
|
@ while(true) {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
break @
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
2
|
||||||
|
}) NEXT:[r(while(true) { 1 if (2 > 3)..)] PREV:[<START>]
|
||||||
|
r(while(true) {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
break @
|
||||||
|
}
|
||||||
|
}) NEXT:[r(true)] PREV:[r(try { @ while(true) { 1 if..)]
|
||||||
l2:
|
l2:
|
||||||
l5:
|
l5:
|
||||||
r(true) NEXT:[jf(l3)] PREV:[<START>, jmp(l2)]
|
r(true) NEXT:[jf(l3)] PREV:[r(while(true) { 1 if (2 > 3)..), jmp(l2)]
|
||||||
jf(l3) NEXT:[read (Unit), r(1)] PREV:[r(true)]
|
jf(l3) NEXT:[read (Unit), r(1)] PREV:[r(true)]
|
||||||
l4:
|
l4:
|
||||||
r(1) NEXT:[r(2)] PREV:[jf(l3)]
|
r(1) NEXT:[r(2)] PREV:[jf(l3)]
|
||||||
@@ -357,7 +458,7 @@ l4:
|
|||||||
r(2 > 3) NEXT:[jf(l6)] PREV:[r(>)]
|
r(2 > 3) NEXT:[jf(l6)] PREV:[r(>)]
|
||||||
jf(l6) NEXT:[read (Unit), jmp(l3)] PREV:[r(2 > 3)]
|
jf(l6) NEXT:[read (Unit), jmp(l3)] PREV:[r(2 > 3)]
|
||||||
jmp(l3) NEXT:[read (Unit)] PREV:[jf(l6)]
|
jmp(l3) NEXT:[read (Unit)] PREV:[jf(l6)]
|
||||||
* jmp(l7) NEXT:[jmp(l2)] PREV:[]
|
- jmp(l7) NEXT:[jmp(l2)] PREV:[]
|
||||||
l6:
|
l6:
|
||||||
read (Unit) NEXT:[jmp(l2)] PREV:[jf(l6)]
|
read (Unit) NEXT:[jmp(l2)] PREV:[jf(l6)]
|
||||||
l7:
|
l7:
|
||||||
@@ -367,6 +468,7 @@ l3:
|
|||||||
l8:
|
l8:
|
||||||
r(2) NEXT:[<END>] PREV:[read (Unit)]
|
r(2) NEXT:[<END>] PREV:[read (Unit)]
|
||||||
l1:
|
l1:
|
||||||
|
l9:
|
||||||
<END> NEXT:[<SINK>] PREV:[r(2)]
|
<END> NEXT:[<SINK>] PREV:[r(2)]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
@@ -390,32 +492,51 @@ fun t8(a : Int) {
|
|||||||
l0:
|
l0:
|
||||||
<START> NEXT:[v(a : Int)] PREV:[]
|
<START> NEXT:[v(a : Int)] PREV:[]
|
||||||
v(a : Int) NEXT:[w(a)] PREV:[<START>]
|
v(a : Int) NEXT:[w(a)] PREV:[<START>]
|
||||||
w(a) NEXT:[r(1)] PREV:[v(a : Int)]
|
w(a) NEXT:[r(for (i in 1..a) { try { 1 ..)] PREV:[v(a : Int)]
|
||||||
r(1) NEXT:[r(a)] PREV:[w(a)]
|
r(for (i in 1..a) {
|
||||||
|
try {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
continue @
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
2
|
||||||
|
}
|
||||||
|
}) NEXT:[r(1)] PREV:[w(a)]
|
||||||
|
r(1) NEXT:[r(a)] PREV:[r(for (i in 1..a) { try { 1 ..)]
|
||||||
r(a) NEXT:[r(..)] PREV:[r(1)]
|
r(a) NEXT:[r(..)] PREV:[r(1)]
|
||||||
r(..) NEXT:[r(1..a)] PREV:[r(a)]
|
r(..) NEXT:[r(1..a)] PREV:[r(a)]
|
||||||
r(1..a) NEXT:[v(i)] PREV:[r(..)]
|
r(1..a) NEXT:[v(i)] PREV:[r(..)]
|
||||||
v(i) NEXT:[w(i)] PREV:[r(1..a)]
|
v(i) NEXT:[w(i)] PREV:[r(1..a)]
|
||||||
w(i) NEXT:[jmp?(l2)] PREV:[v(i)]
|
w(i) NEXT:[jmp?(l2)] PREV:[v(i)]
|
||||||
l3:
|
l3:
|
||||||
jmp?(l2) NEXT:[read (Unit), r(1)] PREV:[w(i)]
|
jmp?(l2) NEXT:[read (Unit), r(try { 1 if (2 > 3) { conti..)] PREV:[w(i)]
|
||||||
l4:
|
l4:
|
||||||
l5:
|
l5:
|
||||||
r(1) NEXT:[r(2)] PREV:[jmp?(l2), jmp(l4), jmp?(l4)]
|
r(try {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
continue @
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
2
|
||||||
|
}) NEXT:[r(1)] PREV:[jmp?(l2), jmp(l4), jmp?(l4)]
|
||||||
|
r(1) NEXT:[r(2)] PREV:[r(try { 1 if (2 > 3) { conti..)]
|
||||||
r(2) NEXT:[r(3)] PREV:[r(1)]
|
r(2) NEXT:[r(3)] PREV:[r(1)]
|
||||||
r(3) NEXT:[r(>)] PREV:[r(2)]
|
r(3) NEXT:[r(>)] PREV:[r(2)]
|
||||||
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
r(>) NEXT:[r(2 > 3)] PREV:[r(3)]
|
||||||
r(2 > 3) NEXT:[jf(l6)] PREV:[r(>)]
|
r(2 > 3) NEXT:[jf(l6)] PREV:[r(>)]
|
||||||
jf(l6) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
|
jf(l6) NEXT:[read (Unit), r(2)] PREV:[r(2 > 3)]
|
||||||
r(2) NEXT:[jmp(l4)] PREV:[jf(l6)]
|
r(2) NEXT:[jmp(l4)] PREV:[jf(l6)]
|
||||||
jmp(l4) NEXT:[r(1)] PREV:[r(2)]
|
jmp(l4) NEXT:[r(try { 1 if (2 > 3) { conti..)] PREV:[r(2)]
|
||||||
* jmp(l7) NEXT:[r(2)] PREV:[]
|
- jmp(l7) NEXT:[r(2)] PREV:[]
|
||||||
l6:
|
l6:
|
||||||
read (Unit) NEXT:[r(2)] PREV:[jf(l6)]
|
read (Unit) NEXT:[r(2)] PREV:[jf(l6)]
|
||||||
l7:
|
l7:
|
||||||
l8:
|
l8:
|
||||||
r(2) NEXT:[jmp?(l4)] PREV:[read (Unit)]
|
r(2) NEXT:[jmp?(l4)] PREV:[read (Unit)]
|
||||||
jmp?(l4) NEXT:[r(1), read (Unit)] PREV:[r(2)]
|
l9:
|
||||||
|
jmp?(l4) NEXT:[r(try { 1 if (2 > 3) { conti..), read (Unit)] PREV:[r(2)]
|
||||||
l2:
|
l2:
|
||||||
read (Unit) NEXT:[<END>] PREV:[jmp?(l2), jmp?(l4)]
|
read (Unit) NEXT:[<END>] PREV:[jmp?(l2), jmp?(l4)]
|
||||||
l1:
|
l1:
|
||||||
@@ -443,8 +564,25 @@ fun t9(a : Int) {
|
|||||||
l0:
|
l0:
|
||||||
<START> NEXT:[v(a : Int)] PREV:[]
|
<START> NEXT:[v(a : Int)] PREV:[]
|
||||||
v(a : Int) NEXT:[w(a)] PREV:[<START>]
|
v(a : Int) NEXT:[w(a)] PREV:[<START>]
|
||||||
w(a) NEXT:[r(1)] PREV:[v(a : Int)]
|
w(a) NEXT:[r(try { @ for (i in 1..a) { ..)] PREV:[v(a : Int)]
|
||||||
r(1) NEXT:[r(a)] PREV:[w(a)]
|
r(try {
|
||||||
|
@ for (i in 1..a) {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
continue @
|
||||||
|
}
|
||||||
|
}
|
||||||
|
5
|
||||||
|
} finally {
|
||||||
|
2
|
||||||
|
}) NEXT:[r(for (i in 1..a) { 1 if (2 ..)] PREV:[w(a)]
|
||||||
|
r(for (i in 1..a) {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
continue @
|
||||||
|
}
|
||||||
|
}) NEXT:[r(1)] PREV:[r(try { @ for (i in 1..a) { ..)]
|
||||||
|
r(1) NEXT:[r(a)] PREV:[r(for (i in 1..a) { 1 if (2 ..)]
|
||||||
r(a) NEXT:[r(..)] PREV:[r(1)]
|
r(a) NEXT:[r(..)] PREV:[r(1)]
|
||||||
r(..) NEXT:[r(1..a)] PREV:[r(a)]
|
r(..) NEXT:[r(1..a)] PREV:[r(a)]
|
||||||
r(1..a) NEXT:[v(i)] PREV:[r(..)]
|
r(1..a) NEXT:[v(i)] PREV:[r(..)]
|
||||||
@@ -461,7 +599,7 @@ l5:
|
|||||||
r(2 > 3) NEXT:[jf(l6)] PREV:[r(>)]
|
r(2 > 3) NEXT:[jf(l6)] PREV:[r(>)]
|
||||||
jf(l6) NEXT:[read (Unit), jmp(l4)] PREV:[r(2 > 3)]
|
jf(l6) NEXT:[read (Unit), jmp(l4)] PREV:[r(2 > 3)]
|
||||||
jmp(l4) NEXT:[r(1)] PREV:[jf(l6)]
|
jmp(l4) NEXT:[r(1)] PREV:[jf(l6)]
|
||||||
* jmp(l7) NEXT:[jmp?(l4)] PREV:[]
|
- jmp(l7) NEXT:[jmp?(l4)] PREV:[]
|
||||||
l6:
|
l6:
|
||||||
read (Unit) NEXT:[jmp?(l4)] PREV:[jf(l6)]
|
read (Unit) NEXT:[jmp?(l4)] PREV:[jf(l6)]
|
||||||
l7:
|
l7:
|
||||||
@@ -472,6 +610,7 @@ l2:
|
|||||||
l8:
|
l8:
|
||||||
r(2) NEXT:[<END>] PREV:[r(5)]
|
r(2) NEXT:[<END>] PREV:[r(5)]
|
||||||
l1:
|
l1:
|
||||||
|
l9:
|
||||||
<END> NEXT:[<SINK>] PREV:[r(2)]
|
<END> NEXT:[<SINK>] PREV:[r(2)]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
@@ -495,8 +634,24 @@ fun t10(a : Int) {
|
|||||||
l0:
|
l0:
|
||||||
<START> NEXT:[v(a : Int)] PREV:[]
|
<START> NEXT:[v(a : Int)] PREV:[]
|
||||||
v(a : Int) NEXT:[w(a)] PREV:[<START>]
|
v(a : Int) NEXT:[w(a)] PREV:[<START>]
|
||||||
w(a) NEXT:[r(1)] PREV:[v(a : Int)]
|
w(a) NEXT:[r(try { @ for (i in 1..a) { ..)] PREV:[v(a : Int)]
|
||||||
r(1) NEXT:[r(a)] PREV:[w(a)]
|
r(try {
|
||||||
|
@ for (i in 1..a) {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
continue @
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
2
|
||||||
|
}) NEXT:[r(for (i in 1..a) { 1 if (2 ..)] PREV:[w(a)]
|
||||||
|
r(for (i in 1..a) {
|
||||||
|
1
|
||||||
|
if (2 > 3) {
|
||||||
|
continue @
|
||||||
|
}
|
||||||
|
}) NEXT:[r(1)] PREV:[r(try { @ for (i in 1..a) { ..)]
|
||||||
|
r(1) NEXT:[r(a)] PREV:[r(for (i in 1..a) { 1 if (2 ..)]
|
||||||
r(a) NEXT:[r(..)] PREV:[r(1)]
|
r(a) NEXT:[r(..)] PREV:[r(1)]
|
||||||
r(..) NEXT:[r(1..a)] PREV:[r(a)]
|
r(..) NEXT:[r(1..a)] PREV:[r(a)]
|
||||||
r(1..a) NEXT:[v(i)] PREV:[r(..)]
|
r(1..a) NEXT:[v(i)] PREV:[r(..)]
|
||||||
@@ -513,7 +668,7 @@ l5:
|
|||||||
r(2 > 3) NEXT:[jf(l6)] PREV:[r(>)]
|
r(2 > 3) NEXT:[jf(l6)] PREV:[r(>)]
|
||||||
jf(l6) NEXT:[read (Unit), jmp(l4)] PREV:[r(2 > 3)]
|
jf(l6) NEXT:[read (Unit), jmp(l4)] PREV:[r(2 > 3)]
|
||||||
jmp(l4) NEXT:[r(1)] PREV:[jf(l6)]
|
jmp(l4) NEXT:[r(1)] PREV:[jf(l6)]
|
||||||
* jmp(l7) NEXT:[jmp?(l4)] PREV:[]
|
- jmp(l7) NEXT:[jmp?(l4)] PREV:[]
|
||||||
l6:
|
l6:
|
||||||
read (Unit) NEXT:[jmp?(l4)] PREV:[jf(l6)]
|
read (Unit) NEXT:[jmp?(l4)] PREV:[jf(l6)]
|
||||||
l7:
|
l7:
|
||||||
@@ -523,6 +678,7 @@ l2:
|
|||||||
l8:
|
l8:
|
||||||
r(2) NEXT:[<END>] PREV:[read (Unit)]
|
r(2) NEXT:[<END>] PREV:[read (Unit)]
|
||||||
l1:
|
l1:
|
||||||
|
l9:
|
||||||
<END> NEXT:[<SINK>] PREV:[r(2)]
|
<END> NEXT:[<SINK>] PREV:[r(2)]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
@@ -540,15 +696,22 @@ fun t11() {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[r(1)] PREV:[]
|
<START> NEXT:[r(try { return 1 } finally {..)] PREV:[]
|
||||||
r(1) NEXT:[r(2)] PREV:[<START>]
|
r(try {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
return 2
|
||||||
|
}) NEXT:[r(1)] PREV:[<START>]
|
||||||
|
r(1) NEXT:[r(2)] PREV:[r(try { return 1 } finally {..)]
|
||||||
r(2) NEXT:[ret(*) l1] PREV:[r(1)]
|
r(2) NEXT:[ret(*) l1] PREV:[r(1)]
|
||||||
ret(*) l1 NEXT:[<END>] PREV:[r(2)]
|
ret(*) l1 NEXT:[<END>] PREV:[r(2)]
|
||||||
* ret(*) l1 NEXT:[<END>] PREV:[]
|
- ret(*) l1 NEXT:[<END>] PREV:[]
|
||||||
l2:
|
l2:
|
||||||
R r(2) NEXT:[ret(*) l1] PREV:[]
|
- r(2) NEXT:[ret(*) l1] PREV:[]
|
||||||
R ret(*) l1 NEXT:[<END>] PREV:[]
|
- ret(*) l1 NEXT:[<END>] PREV:[]
|
||||||
l1:
|
l1:
|
||||||
|
l3:
|
||||||
<END> NEXT:[<SINK>] PREV:[ret(*) l1]
|
<END> NEXT:[<SINK>] PREV:[ret(*) l1]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
@@ -566,17 +729,24 @@ fun t12() : Int {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[r(1)] PREV:[]
|
<START> NEXT:[r(try { return 1 } finally {..)] PREV:[]
|
||||||
r(1) NEXT:[r(3)] PREV:[<START>]
|
r(try {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
doSmth(3)
|
||||||
|
}) NEXT:[r(1)] PREV:[<START>]
|
||||||
|
r(1) NEXT:[r(3)] PREV:[r(try { return 1 } finally {..)]
|
||||||
r(3) NEXT:[r(doSmth)] PREV:[r(1)]
|
r(3) NEXT:[r(doSmth)] PREV:[r(1)]
|
||||||
r(doSmth) NEXT:[r(doSmth(3))] PREV:[r(3)]
|
r(doSmth) NEXT:[r(doSmth(3))] PREV:[r(3)]
|
||||||
r(doSmth(3)) NEXT:[ret(*) l1] PREV:[r(doSmth)]
|
r(doSmth(3)) NEXT:[ret(*) l1] PREV:[r(doSmth)]
|
||||||
ret(*) l1 NEXT:[<END>] PREV:[r(doSmth(3))]
|
ret(*) l1 NEXT:[<END>] PREV:[r(doSmth(3))]
|
||||||
l2:
|
l2:
|
||||||
R r(3) NEXT:[r(doSmth)] PREV:[]
|
- r(3) NEXT:[r(doSmth)] PREV:[]
|
||||||
R r(doSmth) NEXT:[r(doSmth(3))] PREV:[]
|
- r(doSmth) NEXT:[r(doSmth(3))] PREV:[]
|
||||||
R r(doSmth(3)) NEXT:[<END>] PREV:[]
|
- r(doSmth(3)) NEXT:[<END>] PREV:[]
|
||||||
l1:
|
l1:
|
||||||
|
l3:
|
||||||
<END> NEXT:[<SINK>] PREV:[ret(*) l1]
|
<END> NEXT:[<SINK>] PREV:[ret(*) l1]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
@@ -597,15 +767,24 @@ fun t13() : Int {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[jmp?(l2)] PREV:[]
|
<START> NEXT:[r(try { return 1 } catch (e:..)] PREV:[]
|
||||||
jmp?(l2) NEXT:[jmp?(), r(1)] PREV:[<START>]
|
r(try {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
catch (e: UnsupportedOperationException) {
|
||||||
|
doSmth(2)
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
doSmth(3)
|
||||||
|
}) NEXT:[jmp?(l2)] PREV:[<START>]
|
||||||
|
jmp?(l2) NEXT:[jmp?(), r(1)] PREV:[r(try { return 1 } catch (e:..)]
|
||||||
r(1) NEXT:[r(3)] PREV:[jmp?(l2)]
|
r(1) NEXT:[r(3)] PREV:[jmp?(l2)]
|
||||||
r(3) NEXT:[r(doSmth)] PREV:[r(1)]
|
r(3) NEXT:[r(doSmth)] PREV:[r(1)]
|
||||||
r(doSmth) NEXT:[r(doSmth(3))] PREV:[r(3)]
|
r(doSmth) NEXT:[r(doSmth(3))] PREV:[r(3)]
|
||||||
r(doSmth(3)) NEXT:[ret(*) l1] PREV:[r(doSmth)]
|
r(doSmth(3)) NEXT:[ret(*) l1] PREV:[r(doSmth)]
|
||||||
ret(*) l1 NEXT:[<END>] PREV:[r(doSmth(3))]
|
ret(*) l1 NEXT:[<END>] PREV:[r(doSmth(3))]
|
||||||
l3:
|
l3:
|
||||||
R jmp(l4) NEXT:[r(3)] PREV:[]
|
- jmp(l4) NEXT:[r(3)] PREV:[]
|
||||||
l2:
|
l2:
|
||||||
jmp?() NEXT:[v(e: UnsupportedOperationException)] PREV:[jmp?(l2)]
|
jmp?() NEXT:[v(e: UnsupportedOperationException)] PREV:[jmp?(l2)]
|
||||||
v(e: UnsupportedOperationException) NEXT:[w(e)] PREV:[jmp?()]
|
v(e: UnsupportedOperationException) NEXT:[w(e)] PREV:[jmp?()]
|
||||||
@@ -620,6 +799,7 @@ l4:
|
|||||||
r(doSmth) NEXT:[r(doSmth(3))] PREV:[r(3)]
|
r(doSmth) NEXT:[r(doSmth(3))] PREV:[r(3)]
|
||||||
r(doSmth(3)) NEXT:[<END>] PREV:[r(doSmth)]
|
r(doSmth(3)) NEXT:[<END>] PREV:[r(doSmth)]
|
||||||
l1:
|
l1:
|
||||||
|
l6:
|
||||||
<END> NEXT:[<SINK>] PREV:[ret(*) l1, r(doSmth(3))]
|
<END> NEXT:[<SINK>] PREV:[ret(*) l1, r(doSmth(3))]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
@@ -637,12 +817,18 @@ fun t14() : Int {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[jmp?(l2)] PREV:[]
|
<START> NEXT:[r(try { return 1 } catch (e:..)] PREV:[]
|
||||||
jmp?(l2) NEXT:[jmp?(), r(1)] PREV:[<START>]
|
r(try {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
catch (e: UnsupportedOperationException) {
|
||||||
|
doSmth(2)
|
||||||
|
}) NEXT:[jmp?(l2)] PREV:[<START>]
|
||||||
|
jmp?(l2) NEXT:[jmp?(), r(1)] PREV:[r(try { return 1 } catch (e:..)]
|
||||||
r(1) NEXT:[ret(*) l1] PREV:[jmp?(l2)]
|
r(1) NEXT:[ret(*) l1] PREV:[jmp?(l2)]
|
||||||
ret(*) l1 NEXT:[<END>] PREV:[r(1)]
|
ret(*) l1 NEXT:[<END>] PREV:[r(1)]
|
||||||
l3:
|
l3:
|
||||||
R jmp(l4) NEXT:[<END>] PREV:[]
|
- jmp(l4) NEXT:[<END>] PREV:[]
|
||||||
l2:
|
l2:
|
||||||
jmp?() NEXT:[v(e: UnsupportedOperationException)] PREV:[jmp?(l2)]
|
jmp?() NEXT:[v(e: UnsupportedOperationException)] PREV:[jmp?(l2)]
|
||||||
v(e: UnsupportedOperationException) NEXT:[w(e)] PREV:[jmp?()]
|
v(e: UnsupportedOperationException) NEXT:[w(e)] PREV:[jmp?()]
|
||||||
@@ -654,6 +840,7 @@ l5:
|
|||||||
jmp(l4) NEXT:[<END>] PREV:[r(doSmth(2))]
|
jmp(l4) NEXT:[<END>] PREV:[r(doSmth(2))]
|
||||||
l1:
|
l1:
|
||||||
l4:
|
l4:
|
||||||
|
l6:
|
||||||
<END> NEXT:[<SINK>] PREV:[ret(*) l1, jmp(l4)]
|
<END> NEXT:[<SINK>] PREV:[ret(*) l1, jmp(l4)]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
@@ -674,15 +861,24 @@ fun t15() : Int {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[jmp?(l2)] PREV:[]
|
<START> NEXT:[r(try { return 1 } catch (e:..)] PREV:[]
|
||||||
jmp?(l2) NEXT:[jmp?(), r(1)] PREV:[<START>]
|
r(try {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
catch (e: UnsupportedOperationException) {
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
doSmth(3)
|
||||||
|
}) NEXT:[jmp?(l2)] PREV:[<START>]
|
||||||
|
jmp?(l2) NEXT:[jmp?(), r(1)] PREV:[r(try { return 1 } catch (e:..)]
|
||||||
r(1) NEXT:[r(3)] PREV:[jmp?(l2)]
|
r(1) NEXT:[r(3)] PREV:[jmp?(l2)]
|
||||||
r(3) NEXT:[r(doSmth)] PREV:[r(1)]
|
r(3) NEXT:[r(doSmth)] PREV:[r(1)]
|
||||||
r(doSmth) NEXT:[r(doSmth(3))] PREV:[r(3)]
|
r(doSmth) NEXT:[r(doSmth(3))] PREV:[r(3)]
|
||||||
r(doSmth(3)) NEXT:[ret(*) l1] PREV:[r(doSmth)]
|
r(doSmth(3)) NEXT:[ret(*) l1] PREV:[r(doSmth)]
|
||||||
ret(*) l1 NEXT:[<END>] PREV:[r(doSmth(3))]
|
ret(*) l1 NEXT:[<END>] PREV:[r(doSmth(3))]
|
||||||
l3:
|
l3:
|
||||||
R jmp(l4) NEXT:[r(3)] PREV:[]
|
- jmp(l4) NEXT:[r(3)] PREV:[]
|
||||||
l2:
|
l2:
|
||||||
jmp?() NEXT:[v(e: UnsupportedOperationException)] PREV:[jmp?(l2)]
|
jmp?() NEXT:[v(e: UnsupportedOperationException)] PREV:[jmp?(l2)]
|
||||||
v(e: UnsupportedOperationException) NEXT:[w(e)] PREV:[jmp?()]
|
v(e: UnsupportedOperationException) NEXT:[w(e)] PREV:[jmp?()]
|
||||||
@@ -693,12 +889,13 @@ l2:
|
|||||||
r(doSmth(3)) NEXT:[ret(*) l1] PREV:[r(doSmth)]
|
r(doSmth(3)) NEXT:[ret(*) l1] PREV:[r(doSmth)]
|
||||||
ret(*) l1 NEXT:[<END>] PREV:[r(doSmth(3))]
|
ret(*) l1 NEXT:[<END>] PREV:[r(doSmth(3))]
|
||||||
l5:
|
l5:
|
||||||
R jmp(l4) NEXT:[r(3)] PREV:[]
|
- jmp(l4) NEXT:[r(3)] PREV:[]
|
||||||
l4:
|
l4:
|
||||||
R r(3) NEXT:[r(doSmth)] PREV:[]
|
- r(3) NEXT:[r(doSmth)] PREV:[]
|
||||||
R r(doSmth) NEXT:[r(doSmth(3))] PREV:[]
|
- r(doSmth) NEXT:[r(doSmth(3))] PREV:[]
|
||||||
R r(doSmth(3)) NEXT:[<END>] PREV:[]
|
- r(doSmth(3)) NEXT:[<END>] PREV:[]
|
||||||
l1:
|
l1:
|
||||||
|
l6:
|
||||||
<END> NEXT:[<SINK>] PREV:[ret(*) l1, ret(*) l1]
|
<END> NEXT:[<SINK>] PREV:[ret(*) l1, ret(*) l1]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
@@ -719,8 +916,17 @@ fun t16() : Int {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[jmp?(l2)] PREV:[]
|
<START> NEXT:[r(try { doSmth(1) } catch (e..)] PREV:[]
|
||||||
jmp?(l2) NEXT:[jmp?(), r(1)] PREV:[<START>]
|
r(try {
|
||||||
|
doSmth(1)
|
||||||
|
}
|
||||||
|
catch (e: UnsupportedOperationException) {
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
doSmth(3)
|
||||||
|
}) NEXT:[jmp?(l2)] PREV:[<START>]
|
||||||
|
jmp?(l2) NEXT:[jmp?(), r(1)] PREV:[r(try { doSmth(1) } catch (e..)]
|
||||||
r(1) NEXT:[r(doSmth)] PREV:[jmp?(l2)]
|
r(1) NEXT:[r(doSmth)] PREV:[jmp?(l2)]
|
||||||
r(doSmth) NEXT:[r(doSmth(1))] PREV:[r(1)]
|
r(doSmth) NEXT:[r(doSmth(1))] PREV:[r(1)]
|
||||||
r(doSmth(1)) NEXT:[jmp(l4)] PREV:[r(doSmth)]
|
r(doSmth(1)) NEXT:[jmp(l4)] PREV:[r(doSmth)]
|
||||||
@@ -736,12 +942,13 @@ l2:
|
|||||||
r(doSmth(3)) NEXT:[ret(*) l1] PREV:[r(doSmth)]
|
r(doSmth(3)) NEXT:[ret(*) l1] PREV:[r(doSmth)]
|
||||||
ret(*) l1 NEXT:[<END>] PREV:[r(doSmth(3))]
|
ret(*) l1 NEXT:[<END>] PREV:[r(doSmth(3))]
|
||||||
l5:
|
l5:
|
||||||
R jmp(l4) NEXT:[r(3)] PREV:[]
|
- jmp(l4) NEXT:[r(3)] PREV:[]
|
||||||
l4:
|
l4:
|
||||||
r(3) NEXT:[r(doSmth)] PREV:[jmp(l4)]
|
r(3) NEXT:[r(doSmth)] PREV:[jmp(l4)]
|
||||||
r(doSmth) NEXT:[r(doSmth(3))] PREV:[r(3)]
|
r(doSmth) NEXT:[r(doSmth(3))] PREV:[r(3)]
|
||||||
r(doSmth(3)) NEXT:[<END>] PREV:[r(doSmth)]
|
r(doSmth(3)) NEXT:[<END>] PREV:[r(doSmth)]
|
||||||
l1:
|
l1:
|
||||||
|
l6:
|
||||||
<END> NEXT:[<SINK>] PREV:[ret(*) l1, r(doSmth(3))]
|
<END> NEXT:[<SINK>] PREV:[ret(*) l1, r(doSmth(3))]
|
||||||
error:
|
error:
|
||||||
<ERROR> NEXT:[] PREV:[]
|
<ERROR> NEXT:[] PREV:[]
|
||||||
|
|||||||
@@ -6,8 +6,11 @@ fun t1() {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[r(1)] PREV:[]
|
<START> NEXT:[r(for (i in 1..2) { doSmth(i..)] PREV:[]
|
||||||
r(1) NEXT:[r(2)] PREV:[<START>]
|
r(for (i in 1..2) {
|
||||||
|
doSmth(i)
|
||||||
|
}) NEXT:[r(1)] PREV:[<START>]
|
||||||
|
r(1) NEXT:[r(2)] PREV:[r(for (i in 1..2) { doSmth(i..)]
|
||||||
r(2) NEXT:[r(..)] PREV:[r(1)]
|
r(2) NEXT:[r(..)] PREV:[r(1)]
|
||||||
r(..) NEXT:[r(1..2)] PREV:[r(2)]
|
r(..) NEXT:[r(1..2)] PREV:[r(2)]
|
||||||
r(1..2) NEXT:[v(i)] PREV:[r(..)]
|
r(1..2) NEXT:[v(i)] PREV:[r(..)]
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ l0:
|
|||||||
r(b) NEXT:[jf(l2)] PREV:[w(i)]
|
r(b) NEXT:[jf(l2)] PREV:[w(i)]
|
||||||
jf(l2) NEXT:[read (Unit), ret l1] PREV:[r(b)]
|
jf(l2) NEXT:[read (Unit), ret l1] PREV:[r(b)]
|
||||||
ret l1 NEXT:[<END>] PREV:[jf(l2)]
|
ret l1 NEXT:[<END>] PREV:[jf(l2)]
|
||||||
* jmp(l3) NEXT:[r(i)] PREV:[]
|
- jmp(l3) NEXT:[r(i)] PREV:[]
|
||||||
l2:
|
l2:
|
||||||
read (Unit) NEXT:[r(i)] PREV:[jf(l2)]
|
read (Unit) NEXT:[r(i)] PREV:[jf(l2)]
|
||||||
l3:
|
l3:
|
||||||
@@ -85,7 +85,7 @@ l3:
|
|||||||
r(i is Int) NEXT:[jf(l4)] PREV:[r(i)]
|
r(i is Int) NEXT:[jf(l4)] PREV:[r(i)]
|
||||||
jf(l4) NEXT:[read (Unit), ret l1] PREV:[r(i is Int)]
|
jf(l4) NEXT:[read (Unit), ret l1] PREV:[r(i is Int)]
|
||||||
ret l1 NEXT:[<END>] PREV:[jf(l4)]
|
ret l1 NEXT:[<END>] PREV:[jf(l4)]
|
||||||
* jmp(l5) NEXT:[<END>] PREV:[]
|
- jmp(l5) NEXT:[<END>] PREV:[]
|
||||||
l4:
|
l4:
|
||||||
read (Unit) NEXT:[<END>] PREV:[jf(l4)]
|
read (Unit) NEXT:[<END>] PREV:[jf(l4)]
|
||||||
l1:
|
l1:
|
||||||
|
|||||||
@@ -6,10 +6,13 @@ fun main() {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[r(1)] PREV:[]
|
<START> NEXT:[r(while(1 > 0) { 2 }) ] PREV:[]
|
||||||
|
r(while(1 > 0) {
|
||||||
|
2
|
||||||
|
}) NEXT:[r(1)] PREV:[<START>]
|
||||||
l2:
|
l2:
|
||||||
l5:
|
l5:
|
||||||
r(1) NEXT:[r(0)] PREV:[<START>, jmp(l2)]
|
r(1) NEXT:[r(0)] PREV:[r(while(1 > 0) { 2 }) , jmp(l2)]
|
||||||
r(0) NEXT:[r(>)] PREV:[r(1)]
|
r(0) NEXT:[r(>)] PREV:[r(1)]
|
||||||
r(>) NEXT:[r(1 > 0)] PREV:[r(0)]
|
r(>) NEXT:[r(1 > 0)] PREV:[r(0)]
|
||||||
r(1 > 0) NEXT:[jf(l3)] PREV:[r(>)]
|
r(1 > 0) NEXT:[jf(l3)] PREV:[r(>)]
|
||||||
@@ -33,18 +36,20 @@ fun dowhile() {
|
|||||||
}
|
}
|
||||||
---------------------
|
---------------------
|
||||||
l0:
|
l0:
|
||||||
<START> NEXT:[ret l1] PREV:[]
|
<START> NEXT:[r(do {return} while(1 > 0)) ] PREV:[]
|
||||||
|
r(do {return}
|
||||||
|
while(1 > 0)) NEXT:[ret l1] PREV:[<START>]
|
||||||
l2:
|
l2:
|
||||||
l4:
|
l4:
|
||||||
ret l1 NEXT:[<END>] PREV:[<START>]
|
ret l1 NEXT:[<END>] PREV:[r(do {return} while(1 > 0)) ]
|
||||||
l5:
|
l5:
|
||||||
* r(1) NEXT:[r(0)] PREV:[]
|
- r(1) NEXT:[r(0)] PREV:[]
|
||||||
* r(0) NEXT:[r(>)] PREV:[]
|
- r(0) NEXT:[r(>)] PREV:[]
|
||||||
* r(>) NEXT:[r(1 > 0)] PREV:[]
|
- r(>) NEXT:[r(1 > 0)] PREV:[]
|
||||||
* r(1 > 0) NEXT:[jt(l2)] PREV:[]
|
- r(1 > 0) NEXT:[jt(l2)] PREV:[]
|
||||||
* jt(l2) NEXT:[read (Unit), ret l1] PREV:[]
|
- jt(l2) NEXT:[read (Unit), ret l1] PREV:[]
|
||||||
l3:
|
l3:
|
||||||
* read (Unit) NEXT:[<END>] PREV:[]
|
- read (Unit) NEXT:[<END>] PREV:[]
|
||||||
l1:
|
l1:
|
||||||
<END> NEXT:[<SINK>] PREV:[ret l1]
|
<END> NEXT:[<SINK>] PREV:[ret l1]
|
||||||
error:
|
error:
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ fun blockAndAndMismatch() : Boolean {
|
|||||||
l0:
|
l0:
|
||||||
<START> NEXT:[r(false)] PREV:[]
|
<START> NEXT:[r(false)] PREV:[]
|
||||||
r(false) NEXT:[jt(l2)] PREV:[<START>]
|
r(false) NEXT:[jt(l2)] PREV:[<START>]
|
||||||
jt(l2) NEXT:[r(false), r(false || (return false))] PREV:[r(false)]
|
jt(l2) NEXT:[r((return false)), r(false || (return false))] PREV:[r(false)]
|
||||||
r(false) NEXT:[ret(*) l1] PREV:[jt(l2)]
|
r((return false)) NEXT:[r(false)] PREV:[jt(l2)]
|
||||||
|
r(false) NEXT:[ret(*) l1] PREV:[r((return false))]
|
||||||
ret(*) l1 NEXT:[<END>] PREV:[r(false)]
|
ret(*) l1 NEXT:[<END>] PREV:[r(false)]
|
||||||
l2:
|
l2:
|
||||||
r(false || (return false)) NEXT:[<END>] PREV:[jt(l2)]
|
r(false || (return false)) NEXT:[<END>] PREV:[jt(l2)]
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import kotlin.modules.*
|
import kotlin.modules.*
|
||||||
|
|
||||||
val modules = module("smoke") {
|
fun project() {
|
||||||
source files "Smoke.kt"
|
module("smoke") {
|
||||||
jar name System.getProperty("java.io.tmpdir") + "/smoke.jar"
|
sources += "Smoke.kt"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
//KT-1001 Argument 2 for @NotNull parameter of JetFlowInformationProvider.checkIsInitialized must not be null
|
||||||
|
|
||||||
|
package kt1001
|
||||||
|
//+JDK
|
||||||
|
|
||||||
|
fun foo(<!UNUSED_PARAMETER!>c<!>: Array<Int>) {
|
||||||
|
return
|
||||||
|
|
||||||
|
<!UNREACHABLE_CODE!>for (i in c) {}<!>
|
||||||
|
<!UNREACHABLE_CODE!>for (i in c) {}<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
//more tests
|
||||||
|
|
||||||
|
fun t1() : Int {
|
||||||
|
try {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
catch (e : Exception) {
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
<!UNREACHABLE_CODE!>return 3<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun t2() : Int {
|
||||||
|
try {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
doSmth()
|
||||||
|
}
|
||||||
|
<!UNREACHABLE_CODE!>return 2<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun doSmth() {}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
//KT-1027 Strange selection of unreachable code
|
||||||
|
//+JDK
|
||||||
|
|
||||||
|
package kt1027
|
||||||
|
|
||||||
|
import java.util.List
|
||||||
|
|
||||||
|
fun foo(<!UNUSED_PARAMETER!>c<!>: List<Int>) {
|
||||||
|
var <!UNUSED_VARIABLE!>i<!> = 2
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
<!UNREACHABLE_CODE!>for (j in c) { //strange selection of unreachable code
|
||||||
|
i += 23
|
||||||
|
}<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun t1() {
|
||||||
|
return
|
||||||
|
|
||||||
|
<!UNREACHABLE_CODE!>while(true) {
|
||||||
|
doSmth()
|
||||||
|
}<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun t2() {
|
||||||
|
return
|
||||||
|
|
||||||
|
<!UNREACHABLE_CODE!>do {
|
||||||
|
doSmth()
|
||||||
|
} while (true)<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun t3() {
|
||||||
|
return
|
||||||
|
|
||||||
|
<!UNREACHABLE_CODE!>try {
|
||||||
|
doSmth()
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
doSmth()
|
||||||
|
}<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun t4() {
|
||||||
|
return
|
||||||
|
|
||||||
|
<!UNREACHABLE_CODE!>(43)<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
fun doSmth() {}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
//KT-776 Wrong detection of unreachable code
|
||||||
|
|
||||||
|
package kt776
|
||||||
|
|
||||||
|
fun test5() : Int {
|
||||||
|
var x = 0
|
||||||
|
while(true) {
|
||||||
|
try {
|
||||||
|
if(x < 10) {
|
||||||
|
x++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
x++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
|
||||||
|
fun test1() : Int {
|
||||||
|
try {
|
||||||
|
if (true) {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
doSmth() //unreachable
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun doSmth() {}
|
||||||
@@ -128,7 +128,7 @@ public class JetControlFlowTest extends JetLiteFixture {
|
|||||||
//check edges directions
|
//check edges directions
|
||||||
Collection<Instruction> instructions = pseudocode.getMutableInstructionList();
|
Collection<Instruction> instructions = pseudocode.getMutableInstructionList();
|
||||||
for (Instruction instruction : instructions) {
|
for (Instruction instruction : instructions) {
|
||||||
if (!instruction.isDead()) {
|
if (!((InstructionImpl)instruction).isDead()) {
|
||||||
for (Instruction nextInstruction : instruction.getNextInstructions()) {
|
for (Instruction nextInstruction : instruction.getNextInstructions()) {
|
||||||
assertTrue("instruction '" + instruction + "' has '" + nextInstruction + "' among next instructions list, but not vice versa",
|
assertTrue("instruction '" + instruction + "' has '" + nextInstruction + "' among next instructions list, but not vice versa",
|
||||||
nextInstruction.getPreviousInstructions().contains(instruction));
|
nextInstruction.getPreviousInstructions().contains(instruction));
|
||||||
@@ -176,7 +176,7 @@ public class JetControlFlowTest extends JetLiteFixture {
|
|||||||
private static String formatInstruction(Instruction instruction, int maxLength, Set<Instruction> remainedAfterPostProcessInstructions) {
|
private static String formatInstruction(Instruction instruction, int maxLength, Set<Instruction> remainedAfterPostProcessInstructions) {
|
||||||
String[] parts = instruction.toString().split("\n");
|
String[] parts = instruction.toString().split("\n");
|
||||||
boolean isRemovedThroughPostProcess = !remainedAfterPostProcessInstructions.contains(instruction);
|
boolean isRemovedThroughPostProcess = !remainedAfterPostProcessInstructions.contains(instruction);
|
||||||
String prefix = isRemovedThroughPostProcess ? "R " : instruction.isDead() ? "* " : " ";
|
String prefix = isRemovedThroughPostProcess ? "- " : ((InstructionImpl)instruction).isDead() ? "* " : " ";
|
||||||
if (parts.length == 1) {
|
if (parts.length == 1) {
|
||||||
return prefix + String.format("%1$-" + maxLength + "s", instruction);
|
return prefix + String.format("%1$-" + maxLength + "s", instruction);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package org.jetbrains.jet.compiler;
|
package org.jetbrains.jet.compiler;
|
||||||
|
|
||||||
import jet.modules.IModuleBuilder;
|
import jet.modules.Module;
|
||||||
import jet.modules.IModuleSetBuilder;
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import org.jetbrains.jet.cli.KotlinCompiler;
|
import org.jetbrains.jet.cli.KotlinCompiler;
|
||||||
import org.jetbrains.jet.codegen.ClassFileFactory;
|
import org.jetbrains.jet.codegen.ClassFileFactory;
|
||||||
@@ -37,9 +36,9 @@ public class CompileEnvironmentTest extends TestCase {
|
|||||||
environment.setJavaRuntime(activeRtJar);
|
environment.setJavaRuntime(activeRtJar);
|
||||||
environment.initializeKotlinRuntime();
|
environment.initializeKotlinRuntime();
|
||||||
final String testDataDir = JetParsingTest.getTestDataDir() + "/compiler/smoke/";
|
final String testDataDir = JetParsingTest.getTestDataDir() + "/compiler/smoke/";
|
||||||
final IModuleSetBuilder setBuilder = environment.loadModuleScript(testDataDir + "Smoke.kts");
|
final List<Module> modules = environment.loadModuleScript(testDataDir + "Smoke.kts");
|
||||||
assertEquals(1, setBuilder.getModules().size());
|
assertEquals(1, modules.size());
|
||||||
final IModuleBuilder moduleBuilder = setBuilder.getModules().get(0);
|
final Module moduleBuilder = modules.get(0);
|
||||||
final ClassFileFactory factory = environment.compileModule(moduleBuilder, testDataDir);
|
final ClassFileFactory factory = environment.compileModule(moduleBuilder, testDataDir);
|
||||||
assertNotNull(factory);
|
assertNotNull(factory);
|
||||||
assertNotNull(factory.asBytes("Smoke/namespace.class"));
|
assertNotNull(factory.asBytes("Smoke/namespace.class"));
|
||||||
@@ -51,7 +50,7 @@ public class CompileEnvironmentTest extends TestCase {
|
|||||||
assertTrue(entries.contains("Smoke/namespace.class"));
|
assertTrue(entries.contains("Smoke/namespace.class"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void _testSmokeWithCompilerJar() throws IOException {
|
public void testSmokeWithCompilerJar() throws IOException {
|
||||||
File tempFile = File.createTempFile("compilerTest", "compilerTest");
|
File tempFile = File.createTempFile("compilerTest", "compilerTest");
|
||||||
try {
|
try {
|
||||||
KotlinCompiler.main(Arrays.asList("-module", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kts", "-jar", tempFile.getAbsolutePath()).toArray(new String[0]));
|
KotlinCompiler.main(Arrays.asList("-module", JetParsingTest.getTestDataDir() + "/compiler/smoke/Smoke.kts", "-jar", tempFile.getAbsolutePath()).toArray(new String[0]));
|
||||||
|
|||||||
@@ -118,7 +118,8 @@ public class JetKeywordCompletionContributor extends CompletionContributor {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isAcceptable(Object element, PsiElement context) {
|
public boolean isAcceptable(Object element, PsiElement context) {
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
return PsiTreeUtil.getParentOfType(context, JetClassBody.class, true, JetBlockExpression.class) != null;
|
return PsiTreeUtil.getParentOfType(context, JetClassBody.class, true,
|
||||||
|
JetBlockExpression.class, JetProperty.class) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
class MouseMovedEventArgs
|
||||||
|
{
|
||||||
|
public val X : int = 0
|
||||||
|
in<caret>
|
||||||
|
}
|
||||||
|
|
||||||
|
// EXIST: internal
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
class MouseMovedEventArgs
|
||||||
|
{
|
||||||
|
public val X : int<caret> = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// ABSENT: internal
|
||||||
@@ -3,57 +3,35 @@ package kotlin.modules
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
import jet.modules.*
|
import jet.modules.*
|
||||||
|
|
||||||
fun moduleSet(description: ModuleSetBuilder.() -> Unit) = description
|
fun module(name: String, callback: ModuleBuilder.() -> Unit) {
|
||||||
|
|
||||||
fun module(name: String, description: ModuleBuilder.() -> Unit) = moduleSet {
|
|
||||||
module(name, description)
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleSetBuilder(): IModuleSetBuilder {
|
|
||||||
private val modules = ArrayList<IModuleBuilder?>()
|
|
||||||
|
|
||||||
fun module(name: String, callback: ModuleBuilder.() -> Unit) {
|
|
||||||
val builder = ModuleBuilder(name)
|
val builder = ModuleBuilder(name)
|
||||||
builder.callback()
|
builder.callback()
|
||||||
modules.add(builder)
|
AllModules.modules?.add(builder)
|
||||||
}
|
|
||||||
|
|
||||||
override fun getModules(): List<IModuleBuilder?>? = modules
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SourcesBuilder(val parent: ModuleBuilder) {
|
class SourcesBuilder(val parent: ModuleBuilder) {
|
||||||
fun files(pattern: String) {
|
fun plusAssign(pattern: String) {
|
||||||
parent.addSourceFiles(pattern)
|
parent.addSourceFiles(pattern)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ClasspathBuilder(val parent: ModuleBuilder) {
|
class ClasspathBuilder(val parent: ModuleBuilder) {
|
||||||
fun entry(name: String) {
|
fun plusAssign(name: String) {
|
||||||
parent.addClasspathEntry(name)
|
parent.addClasspathEntry(name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class JarBuilder(val parent: ModuleBuilder) {
|
open class ModuleBuilder(val name: String): Module {
|
||||||
fun name(jarName: String) {
|
|
||||||
parent.setJarName(jarName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open class ModuleBuilder(val name: String): IModuleBuilder {
|
|
||||||
// http://youtrack.jetbrains.net/issue/KT-904
|
// http://youtrack.jetbrains.net/issue/KT-904
|
||||||
private val sourceFiles0: ArrayList<String?> = ArrayList<String?>()
|
private val sourceFiles0: ArrayList<String?> = ArrayList<String?>()
|
||||||
private val classpathRoots0: ArrayList<String?> = ArrayList<String?>()
|
private val classpathRoots0: ArrayList<String?> = ArrayList<String?>()
|
||||||
var _jarName: String? = null
|
|
||||||
|
|
||||||
val source: SourcesBuilder
|
val sources: SourcesBuilder
|
||||||
get() = SourcesBuilder(this)
|
get() = SourcesBuilder(this)
|
||||||
|
|
||||||
val classpath: ClasspathBuilder
|
val classpath: ClasspathBuilder
|
||||||
get() = ClasspathBuilder(this)
|
get() = ClasspathBuilder(this)
|
||||||
|
|
||||||
val jar: JarBuilder
|
|
||||||
get() = JarBuilder(this)
|
|
||||||
|
|
||||||
fun addSourceFiles(pattern: String) {
|
fun addSourceFiles(pattern: String) {
|
||||||
sourceFiles0.add(pattern)
|
sourceFiles0.add(pattern)
|
||||||
}
|
}
|
||||||
@@ -62,19 +40,8 @@ open class ModuleBuilder(val name: String): IModuleBuilder {
|
|||||||
classpathRoots0.add(name)
|
classpathRoots0.add(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setJarName(name: String) {
|
|
||||||
_jarName = name
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getSourceFiles(): List<String?>? = sourceFiles0
|
override fun getSourceFiles(): List<String?>? = sourceFiles0
|
||||||
override fun getClasspathRoots(): List<String?>? = classpathRoots0
|
override fun getClasspathRoots(): List<String?>? = classpathRoots0
|
||||||
override fun getModuleName(): String? = name
|
override fun getModuleName(): String? = name
|
||||||
override fun getJarName(): String? = _jarName
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModuleBuilder2(name: String): ModuleBuilder(name) {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* @author max
|
||||||
|
*/
|
||||||
|
package jet.modules;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class AllModules {
|
||||||
|
public static final ArrayList<Module> modules = new ArrayList<Module>();
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package jet.modules;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author yole
|
|
||||||
*/
|
|
||||||
public interface IModuleSetBuilder {
|
|
||||||
List<IModuleBuilder> getModules();
|
|
||||||
}
|
|
||||||
@@ -5,9 +5,8 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* @author yole
|
* @author yole
|
||||||
*/
|
*/
|
||||||
public interface IModuleBuilder {
|
public interface Module {
|
||||||
String getModuleName();
|
String getModuleName();
|
||||||
List<String> getSourceFiles();
|
List<String> getSourceFiles();
|
||||||
List<String> getClasspathRoots();
|
List<String> getClasspathRoots();
|
||||||
String getJarName();
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user