# HG changeset patch # User Lukas Stadler # Date 1328093972 -3600 # Node ID 0bb7ab1add7ef26ba4fd1e6507c11799f9440351 # Parent 2302b1514e7e13561493eb0e6e8bc4fa7a4dfdbf enable dumping graphs upon exception, new constructor for NodeInputList, initialize debug system for non-compiler threads diff -r 2302b1514e7e -r 0bb7ab1add7e graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/Debug.java --- a/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/Debug.java Tue Jan 31 10:47:55 2012 +0100 +++ b/graal/com.oracle.max.graal.debug/src/com/oracle/max/graal/debug/Debug.java Wed Feb 01 11:59:32 2012 +0100 @@ -103,6 +103,7 @@ public static void dump(Object object, String msg, Object... args) { if (ENABLED && DebugScope.getInstance().isDumpEnabled()) { + System.out.println("dumping"); DebugScope.getInstance().dump(object, msg, args); } } @@ -144,7 +145,7 @@ } } - public static DebugConfig fixedConfig(final boolean isLogEnabled, final boolean isDumpEnabled, final boolean isMeterEnabled, final boolean isTimerEnabled) { + public static DebugConfig fixedConfig(final boolean isLogEnabled, final boolean isDumpEnabled, final boolean isMeterEnabled, final boolean isTimerEnabled, final List dumpHandlers) { return new DebugConfig() { @Override @@ -174,7 +175,7 @@ @Override public Collection< ? extends DebugDumpHandler> dumpHandlers() { - return Collections.emptyList(); + return dumpHandlers; } }; } diff -r 2302b1514e7e -r 0bb7ab1add7e graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeInputList.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeInputList.java Tue Jan 31 10:47:55 2012 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeInputList.java Wed Feb 01 11:59:32 2012 +0100 @@ -22,6 +22,8 @@ */ package com.oracle.max.graal.graph; +import java.util.*; + public final class NodeInputList extends NodeList { @@ -42,6 +44,12 @@ this.self = self; } + public NodeInputList(Node self, List elements) { + super(elements); + assert self.usages() == null; + this.self = self; + } + @Override protected void update(T oldNode, T newNode) { self.updateUsages(oldNode, newNode); diff -r 2302b1514e7e -r 0bb7ab1add7e graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeList.java --- a/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeList.java Tue Jan 31 10:47:55 2012 +0100 +++ b/graal/com.oracle.max.graal.graph/src/com/oracle/max/graal/graph/NodeList.java Wed Feb 01 11:59:32 2012 +0100 @@ -64,6 +64,21 @@ } } + protected NodeList(List elements) { + if (elements == null || elements.isEmpty()) { + this.size = 0; + this.nodes = EMPTY_NODE_ARRAY; + this.initialSize = 0; + } else { + this.size = elements.size(); + this.initialSize = elements.size(); + this.nodes = new Node[elements.size()]; + for (int i = 0; i < elements.size(); i++) { + this.nodes[i] = elements.get(i); + } + } + } + protected abstract void update(T oldNode, T newNode); @Override diff -r 2302b1514e7e -r 0bb7ab1add7e graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotDebugConfig.java --- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotDebugConfig.java Tue Jan 31 10:47:55 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/HotSpotDebugConfig.java Wed Feb 01 11:59:32 2012 +0100 @@ -90,7 +90,7 @@ for (Object o : Debug.context()) { if (o instanceof RiMethod) { RiMethod riMethod = (RiMethod) o; - if (riMethod.toString().contains(methodFilter)) { + if (CiUtil.format("%H.%n", riMethod).contains(methodFilter)) { return true; } } @@ -125,7 +125,7 @@ if (e instanceof CiBailout) { return e; } - Debug.setConfig(Debug.fixedConfig(true, true, false, false)); + Debug.setConfig(Debug.fixedConfig(true, true, false, false, dumpHandlers)); // sync "Exception occured in scope: " with mx/sanitycheck.py::Test.__init__ Debug.log(String.format("Exception occured in scope: %s", Debug.currentScope())); for (Object o : Debug.context()) { diff -r 2302b1514e7e -r 0bb7ab1add7e graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java Tue Jan 31 10:47:55 2012 +0100 +++ b/graal/com.oracle.max.graal.hotspot/src/com/oracle/max/graal/hotspot/bridge/VMToCompilerImpl.java Wed Feb 01 11:59:32 2012 +0100 @@ -227,12 +227,20 @@ @Override public void compileMethod(final HotSpotMethodResolved method, final int entryBCI, boolean blocking) throws Throwable { try { - if (Thread.currentThread() instanceof CompilerThread && method.holder().name().contains("java/util/concurrent")) { - // This is required to avoid deadlocking a compiler thread. The issue is that a - // java.util.concurrent.BlockingQueue is used to implement the compilation worker - // queues. If a compiler thread triggers a compilation, then it may be blocked trying - // to add something to its own queue. - return; + if (Thread.currentThread() instanceof CompilerThread) { + if (method.holder().name().contains("java/util/concurrent")) { + // This is required to avoid deadlocking a compiler thread. The issue is that a + // java.util.concurrent.BlockingQueue is used to implement the compilation worker + // queues. If a compiler thread triggers a compilation, then it may be blocked trying + // to add something to its own queue. + return; + } + } else { + if (GraalOptions.Debug) { + Debug.enable(); + HotSpotDebugConfig hotspotDebugConfig = new HotSpotDebugConfig(GraalOptions.Log, GraalOptions.Meter, GraalOptions.Time, GraalOptions.Dump, GraalOptions.MethodFilter); + Debug.setConfig(hotspotDebugConfig); + } } Runnable runnable = new Runnable() {