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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_INTERPRETER_BYTECODE_HPP
26 #define SHARE_VM_INTERPRETER_BYTECODE_HPP
27
28 #include "interpreter/bytecodes.hpp"
29 #include "memory/allocation.hpp"
30 #include "oops/method.hpp"
31 #include "utilities/bytes.hpp"
32
33 class ciBytecodeStream;
34
35 // The base class for different kinds of bytecode abstractions.
36 // Provides the primitive operations to manipulate code relative
37 // to the bcp.
38
39 class Bytecode: public StackObj {
40 protected:
41 const address _bcp;
42 const Bytecodes::Code _code;
43
44 // Address computation
45 address addr_at (int offset) const { return (address)_bcp + offset; }
46 u_char byte_at(int offset) const { return *addr_at(offset); }
47 address aligned_addr_at (int offset) const { return align_up(addr_at(offset), jintSize); }
48
49 // Word access:
50 int get_Java_u2_at (int offset) const { return Bytes::get_Java_u2(addr_at(offset)); }
|
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_INTERPRETER_BYTECODE_HPP
26 #define SHARE_VM_INTERPRETER_BYTECODE_HPP
27
28 #include "interpreter/bytecodes.hpp"
29 #include "memory/allocation.hpp"
30 #include "oops/method.hpp"
31 #include "utilities/align.hpp"
32 #include "utilities/bytes.hpp"
33
34 class ciBytecodeStream;
35
36 // The base class for different kinds of bytecode abstractions.
37 // Provides the primitive operations to manipulate code relative
38 // to the bcp.
39
40 class Bytecode: public StackObj {
41 protected:
42 const address _bcp;
43 const Bytecodes::Code _code;
44
45 // Address computation
46 address addr_at (int offset) const { return (address)_bcp + offset; }
47 u_char byte_at(int offset) const { return *addr_at(offset); }
48 address aligned_addr_at (int offset) const { return align_up(addr_at(offset), jintSize); }
49
50 // Word access:
51 int get_Java_u2_at (int offset) const { return Bytes::get_Java_u2(addr_at(offset)); }
|