use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class DebugContext method forceLog.
public DebugContext.Scope forceLog() throws Throwable {
if (currentConfig != null) {
ArrayList<Object> context = new ArrayList<>();
for (Object obj : context()) {
context.add(obj);
}
DebugConfigImpl config = new DebugConfigImpl(new OptionValues(currentConfig.getOptions(), DebugOptions.Log, ":1000"));
return sandbox("forceLog", config, context.toArray());
}
return null;
}
use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class DebugContext method forceDump.
/**
* Forces an unconditional dump. This method exists mainly for debugging. It can also be used to
* force a graph dump from IDEs that support invoking a Java method while at a breakpoint.
*/
public void forceDump(Object object, String format, Object... args) {
DebugConfig config = currentConfig;
Collection<DebugDumpHandler> dumpHandlers;
boolean closeAfterDump;
if (config != null) {
dumpHandlers = config.dumpHandlers();
closeAfterDump = false;
} else {
OptionValues options = getOptions();
dumpHandlers = new ArrayList<>();
for (DebugHandlersFactory factory : DebugHandlersFactory.LOADER) {
for (DebugHandler handler : factory.createHandlers(options)) {
if (handler instanceof DebugDumpHandler) {
dumpHandlers.add((DebugDumpHandler) handler);
}
}
}
closeAfterDump = true;
}
for (DebugDumpHandler dumpHandler : dumpHandlers) {
dumpHandler.dump(this, object, format, args);
if (closeAfterDump) {
dumpHandler.close();
}
}
}
use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class NodeBitMapTest method before.
@Before
public void before() {
// Need to initialize HotSpotGraalRuntime before any Node class is initialized.
Graal.getRuntime();
OptionValues options = getOptions();
graph = new Graph(options, getDebug(options));
for (int i = 0; i < nodes.length; i++) {
nodes[i] = graph.add(new TestNode());
}
map = graph.createNodeBitMap();
}
use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class NodeMapTest method before.
@Before
public void before() {
// Need to initialize HotSpotGraalRuntime before any Node class is initialized.
Graal.getRuntime();
OptionValues options = getOptions();
graph = new Graph(options, getDebug(options));
for (int i = 0; i < nodes.length; i++) {
nodes[i] = graph.add(new TestNode());
}
map = new NodeMap<>(graph);
for (int i = 0; i < nodes.length; i += 2) {
map.set(nodes[i], i);
}
}
use of org.graalvm.compiler.options.OptionValues in project graal by oracle.
the class NodeUsagesTests method testReplaceAtUsagesWithPredicateAll.
@Test
public void testReplaceAtUsagesWithPredicateAll() {
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 -> true);
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());
}
Aggregations