comparison jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/BytecodePosition.java @ 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 d64936a16a13
children c968119ee980
comparison
equal deleted inserted replaced
23767:edf3f2eb3b00 23768:be0d95e99204
48 public BytecodePosition(BytecodePosition caller, ResolvedJavaMethod method, int bci) { 48 public BytecodePosition(BytecodePosition caller, ResolvedJavaMethod method, int bci) {
49 assert method != null; 49 assert method != null;
50 this.caller = caller; 50 this.caller = caller;
51 this.method = method; 51 this.method = method;
52 this.bci = bci; 52 this.bci = bci;
53 if (bci >= method.getCodeSize()) { 53 /*
54 throw new IllegalArgumentException(); 54 * Make sure the bci is within range of the bytecodes. If the code size is 0 then allow any
55 * value, otherwise the bci must be less than the code size. Any negative value is also
56 * allowed to represent special bytecode states.
57 */
58 int codeSize = method.getCodeSize();
59 if (codeSize != 0 && bci >= codeSize) {
60 throw new IllegalArgumentException(String.format("bci %d is out of range for %s %d bytes", bci, method.format("%H.%n(%p)"), codeSize));
55 } 61 }
56 } 62 }
57 63
58 /** 64 /**
59 * Converts this code position to a string representation. 65 * Converts this code position to a string representation.