8177856: [AOT] EliminateRedundantInitializationPhase is not working

Looks for constants of a correct type

Reviewed-by: kvn
This commit is contained in:
Igor Veresov 2017-04-03 12:34:30 -07:00
parent bb85a687d4
commit d76b89606e

View File

@ -28,9 +28,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;
import jdk.vm.ci.hotspot.HotSpotMetaspaceConstant;
import jdk.vm.ci.meta.JavaConstant;
import org.graalvm.compiler.graph.Node;
import org.graalvm.compiler.graph.iterators.NodeIterable;
import org.graalvm.compiler.hotspot.nodes.aot.InitializeKlassNode;
@ -43,6 +40,9 @@ import org.graalvm.compiler.nodes.cfg.ControlFlowGraph;
import org.graalvm.compiler.phases.BasePhase;
import org.graalvm.compiler.phases.tiers.PhaseContext;
import jdk.vm.ci.hotspot.HotSpotMetaspaceConstant;
import jdk.vm.ci.meta.Constant;
public class EliminateRedundantInitializationPhase extends BasePhase<PhaseContext> {
/**
* Find blocks with class initializing nodes for the class identified the by the constant node.
@ -202,7 +202,7 @@ public class EliminateRedundantInitializationPhase extends BasePhase<PhaseContex
ControlFlowGraph cfg = ControlFlowGraph.compute(graph, true, false, true, false);
ArrayList<Node> redundantInits = new ArrayList<>();
for (ConstantNode node : getConstantNodes(graph)) {
JavaConstant constant = node.asJavaConstant();
Constant constant = node.asConstant();
if (constant instanceof HotSpotMetaspaceConstant) {
redundantInits.addAll(processConstantNode(cfg, node));
}