Mercurial > hg > graal-jvmci-8
changeset 19460:f04d2a9f2020
Assert that current bci points to an if Java bytecode when branch taken probability is requested.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 17 Feb 2015 23:39:41 +0100 |
parents | dd9811d734e1 |
children | 501d2d0778c3 |
files | graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java |
diffstat | 1 files changed, 26 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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) {