Mercurial > hg > truffle
annotate src/share/vm/interpreter/bytecodeStream.cpp @ 21836:b517d3a9aebf jdk8u31-b31
Merge
author | asaha |
---|---|
date | Thu, 18 Dec 2014 14:30:02 -0800 |
parents | 8012aa3ccede |
children |
rev | line source |
---|---|
0 | 1 /* |
2142 | 2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
470
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
470
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
470
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "interpreter/bytecodeStream.hpp" | |
27 #include "interpreter/bytecodes.hpp" | |
0 | 28 |
29 Bytecodes::Code RawBytecodeStream::raw_next_special(Bytecodes::Code code) { | |
30 assert(!is_last_bytecode(), "should have been checked"); | |
31 // set next bytecode position | |
413
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
32 address bcp = RawBytecodeStream::bcp(); |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
33 address end = method()->code_base() + end_bci(); |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
34 int l = Bytecodes::raw_special_length_at(bcp, end); |
0 | 35 if (l <= 0 || (_bci + l) > _end_bci) { |
36 code = Bytecodes::_illegal; | |
37 } else { | |
38 _next_bci += l; | |
39 assert(_bci < _next_bci, "length must be > 0"); | |
40 // set attributes | |
41 _is_wide = false; | |
42 // check for special (uncommon) cases | |
43 if (code == Bytecodes::_wide) { | |
413
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
44 if (bcp + 1 >= end) { |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
45 code = Bytecodes::_illegal; |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
46 } else { |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
47 code = (Bytecodes::Code)bcp[1]; |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
48 _is_wide = true; |
c7ec737733a6
6756528: Bytecodes::special_length_at reads past end of code buffer
kamg
parents:
0
diff
changeset
|
49 } |
0 | 50 } |
51 } | |
1565 | 52 _raw_code = code; |
0 | 53 return code; |
54 } | |
1565 | 55 |
56 #ifdef ASSERT | |
57 void BaseBytecodeStream::assert_raw_index_size(int size) const { | |
58 if (raw_code() == Bytecodes::_invokedynamic && is_raw()) { | |
59 // in raw mode, pretend indy is "bJJ__" | |
60 assert(size == 2, "raw invokedynamic instruction has 2-byte index only"); | |
61 } else { | |
2142 | 62 bytecode().assert_index_size(size, raw_code(), is_wide()); |
1565 | 63 } |
64 } | |
65 | |
66 void BaseBytecodeStream::assert_raw_stream(bool want_raw) const { | |
67 if (want_raw) { | |
68 assert( is_raw(), "this function only works on raw streams"); | |
69 } else { | |
70 assert(!is_raw(), "this function only works on non-raw streams"); | |
71 } | |
72 } | |
73 #endif //ASSERT |