src/share/vm/classfile/stackMapTableFormat.hpp

Print this page




   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 // These classes represent the stack-map substructures described in the JVMS
  26 // (hence the non-conforming naming scheme).
  27 
  28 // These classes work with the types in their compressed form in-place (as they
  29 // would appear in the classfile).  No virtual methods or fields allowed.
  30 
  31 class verification_type_info {
  32  private:
  33   // u1 tag
  34   // u2 cpool_index || u2 bci (for ITEM_Object & ITEM_Uninitailized only)
  35 
  36   address tag_addr() const { return (address)this; }
  37   address cpool_index_addr() const { return tag_addr() + sizeof(u1); }
  38   address bci_addr() const { return cpool_index_addr(); }
  39 
  40  protected:
  41   // No constructors  - should be 'private', but GCC issues a warning if it is
  42   verification_type_info() {}
  43   verification_type_info(const verification_type_info&) {}
  44 


 897   u2 number_of_entries() const {
 898       return Bytes::get_Java_u2(number_of_entries_addr()); }
 899   stack_map_frame* entries() const {
 900     return stack_map_frame::at(entries_addr());
 901   }
 902 
 903   static size_t header_size() {
 904       return sizeof(u2) + sizeof(u4);
 905   }
 906 
 907   void set_name_index(u2 idx) {
 908     Bytes::put_Java_u2(name_index_addr(), idx);
 909   }
 910   void set_attribute_length(u4 len) {
 911     Bytes::put_Java_u4(attribute_length_addr(), len);
 912   }
 913   void set_number_of_entries(u2 num) {
 914     Bytes::put_Java_u2(number_of_entries_addr(), num);
 915   }
 916 };




   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_CLASSFILE_STACKMAPTABLEFORMAT_HPP
  26 #define SHARE_VM_CLASSFILE_STACKMAPTABLEFORMAT_HPP
  27 
  28 #include "classfile/verificationType.hpp"
  29 
  30 // These classes represent the stack-map substructures described in the JVMS
  31 // (hence the non-conforming naming scheme).
  32 
  33 // These classes work with the types in their compressed form in-place (as they
  34 // would appear in the classfile).  No virtual methods or fields allowed.
  35 
  36 class verification_type_info {
  37  private:
  38   // u1 tag
  39   // u2 cpool_index || u2 bci (for ITEM_Object & ITEM_Uninitailized only)
  40 
  41   address tag_addr() const { return (address)this; }
  42   address cpool_index_addr() const { return tag_addr() + sizeof(u1); }
  43   address bci_addr() const { return cpool_index_addr(); }
  44 
  45  protected:
  46   // No constructors  - should be 'private', but GCC issues a warning if it is
  47   verification_type_info() {}
  48   verification_type_info(const verification_type_info&) {}
  49 


 902   u2 number_of_entries() const {
 903       return Bytes::get_Java_u2(number_of_entries_addr()); }
 904   stack_map_frame* entries() const {
 905     return stack_map_frame::at(entries_addr());
 906   }
 907 
 908   static size_t header_size() {
 909       return sizeof(u2) + sizeof(u4);
 910   }
 911 
 912   void set_name_index(u2 idx) {
 913     Bytes::put_Java_u2(name_index_addr(), idx);
 914   }
 915   void set_attribute_length(u4 len) {
 916     Bytes::put_Java_u4(attribute_length_addr(), len);
 917   }
 918   void set_number_of_entries(u2 num) {
 919     Bytes::put_Java_u2(number_of_entries_addr(), num);
 920   }
 921 };
 922 
 923 #endif // SHARE_VM_CLASSFILE_STACKMAPTABLEFORMAT_HPP