src/share/vm/interpreter/bytecode.hpp

Print this page
rev 6670 : 8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
Reviewed-by: lfoltan, coleenp, dholmes
   1 /*
   2  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
   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  *
  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 #ifdef TARGET_ARCH_x86
  32 # include "bytes_x86.hpp"
  33 #endif
  34 #ifdef TARGET_ARCH_sparc
  35 # include "bytes_sparc.hpp"
  36 #endif
  37 #ifdef TARGET_ARCH_zero
  38 # include "bytes_zero.hpp"
  39 #endif
  40 #ifdef TARGET_ARCH_arm
  41 # include "bytes_arm.hpp"
  42 #endif
  43 #ifdef TARGET_ARCH_ppc
  44 # include "bytes_ppc.hpp"
  45 #endif
  46 
  47 class ciBytecodeStream;
  48 
  49 // The base class for different kinds of bytecode abstractions.
  50 // Provides the primitive operations to manipulate code relative
  51 // to the bcp.
  52 
  53 class Bytecode: public StackObj {
  54  protected:
  55   const address   _bcp;
  56   const Bytecodes::Code _code;
  57 
  58   // Address computation
  59   address addr_at            (int offset)        const     { return (address)_bcp + offset; }
  60   u_char byte_at(int offset) const               { return *addr_at(offset); }
  61   address aligned_addr_at    (int offset)        const     { return (address)round_to((intptr_t)addr_at(offset), jintSize); }
  62   int     aligned_offset     (int offset)        const     { return aligned_addr_at(offset) - addr_at(0); }
  63 
  64   // Word access:
  65   int     get_Java_u2_at     (int offset)        const     { return Bytes::get_Java_u2(addr_at(offset)); }


   1 /*
   2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
   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  *
  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 (address)round_to((intptr_t)addr_at(offset), jintSize); }
  48   int     aligned_offset     (int offset)        const     { return aligned_addr_at(offset) - addr_at(0); }
  49 
  50   // Word access:
  51   int     get_Java_u2_at     (int offset)        const     { return Bytes::get_Java_u2(addr_at(offset)); }