35 import java.util.List; |
35 import java.util.List; |
36 import java.util.Map; |
36 import java.util.Map; |
37 import java.util.SortedMap; |
37 import java.util.SortedMap; |
38 import java.util.TreeMap; |
38 import java.util.TreeMap; |
39 |
39 |
|
40 import org.graalvm.collections.EconomicMap; |
|
41 import org.graalvm.collections.EconomicSet; |
|
42 import org.graalvm.collections.Equivalence; |
40 import org.graalvm.compiler.core.common.Fields; |
43 import org.graalvm.compiler.core.common.Fields; |
41 import org.graalvm.compiler.core.common.PermanentBailoutException; |
44 import org.graalvm.compiler.core.common.PermanentBailoutException; |
42 import org.graalvm.compiler.core.common.util.TypeReader; |
45 import org.graalvm.compiler.core.common.util.TypeReader; |
43 import org.graalvm.compiler.core.common.util.UnsafeArrayTypeReader; |
46 import org.graalvm.compiler.core.common.util.UnsafeArrayTypeReader; |
44 import org.graalvm.compiler.debug.DebugContext; |
47 import org.graalvm.compiler.debug.DebugContext; |
60 import org.graalvm.compiler.nodes.GraphDecoder.ProxyPlaceholder; |
63 import org.graalvm.compiler.nodes.GraphDecoder.ProxyPlaceholder; |
61 import org.graalvm.compiler.nodes.calc.FloatingNode; |
64 import org.graalvm.compiler.nodes.calc.FloatingNode; |
62 import org.graalvm.compiler.nodes.extended.IntegerSwitchNode; |
65 import org.graalvm.compiler.nodes.extended.IntegerSwitchNode; |
63 import org.graalvm.compiler.nodes.graphbuilderconf.LoopExplosionPlugin.LoopExplosionKind; |
66 import org.graalvm.compiler.nodes.graphbuilderconf.LoopExplosionPlugin.LoopExplosionKind; |
64 import org.graalvm.compiler.options.OptionValues; |
67 import org.graalvm.compiler.options.OptionValues; |
65 import org.graalvm.util.EconomicMap; |
|
66 import org.graalvm.util.EconomicSet; |
|
67 import org.graalvm.util.Equivalence; |
|
68 |
68 |
69 import jdk.vm.ci.code.Architecture; |
69 import jdk.vm.ci.code.Architecture; |
70 import jdk.vm.ci.meta.DeoptimizationAction; |
70 import jdk.vm.ci.meta.DeoptimizationAction; |
71 import jdk.vm.ci.meta.DeoptimizationReason; |
71 import jdk.vm.ci.meta.DeoptimizationReason; |
72 import jdk.vm.ci.meta.JavaConstant; |
72 import jdk.vm.ci.meta.JavaConstant; |
487 * loop. Therefore, we create a new LoopScope of the outer loop for every loop exit |
487 * loop. Therefore, we create a new LoopScope of the outer loop for every loop exit |
488 * of the inner loop. |
488 * of the inner loop. |
489 */ |
489 */ |
490 LoopScope outerScope = loopScope.outer; |
490 LoopScope outerScope = loopScope.outer; |
491 int nextIterationNumber = outerScope.nextIterations.isEmpty() ? outerScope.loopIteration + 1 : outerScope.nextIterations.getLast().loopIteration + 1; |
491 int nextIterationNumber = outerScope.nextIterations.isEmpty() ? outerScope.loopIteration + 1 : outerScope.nextIterations.getLast().loopIteration + 1; |
492 successorAddScope = new LoopScope(methodScope, outerScope.outer, outerScope.loopDepth, nextIterationNumber, outerScope.loopBeginOrderId, outerScope.initialCreatedNodes, |
492 successorAddScope = new LoopScope(methodScope, outerScope.outer, outerScope.loopDepth, nextIterationNumber, outerScope.loopBeginOrderId, |
|
493 outerScope.initialCreatedNodes == null ? null : Arrays.copyOf(outerScope.initialCreatedNodes, outerScope.initialCreatedNodes.length), |
493 Arrays.copyOf(loopScope.initialCreatedNodes, loopScope.initialCreatedNodes.length), outerScope.nextIterations, outerScope.iterationStates); |
494 Arrays.copyOf(loopScope.initialCreatedNodes, loopScope.initialCreatedNodes.length), outerScope.nextIterations, outerScope.iterationStates); |
494 checkLoopExplosionIteration(methodScope, successorAddScope); |
495 checkLoopExplosionIteration(methodScope, successorAddScope); |
495 |
496 |
496 /* |
497 /* |
497 * Nodes that are still unprocessed in the outer scope might be merge nodes that are |
498 * Nodes that are still unprocessed in the outer scope might be merge nodes that are |
734 loopEnd.safeDelete(); |
735 loopEnd.safeDelete(); |
735 |
736 |
736 assert methodScope.loopExplosion != LoopExplosionKind.NONE; |
737 assert methodScope.loopExplosion != LoopExplosionKind.NONE; |
737 if (methodScope.loopExplosion != LoopExplosionKind.FULL_UNROLL || loopScope.nextIterations.isEmpty()) { |
738 if (methodScope.loopExplosion != LoopExplosionKind.FULL_UNROLL || loopScope.nextIterations.isEmpty()) { |
738 int nextIterationNumber = loopScope.nextIterations.isEmpty() ? loopScope.loopIteration + 1 : loopScope.nextIterations.getLast().loopIteration + 1; |
739 int nextIterationNumber = loopScope.nextIterations.isEmpty() ? loopScope.loopIteration + 1 : loopScope.nextIterations.getLast().loopIteration + 1; |
739 LoopScope nextIterationScope = new LoopScope(methodScope, loopScope.outer, loopScope.loopDepth, nextIterationNumber, loopScope.loopBeginOrderId, loopScope.initialCreatedNodes, |
740 LoopScope nextIterationScope = new LoopScope(methodScope, loopScope.outer, loopScope.loopDepth, nextIterationNumber, loopScope.loopBeginOrderId, |
|
741 Arrays.copyOf(loopScope.initialCreatedNodes, loopScope.initialCreatedNodes.length), |
740 Arrays.copyOf(loopScope.initialCreatedNodes, loopScope.initialCreatedNodes.length), loopScope.nextIterations, loopScope.iterationStates); |
742 Arrays.copyOf(loopScope.initialCreatedNodes, loopScope.initialCreatedNodes.length), loopScope.nextIterations, loopScope.iterationStates); |
741 checkLoopExplosionIteration(methodScope, nextIterationScope); |
743 checkLoopExplosionIteration(methodScope, nextIterationScope); |
742 loopScope.nextIterations.addLast(nextIterationScope); |
744 loopScope.nextIterations.addLast(nextIterationScope); |
743 registerNode(nextIterationScope, loopScope.loopBeginOrderId, null, true, true); |
745 registerNode(nextIterationScope, loopScope.loopBeginOrderId, null, true, true); |
744 makeStubNode(methodScope, nextIterationScope, loopScope.loopBeginOrderId); |
746 makeStubNode(methodScope, nextIterationScope, loopScope.loopBeginOrderId); |