# HG changeset patch # User Doug Simon # Date 1415793321 -3600 # Node ID ddd7829c45b115d07067b06ca48d2252e81f2fd7 # Parent 343ca85103f24f74b1584b745e3d489bce6d8b41 made HotSpotCodeCacheProvider attempt to load and use the hcfdis tool diff -r 343ca85103f2 -r ddd7829c45b1 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java Wed Nov 12 10:56:21 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotCodeCacheProvider.java Wed Nov 12 12:55:21 2014 +0100 @@ -145,7 +145,38 @@ hcf.addComment(mark.pcOffset, MarkId.getEnum((int) mark.id).toString()); } } - return hcf.toEmbeddedString(); + String hcfEmbeddedString = hcf.toEmbeddedString(); + return HexCodeFileDisTool.tryDisassemble(hcfEmbeddedString); + } + + /** + * Interface to the tool for disassembling an {@link HexCodeFile#toEmbeddedString() embedded} + * {@link HexCodeFile}. + */ + static class HexCodeFileDisTool { + static final Method processMethod; + static { + Method toolMethod = null; + try { + Class toolClass = Class.forName("com.oracle.max.hcfdis.HexCodeFileDis", true, ClassLoader.getSystemClassLoader()); + toolMethod = toolClass.getDeclaredMethod("processEmbeddedString", String.class); + } catch (Exception e) { + // Tool not available on the class path + } + processMethod = toolMethod; + } + + public static String tryDisassemble(String hcfEmbeddedString) { + if (processMethod != null) { + try { + return (String) processMethod.invoke(null, hcfEmbeddedString); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + // If the tool is available, for now let's be noisy when it fails + throw new GraalInternalError(e); + } + } + return hcfEmbeddedString; + } } /** diff -r 343ca85103f2 -r ddd7829c45b1 mx/mx_graal.py --- a/mx/mx_graal.py Wed Nov 12 10:56:21 2014 +0100 +++ b/mx/mx_graal.py Wed Nov 12 12:55:21 2014 +0100 @@ -1146,7 +1146,8 @@ if testfile is None: (_, testfile) = tempfile.mkstemp(".testclasses", "graal") os.close(_) - coreCp = mx.classpath(['com.oracle.graal.test']) + + coreCp = mx.classpath(['com.oracle.graal.test', 'HCFDIS']) coreArgs = [] if verbose: