# HG changeset patch # User Thomas Wuerthinger # Date 1424212781 -3600 # Node ID f04d2a9f2020e48c6cf90aae606b9aa2f4a065fa # Parent dd9811d734e15f5e11eb9c8825eb2cbd75bb80b2 Assert that current bci points to an if Java bytecode when branch taken probability is requested. diff -r dd9811d734e1 -r f04d2a9f2020 graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java Tue Feb 17 23:31:15 2015 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java Tue Feb 17 23:39:41 2015 +0100 @@ -913,6 +913,7 @@ if (profilingInfo == null) { return 0.5; } + assert assertAtIfBytecode(); double probability = profilingInfo.getBranchTakenProbability(bci()); if (probability < 0) { assert probability == -1 : "invalid probability"; @@ -930,6 +931,31 @@ return probability; } + private boolean assertAtIfBytecode() { + int bytecode = stream.currentBC(); + switch (bytecode) { + case IFEQ: + case IFNE: + case IFLT: + case IFGE: + case IFGT: + case IFLE: + case IF_ICMPEQ: + case IF_ICMPNE: + case IF_ICMPLT: + case IF_ICMPGE: + case IF_ICMPGT: + case IF_ICMPLE: + case IF_ACMPEQ: + case IF_ACMPNE: + case IFNULL: + case IFNONNULL: + return true; + } + assert false : String.format("%x is not an if bytecode", bytecode); + return true; + } + protected abstract void iterateBytecodesForBlock(BciBlock block); public final void processBytecode(int bci, int opcode) {