Mercurial > hg > truffle
diff graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java @ 7558:223f645acb9b
added compilation rate measurements on top of existing metric/timer facility - enabled with -Dgraal.benchmark.compilation=true
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 25 Jan 2013 16:05:11 +0100 |
parents | 5e3d1a68664e |
children | 0b646334c5f7 |
line wrap: on
line diff
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Fri Jan 25 15:31:54 2013 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Fri Jan 25 16:05:11 2013 +0100 @@ -54,8 +54,11 @@ */ public final class GraphBuilderPhase extends Phase { - public static final Descriptor CREATE_NULL_POINTER_EXCEPTION = new Descriptor("createNullPointerException", true, Object.class); - public static final Descriptor CREATE_OUT_OF_BOUNDS_EXCEPTION = new Descriptor("createOutOfBoundsException", true, Object.class, int.class); + public static final class RuntimeCalls { + + public static final Descriptor CREATE_NULL_POINTER_EXCEPTION = new Descriptor("createNullPointerException", true, Object.class); + public static final Descriptor CREATE_OUT_OF_BOUNDS_EXCEPTION = new Descriptor("createOutOfBoundsException", true, Object.class, int.class); + } /** * The minimum value to which {@link GraalOptions#TraceBytecodeParserLevel} must be set to trace @@ -94,6 +97,11 @@ private long graphId; /** + * Meters the number of actual bytecodes parsed. + */ + public static final DebugMetric BytecodesParsed = Debug.metric("BytecodesParsed"); + + /** * Node that marks the begin of block during bytecode parsing. When a block is identified the * first time as a jump target, the placeholder is created and used as the successor for the * jump. When the block is seen the second time, a MergeNode is created to correctly merge the @@ -833,7 +841,7 @@ ValueNode exception = ConstantNode.forObject(cachedNullPointerException, runtime, currentGraph); trueSucc.setNext(handleException(exception, bci())); } else { - RuntimeCallNode call = currentGraph.add(new RuntimeCallNode(CREATE_NULL_POINTER_EXCEPTION)); + RuntimeCallNode call = currentGraph.add(new RuntimeCallNode(RuntimeCalls.CREATE_NULL_POINTER_EXCEPTION)); call.setStateAfter(frameState.create(bci())); trueSucc.setNext(call); call.setNext(handleException(call, bci())); @@ -859,7 +867,7 @@ ValueNode exception = ConstantNode.forObject(cachedArrayIndexOutOfBoundsException, runtime, currentGraph); falseSucc.setNext(handleException(exception, bci())); } else { - RuntimeCallNode call = currentGraph.add(new RuntimeCallNode(CREATE_OUT_OF_BOUNDS_EXCEPTION, index)); + RuntimeCallNode call = currentGraph.add(new RuntimeCallNode(RuntimeCalls.CREATE_OUT_OF_BOUNDS_EXCEPTION, index)); call.setStateAfter(frameState.create(bci())); falseSucc.setNext(call); call.setNext(handleException(call, bci())); @@ -1587,6 +1595,8 @@ stream.setBCI(block.startBci); int bci = block.startBci; + BytecodesParsed.add(block.endBci - bci); + while (bci < endBCI) { // read the opcode int opcode = stream.currentBC();