Mercurial > hg > truffle
changeset 5186:b00e56aa159d
added printing of HotSpot config if graal.printconfig system property is true
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 03 Apr 2012 10:05:49 +0200 |
parents | db2286df9149 |
children | 9b8c0d1bc2dd |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilerImpl.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/Logger.java |
diffstat | 2 files changed, 31 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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(); }