Mercurial > hg > graal-jvmci-8
changeset 23768:be0d95e99204 jvmci-0.21
illegal bci in BytecodePosition causes IllegalArgumentException
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 29 Sep 2016 09:57:56 +0200 |
parents | edf3f2eb3b00 |
children | fec796c53d53 |
files | jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodePosition.java |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodePosition.java Wed Sep 28 16:39:44 2016 -0700 +++ b/jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodePosition.java Thu Sep 29 09:57:56 2016 +0200 @@ -50,8 +50,14 @@ this.caller = caller; this.method = method; this.bci = bci; - if (bci >= method.getCodeSize()) { - throw new IllegalArgumentException(); + /* + * Make sure the bci is within range of the bytecodes. If the code size is 0 then allow any + * value, otherwise the bci must be less than the code size. Any negative value is also + * allowed to represent special bytecode states. + */ + int codeSize = method.getCodeSize(); + if (codeSize != 0 && bci >= codeSize) { + throw new IllegalArgumentException(String.format("bci %d is out of range for %s %d bytes", bci, method.format("%H.%n(%p)"), codeSize)); } }