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