use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class NodeUsagesTests method testReplaceAtUsages.
@Test
public void testReplaceAtUsages() {
OptionValues options = getOptions();
Graph graph = new Graph(options, getDebug(options));
Def def0 = graph.add(new Def());
Def def1 = graph.add(new Def());
Use use0 = graph.add(new Use(def0, null, null));
Use use1 = graph.add(new Use(null, def0, null));
Use use2 = graph.add(new Use(null, null, def0));
assertEquals(3, def0.getUsageCount());
assertThat(def0.usages(), contains(use0));
assertThat(def0.usages(), contains(use1));
assertThat(def0.usages(), contains(use2));
assertThat(def0.usages(), isNotEmpty());
assertThat(def1.usages(), isEmpty());
def0.replaceAtUsages(def1);
assertThat(def0.usages(), isEmpty());
assertEquals(3, def1.getUsageCount());
assertThat(def1.usages(), contains(use0));
assertThat(def1.usages(), contains(use1));
assertThat(def1.usages(), contains(use2));
assertThat(def1.usages(), isNotEmpty());
}
use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class NodeUsagesTests method testReplaceAtUsagesWithPredicate02.
@Test
public void testReplaceAtUsagesWithPredicate02() {
OptionValues options = getOptions();
Graph graph = new Graph(options, getDebug(options));
Def def0 = graph.add(new Def());
Def def1 = graph.add(new Def());
Use use0 = graph.add(new Use(def0, null, null));
Use use1 = graph.add(new Use(null, def0, null));
Use use2 = graph.add(new Use(null, null, def0));
assertEquals(3, def0.getUsageCount());
assertThat(def0.usages(), contains(use0));
assertThat(def0.usages(), contains(use1));
assertThat(def0.usages(), contains(use2));
assertThat(def0.usages(), isNotEmpty());
assertThat(def1.usages(), isEmpty());
def0.replaceAtMatchingUsages(def1, u -> u != use1);
assertEquals(1, def0.getUsageCount());
assertThat(def0.usages(), contains(use1));
assertThat(def0.usages(), isNotEmpty());
assertEquals(2, def1.getUsageCount());
assertThat(def1.usages(), contains(use0));
assertThat(def1.usages(), contains(use2));
assertThat(def1.usages(), isNotEmpty());
}
use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class NodeUsagesTests method testReplaceAtUsagesWithPredicate023.
@Test
public void testReplaceAtUsagesWithPredicate023() {
OptionValues options = getOptions();
Graph graph = new Graph(options, getDebug(options));
Def def0 = graph.add(new Def());
Def def1 = graph.add(new Def());
Use use0 = graph.add(new Use(def0, null, null));
Use use1 = graph.add(new Use(null, def0, null));
Use use2 = graph.add(new Use(null, null, def0));
Use use3 = graph.add(new Use(null, null, def0));
assertEquals(4, def0.getUsageCount());
assertThat(def0.usages(), contains(use0));
assertThat(def0.usages(), contains(use1));
assertThat(def0.usages(), contains(use2));
assertThat(def0.usages(), contains(use3));
assertThat(def0.usages(), isNotEmpty());
assertThat(def1.usages(), isEmpty());
def0.replaceAtMatchingUsages(def1, u -> u != use1);
assertEquals(1, def0.getUsageCount());
assertThat(def0.usages(), contains(use1));
assertThat(def0.usages(), isNotEmpty());
assertEquals(3, def1.getUsageCount());
assertThat(def1.usages(), contains(use0));
assertThat(def1.usages(), contains(use2));
assertThat(def1.usages(), contains(use3));
assertThat(def1.usages(), isNotEmpty());
}
use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class NodeUsagesTests method testReplaceAtUsagesWithPredicate01.
@Test
public void testReplaceAtUsagesWithPredicate01() {
OptionValues options = getOptions();
Graph graph = new Graph(options, getDebug(options));
Def def0 = graph.add(new Def());
Def def1 = graph.add(new Def());
Use use0 = graph.add(new Use(def0, null, null));
Use use1 = graph.add(new Use(null, def0, null));
Use use2 = graph.add(new Use(null, null, def0));
assertEquals(3, def0.getUsageCount());
assertThat(def0.usages(), contains(use0));
assertThat(def0.usages(), contains(use1));
assertThat(def0.usages(), contains(use2));
assertThat(def0.usages(), isNotEmpty());
assertThat(def1.usages(), isEmpty());
def0.replaceAtMatchingUsages(def1, u -> u != use2);
assertEquals(1, def0.getUsageCount());
assertThat(def0.usages(), contains(use2));
assertThat(def0.usages(), isNotEmpty());
assertEquals(2, def1.getUsageCount());
assertThat(def1.usages(), contains(use0));
assertThat(def1.usages(), contains(use1));
assertThat(def1.usages(), isNotEmpty());
}
use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class NodeUsagesTests method testReplaceAtUsagesWithPredicateNone.
@Test
public void testReplaceAtUsagesWithPredicateNone() {
OptionValues options = getOptions();
Graph graph = new Graph(options, getDebug(options));
Def def0 = graph.add(new Def());
Def def1 = graph.add(new Def());
Use use0 = graph.add(new Use(def0, null, null));
Use use1 = graph.add(new Use(null, def0, null));
Use use2 = graph.add(new Use(null, null, def0));
assertEquals(3, def0.getUsageCount());
assertThat(def0.usages(), contains(use0));
assertThat(def0.usages(), contains(use1));
assertThat(def0.usages(), contains(use2));
assertThat(def0.usages(), isNotEmpty());
assertThat(def1.usages(), isEmpty());
def0.replaceAtMatchingUsages(def1, u -> false);
assertThat(def1.usages(), isEmpty());
assertEquals(3, def0.getUsageCount());
assertThat(def0.usages(), contains(use0));
assertThat(def0.usages(), contains(use1));
assertThat(def0.usages(), contains(use2));
assertThat(def0.usages(), isNotEmpty());
}
Aggregations