src/share/vm/oops/instanceKlass.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File classload.01 Sdiff src/share/vm/oops

src/share/vm/oops/instanceKlass.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2015, 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_OOPS_INSTANCEKLASS_HPP
  26 #define SHARE_VM_OOPS_INSTANCEKLASS_HPP
  27 
  28 #include "classfile/classLoaderData.hpp"
  29 #include "gc/shared/specialized_oop_closures.hpp"

  30 #include "memory/referenceType.hpp"
  31 #include "oops/annotations.hpp"
  32 #include "oops/constMethod.hpp"
  33 #include "oops/fieldInfo.hpp"
  34 #include "oops/instanceOop.hpp"
  35 #include "oops/klassVtable.hpp"
  36 #include "runtime/handles.hpp"
  37 #include "runtime/os.hpp"
  38 #include "trace/traceMacros.hpp"
  39 #include "utilities/accessFlags.hpp"
  40 #include "utilities/bitMap.inline.hpp"
  41 #include "utilities/macros.hpp"
  42 
  43 // An InstanceKlass is the VM level representation of a Java class.
  44 // It contains all information needed for at class at execution runtime.
  45 
  46 //  InstanceKlass embedded field layout (after declared fields):
  47 //    [EMBEDDED Java vtable             ] size in words = vtable_len
  48 //    [EMBEDDED nonstatic oop-map blocks] size in words = nonstatic_oop_map_size
  49 //      The embedded nonstatic oop-map blocks are short pairs (offset, length)


1239 #ifndef PRODUCT
1240   void print_on(outputStream* st) const;
1241 #endif
1242   void print_value_on(outputStream* st) const;
1243 
1244   void oop_print_value_on(oop obj, outputStream* st);
1245 
1246 #ifndef PRODUCT
1247   void oop_print_on      (oop obj, outputStream* st);
1248 
1249   void print_dependent_nmethods(bool verbose = false);
1250   bool is_dependent_nmethod(nmethod* nm);
1251 #endif
1252 
1253   const char* internal_name() const;
1254 
1255   // Verification
1256   void verify_on(outputStream* st);
1257 
1258   void oop_verify_on(oop obj, outputStream* st);



1259 };
1260 
1261 inline Method* InstanceKlass::method_at_vtable(int index)  {
1262 #ifndef PRODUCT
1263   assert(index >= 0, "valid vtable index");
1264   if (DebugVtables) {
1265     verify_vtable_index(index);
1266   }
1267 #endif
1268   vtableEntry* ve = (vtableEntry*)start_of_vtable();
1269   return ve[index].method();
1270 }
1271 
1272 // for adding methods
1273 // UNSET_IDNUM return means no more ids available
1274 inline u2 InstanceKlass::next_method_idnum() {
1275   if (_idnum_allocated_count == ConstMethod::MAX_IDNUM) {
1276     return ConstMethod::UNSET_IDNUM; // no more ids available
1277   } else {
1278     return _idnum_allocated_count++;


   1 /*
   2  * Copyright (c) 1997, 2016, 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_OOPS_INSTANCEKLASS_HPP
  26 #define SHARE_VM_OOPS_INSTANCEKLASS_HPP
  27 
  28 #include "classfile/classLoaderData.hpp"
  29 #include "gc/shared/specialized_oop_closures.hpp"
  30 #include "logging/logLevel.hpp"
  31 #include "memory/referenceType.hpp"
  32 #include "oops/annotations.hpp"
  33 #include "oops/constMethod.hpp"
  34 #include "oops/fieldInfo.hpp"
  35 #include "oops/instanceOop.hpp"
  36 #include "oops/klassVtable.hpp"
  37 #include "runtime/handles.hpp"
  38 #include "runtime/os.hpp"
  39 #include "trace/traceMacros.hpp"
  40 #include "utilities/accessFlags.hpp"
  41 #include "utilities/bitMap.inline.hpp"
  42 #include "utilities/macros.hpp"
  43 
  44 // An InstanceKlass is the VM level representation of a Java class.
  45 // It contains all information needed for at class at execution runtime.
  46 
  47 //  InstanceKlass embedded field layout (after declared fields):
  48 //    [EMBEDDED Java vtable             ] size in words = vtable_len
  49 //    [EMBEDDED nonstatic oop-map blocks] size in words = nonstatic_oop_map_size
  50 //      The embedded nonstatic oop-map blocks are short pairs (offset, length)


1240 #ifndef PRODUCT
1241   void print_on(outputStream* st) const;
1242 #endif
1243   void print_value_on(outputStream* st) const;
1244 
1245   void oop_print_value_on(oop obj, outputStream* st);
1246 
1247 #ifndef PRODUCT
1248   void oop_print_on      (oop obj, outputStream* st);
1249 
1250   void print_dependent_nmethods(bool verbose = false);
1251   bool is_dependent_nmethod(nmethod* nm);
1252 #endif
1253 
1254   const char* internal_name() const;
1255 
1256   // Verification
1257   void verify_on(outputStream* st);
1258 
1259   void oop_verify_on(oop obj, outputStream* st);
1260 
1261   // Logging
1262   void print_loading_log(LogLevel::type type, ClassLoaderData* loader_data, const ClassFileStream* cfs) const;
1263 };
1264 
1265 inline Method* InstanceKlass::method_at_vtable(int index)  {
1266 #ifndef PRODUCT
1267   assert(index >= 0, "valid vtable index");
1268   if (DebugVtables) {
1269     verify_vtable_index(index);
1270   }
1271 #endif
1272   vtableEntry* ve = (vtableEntry*)start_of_vtable();
1273   return ve[index].method();
1274 }
1275 
1276 // for adding methods
1277 // UNSET_IDNUM return means no more ids available
1278 inline u2 InstanceKlass::next_method_idnum() {
1279   if (_idnum_allocated_count == ConstMethod::MAX_IDNUM) {
1280     return ConstMethod::UNSET_IDNUM; // no more ids available
1281   } else {
1282     return _idnum_allocated_count++;


src/share/vm/oops/instanceKlass.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File