< prev index next >

src/hotspot/share/interpreter/bytecode.hpp

Print this page




 112     return *(jbyte*)addr_at(offset);
 113   }
 114   int get_constant_u2(int offset, Bytecodes::Code bc, bool is_wide = false) const {
 115     assert_same_format_as(bc, is_wide); assert_constant_size(2, offset, bc, is_wide);
 116     return (jshort) Bytes::get_Java_u2(addr_at(offset));
 117   }
 118 
 119   // These are used locally and also from bytecode streams.
 120   void assert_same_format_as(Bytecodes::Code testbc, bool is_wide = false) const NOT_DEBUG_RETURN;
 121   static void assert_index_size(int required_size, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN;
 122   static void assert_offset_size(int required_size, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN;
 123   static void assert_constant_size(int required_size, int where, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN;
 124   static void assert_native_index(Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN;
 125   static bool can_use_native_byte_order(Bytecodes::Code bc, bool is_wide = false) {
 126     return (!Endian::is_Java_byte_ordering_different() || Bytecodes::native_byte_order(bc /*, is_wide*/));
 127   }
 128 };
 129 
 130 
 131 // Abstractions for lookupswitch bytecode
 132 class LookupswitchPair VALUE_OBJ_CLASS_SPEC {
 133  private:
 134   const address _bcp;
 135 
 136   address addr_at            (int offset)        const     { return _bcp + offset; }
 137   int     get_Java_u4_at     (int offset)        const     { return Bytes::get_Java_u4(addr_at(offset)); }
 138 
 139  public:
 140   LookupswitchPair(address bcp): _bcp(bcp) {}
 141   int  match() const                             { return get_Java_u4_at(0 * jintSize); }
 142   int  offset() const                            { return get_Java_u4_at(1 * jintSize); }
 143 };
 144 
 145 
 146 class Bytecode_lookupswitch: public Bytecode {
 147  public:
 148   Bytecode_lookupswitch(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
 149   // Defined in ciStreams.hpp
 150   inline Bytecode_lookupswitch(const ciBytecodeStream* stream);
 151   void verify() const PRODUCT_RETURN;
 152 




 112     return *(jbyte*)addr_at(offset);
 113   }
 114   int get_constant_u2(int offset, Bytecodes::Code bc, bool is_wide = false) const {
 115     assert_same_format_as(bc, is_wide); assert_constant_size(2, offset, bc, is_wide);
 116     return (jshort) Bytes::get_Java_u2(addr_at(offset));
 117   }
 118 
 119   // These are used locally and also from bytecode streams.
 120   void assert_same_format_as(Bytecodes::Code testbc, bool is_wide = false) const NOT_DEBUG_RETURN;
 121   static void assert_index_size(int required_size, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN;
 122   static void assert_offset_size(int required_size, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN;
 123   static void assert_constant_size(int required_size, int where, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN;
 124   static void assert_native_index(Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN;
 125   static bool can_use_native_byte_order(Bytecodes::Code bc, bool is_wide = false) {
 126     return (!Endian::is_Java_byte_ordering_different() || Bytecodes::native_byte_order(bc /*, is_wide*/));
 127   }
 128 };
 129 
 130 
 131 // Abstractions for lookupswitch bytecode
 132 class LookupswitchPair {
 133  private:
 134   const address _bcp;
 135 
 136   address addr_at            (int offset)        const     { return _bcp + offset; }
 137   int     get_Java_u4_at     (int offset)        const     { return Bytes::get_Java_u4(addr_at(offset)); }
 138 
 139  public:
 140   LookupswitchPair(address bcp): _bcp(bcp) {}
 141   int  match() const                             { return get_Java_u4_at(0 * jintSize); }
 142   int  offset() const                            { return get_Java_u4_at(1 * jintSize); }
 143 };
 144 
 145 
 146 class Bytecode_lookupswitch: public Bytecode {
 147  public:
 148   Bytecode_lookupswitch(Method* method, address bcp): Bytecode(method, bcp) { verify(); }
 149   // Defined in ciStreams.hpp
 150   inline Bytecode_lookupswitch(const ciBytecodeStream* stream);
 151   void verify() const PRODUCT_RETURN;
 152 


< prev index next >