# HG changeset patch # User Doug Simon # Date 1333440349 -7200 # Node ID b00e56aa159db06ad2d9e66f566510160383e72b # Parent db2286df91493f68ee0cd462fdeab5517b23dbd0 added printing of HotSpot config if graal.printconfig system property is true diff -r db2286df9149 -r b00e56aa159d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerImpl.java Tue Apr 03 09:43:21 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerImpl.java Tue Apr 03 10:05:49 2012 +0200 @@ -23,12 +23,9 @@ package com.oracle.graal.hotspot; import java.io.*; +import java.lang.reflect.*; import java.net.*; -import com.oracle.max.asm.target.amd64.*; -import com.oracle.max.cri.ci.*; -import com.oracle.max.cri.ri.*; -import com.oracle.max.cri.xir.*; import com.oracle.graal.compiler.*; import com.oracle.graal.compiler.graph.*; import com.oracle.graal.compiler.target.*; @@ -37,6 +34,10 @@ import com.oracle.graal.hotspot.logging.*; import com.oracle.graal.hotspot.ri.*; import com.oracle.graal.hotspot.server.*; +import com.oracle.max.asm.target.amd64.*; +import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; +import com.oracle.max.cri.xir.*; /** * Singleton class holding the instance of the GraalCompiler. @@ -128,6 +129,21 @@ // initialize compiler config = vmEntries.getConfiguration(); config.check(); + + if (Boolean.valueOf(System.getProperty("graal.printconfig"))) { + printConfig(config); + } + } + + private static void printConfig(HotSpotVMConfig config) { + Field[] fields = config.getClass().getDeclaredFields(); + for (Field f : fields) { + f.setAccessible(true); + try { + Logger.info(String.format("%9s %-40s = %s", f.getType().getSimpleName(), f.getName(), Logger.pretty(f.get(config)))); + } catch (Exception e) { + } + } } @Override diff -r db2286df9149 -r b00e56aa159d graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/Logger.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/Logger.java Tue Apr 03 09:43:21 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/Logger.java Tue Apr 03 10:05:49 2012 +0200 @@ -164,7 +164,7 @@ } return value + " (0x" + Integer.toHexString((Integer) value) + ")"; } else if (value instanceof Long) { - if ((Long) value < 10) { + if ((Long) value < 10 && (Long) value > -10) { return value + "l"; } return value + "l (0x" + Long.toHexString((Long) value) + "l)"; @@ -175,10 +175,19 @@ dimensions++; klass = klass.getComponentType(); } - str.append(klass.getSimpleName()).append('[').append(Array.getLength(value)).append(']'); + int length = Array.getLength(value); + str.append(klass.getSimpleName()).append('[').append(length).append(']'); for (int i = 1; i < dimensions; i++) { str.append("[]"); } + str.append(" {"); + for (int i = 0; i < length; i++) { + str.append(pretty(Array.get(value, i))); + if (i < length - 1) { + str.append(", "); + } + } + str.append('}'); return str.toString(); }