src/share/vm/interpreter/bytecodeStream.cpp

changeset 848
c7ec737733a6
parent 435
a61af66fc99e
child 905
ad8c8ca4ab0f
equal deleted inserted replaced
845:8fb16f199266 848:c7ec737733a6
26 # include "incls/_bytecodeStream.cpp.incl" 26 # include "incls/_bytecodeStream.cpp.incl"
27 27
28 Bytecodes::Code RawBytecodeStream::raw_next_special(Bytecodes::Code code) { 28 Bytecodes::Code RawBytecodeStream::raw_next_special(Bytecodes::Code code) {
29 assert(!is_last_bytecode(), "should have been checked"); 29 assert(!is_last_bytecode(), "should have been checked");
30 // set next bytecode position 30 // set next bytecode position
31 address bcp = RawBytecodeStream::bcp(); 31 address bcp = RawBytecodeStream::bcp();
32 int l = Bytecodes::raw_special_length_at(bcp); 32 address end = method()->code_base() + end_bci();
33 int l = Bytecodes::raw_special_length_at(bcp, end);
33 if (l <= 0 || (_bci + l) > _end_bci) { 34 if (l <= 0 || (_bci + l) > _end_bci) {
34 code = Bytecodes::_illegal; 35 code = Bytecodes::_illegal;
35 } else { 36 } else {
36 _next_bci += l; 37 _next_bci += l;
37 assert(_bci < _next_bci, "length must be > 0"); 38 assert(_bci < _next_bci, "length must be > 0");
38 // set attributes 39 // set attributes
39 _is_wide = false; 40 _is_wide = false;
40 // check for special (uncommon) cases 41 // check for special (uncommon) cases
41 if (code == Bytecodes::_wide) { 42 if (code == Bytecodes::_wide) {
42 code = (Bytecodes::Code)bcp[1]; 43 if (bcp + 1 >= end) {
43 _is_wide = true; 44 code = Bytecodes::_illegal;
45 } else {
46 code = (Bytecodes::Code)bcp[1];
47 _is_wide = true;
48 }
44 } 49 }
45 } 50 }
46 _code = code; 51 _code = code;
47 return code; 52 return code;
48 } 53 }

mercurial