8031820: NPG: Fix remaining references to metadata as oops in comments
8012125: Comments for ConstantPoolCache should reflect the addition of resolved_references in ConstantPool
Summary: Updated comments in metadata header files, and renamed this_oop variables to this_cp or this_k when referring to constant pool or classes.
Reviewed-by: stefank, jmasa
--- a/hotspot/src/share/vm/memory/filemap.hpp Tue Mar 25 09:26:18 2014 -0400
+++ b/hotspot/src/share/vm/memory/filemap.hpp Wed Mar 26 21:47:45 2014 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,8 @@
// header: dump of archive instance plus versioning info, datestamp, etc.
// [magic # = 0xF00BABA2]
// ... padding to align on page-boundary
-// read-write space from CompactingPermGenGen
-// read-only space from CompactingPermGenGen
+// read-write space
+// read-only space
// misc data (block offset table, string table, symbols, dictionary, etc.)
// tag(666)
--- a/hotspot/src/share/vm/oops/constMethod.hpp Tue Mar 25 09:26:18 2014 -0400
+++ b/hotspot/src/share/vm/oops/constMethod.hpp Wed Mar 26 21:47:45 2014 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,68 +27,61 @@
#include "oops/oop.hpp"
-// An ConstMethod* represents portions of a Java method which
-// do not vary.
+// An ConstMethod represents portions of a Java method which are not written to after
+// the classfile is parsed(*see below). This part of the method can be shared across
+// processes in a read-only section with Class Data Sharing (CDS). It's important
+// that this class doesn't have virtual functions because the vptr cannot be shared
+// with CDS.
+// (*)RewriteByteCodes and RewriteFrequentPairs is an exception but turned off in CDS
//
-// Memory layout (each line represents a word). Note that most
-// applications load thousands of methods, so keeping the size of this
+// Note that most applications load thousands of methods, so keeping the size of this
// structure small has a big impact on footprint.
+
+// The actual bytecodes are inlined after the end of the ConstMethod struct.
+//
+// The line number table is compressed and inlined following the byte codes. It is
+// found as the first byte following the byte codes. Note that accessing the line
+// number and local variable tables is not performance critical at all.
+//
+// The checked exceptions table and the local variable table are inlined after the
+// line number table, and indexed from the end of the method. We do not compress the
+// checked exceptions table since the average length is less than 2, and it is used
+// by reflection so access should be fast. We do not bother to compress the local
+// variable table either since it is mostly absent.
+//
//
-// |------------------------------------------------------|
-// | header |
-// | klass |
-// |------------------------------------------------------|
-// | fingerprint 1 |
-// | fingerprint 2 |
-// | constants (oop) |
-// | stackmap_data (oop) |
-// | constMethod_size |
-// | interp_kind | flags | code_size |
-// | name index | signature index |
-// | method_idnum | max_stack |
-// | max_locals | size_of_parameters |
-// |------------------------------------------------------|
-// | |
-// | byte codes |
-// | |
-// |------------------------------------------------------|
-// | compressed linenumber table |
-// | (see class CompressedLineNumberReadStream) |
-// | (note that length is unknown until decompressed) |
-// | (access flags bit tells whether table is present) |
-// | (indexed from start of ConstMethod*) |
-// | (elements not necessarily sorted!) |
-// |------------------------------------------------------|
-// | localvariable table elements + length (length last) |
-// | (length is u2, elements are 6-tuples of u2) |
-// | (see class LocalVariableTableElement) |
-// | (access flags bit tells whether table is present) |
-// | (indexed from end of ConstMethod*) |
-// |------------------------------------------------------|
-// | exception table + length (length last) |
-// | (length is u2, elements are 4-tuples of u2) |
-// | (see class ExceptionTableElement) |
-// | (access flags bit tells whether table is present) |
-// | (indexed from end of ConstMethod*) |
-// |------------------------------------------------------|
-// | checked exceptions elements + length (length last) |
-// | (length is u2, elements are u2) |
-// | (see class CheckedExceptionElement) |
-// | (access flags bit tells whether table is present) |
-// | (indexed from end of ConstMethod*) |
-// |------------------------------------------------------|
-// | method parameters elements + length (length last) |
-// | (length is u2, elements are u2, u4 structures) |
-// | (see class MethodParametersElement) |
-// | (access flags bit tells whether table is present) |
-// | (indexed from end of ConstMethod*) |
-// |------------------------------------------------------|
-// | generic signature index (u2) |
-// | (indexed from start of constMethodOop) |
-// |------------------------------------------------------|
-// | annotations arrays - method, parameter, type, default|
-// | pointer to Array<u1> if annotation is present |
-// |------------------------------------------------------|
+// ConstMethod embedded field layout (after declared fields):
+// [EMBEDDED byte codes]
+// [EMBEDDED compressed linenumber table]
+// (see class CompressedLineNumberReadStream)
+// (note that length is unknown until decompressed)
+// (access flags bit tells whether table is present)
+// (indexed from start of ConstMethod)
+// (elements not necessarily sorted!)
+// [EMBEDDED localvariable table elements + length (length last)]
+// (length is u2, elements are 6-tuples of u2)
+// (see class LocalVariableTableElement)
+// (access flags bit tells whether table is present)
+// (indexed from end of ConstMethod*)
+// [EMBEDDED exception table + length (length last)]
+// (length is u2, elements are 4-tuples of u2)
+// (see class ExceptionTableElement)
+// (access flags bit tells whether table is present)
+// (indexed from end of ConstMethod*)
+// [EMBEDDED checked exceptions elements + length (length last)]
+// (length is u2, elements are u2)
+// (see class CheckedExceptionElement)
+// (access flags bit tells whether table is present)
+// (indexed from end of ConstMethod*)
+// [EMBEDDED method parameters elements + length (length last)]
+// (length is u2, elements are u2, u4 structures)
+// (see class MethodParametersElement)
+// (access flags bit tells whether table is present)
+// (indexed from end of ConstMethod*)
+// [EMBEDDED generic signature index (u2)]
+// (indexed from end of constMethodOop)
+// [EMBEDDED annotations arrays - method, parameter, type, default]
+// pointer to Array<u1> if annotation is present
//
// IMPORTANT: If anything gets added here, there need to be changes to
// ensure that ServicabilityAgent doesn't get broken as a result!
--- a/hotspot/src/share/vm/oops/constantPool.cpp Tue Mar 25 09:26:18 2014 -0400
+++ b/hotspot/src/share/vm/oops/constantPool.cpp Wed Mar 26 21:47:45 2014 -0400
@@ -180,12 +180,12 @@
return (i < 0) ? _no_index_sentinel : i;
}
-Klass* ConstantPool::klass_at_impl(constantPoolHandle this_oop, int which, TRAPS) {
+Klass* ConstantPool::klass_at_impl(constantPoolHandle this_cp, int which, TRAPS) {
// A resolved constantPool entry will contain a Klass*, otherwise a Symbol*.
// It is not safe to rely on the tag bit's here, since we don't have a lock, and the entry and
// tag is not updated atomicly.
- CPSlot entry = this_oop->slot_at(which);
+ CPSlot entry = this_cp->slot_at(which);
if (entry.is_resolved()) {
assert(entry.get_klass()->is_klass(), "must be");
// Already resolved - return entry.
@@ -204,15 +204,15 @@
Symbol* name = NULL;
Handle loader;
- { MonitorLockerEx ml(this_oop->lock());
+ { MonitorLockerEx ml(this_cp->lock());
- if (this_oop->tag_at(which).is_unresolved_klass()) {
- if (this_oop->tag_at(which).is_unresolved_klass_in_error()) {
+ if (this_cp->tag_at(which).is_unresolved_klass()) {
+ if (this_cp->tag_at(which).is_unresolved_klass_in_error()) {
in_error = true;
} else {
do_resolve = true;
- name = this_oop->unresolved_klass_at(which);
- loader = Handle(THREAD, this_oop->pool_holder()->class_loader());
+ name = this_cp->unresolved_klass_at(which);
+ loader = Handle(THREAD, this_cp->pool_holder()->class_loader());
}
}
} // unlocking constantPool
@@ -221,26 +221,26 @@
// The original attempt to resolve this constant pool entry failed so find the
// original error and throw it again (JVMS 5.4.3).
if (in_error) {
- Symbol* error = SystemDictionary::find_resolution_error(this_oop, which);
+ Symbol* error = SystemDictionary::find_resolution_error(this_cp, which);
guarantee(error != (Symbol*)NULL, "tag mismatch with resolution error table");
ResourceMark rm;
// exception text will be the class name
- const char* className = this_oop->unresolved_klass_at(which)->as_C_string();
+ const char* className = this_cp->unresolved_klass_at(which)->as_C_string();
THROW_MSG_0(error, className);
}
if (do_resolve) {
- // this_oop must be unlocked during resolve_or_fail
- oop protection_domain = this_oop->pool_holder()->protection_domain();
+ // this_cp must be unlocked during resolve_or_fail
+ oop protection_domain = this_cp->pool_holder()->protection_domain();
Handle h_prot (THREAD, protection_domain);
- Klass* k_oop = SystemDictionary::resolve_or_fail(name, loader, h_prot, true, THREAD);
+ Klass* kk = SystemDictionary::resolve_or_fail(name, loader, h_prot, true, THREAD);
KlassHandle k;
if (!HAS_PENDING_EXCEPTION) {
- k = KlassHandle(THREAD, k_oop);
+ k = KlassHandle(THREAD, kk);
// preserve the resolved klass.
- mirror_handle = Handle(THREAD, k_oop->java_mirror());
+ mirror_handle = Handle(THREAD, kk->java_mirror());
// Do access check for klasses
- verify_constant_pool_resolve(this_oop, k, THREAD);
+ verify_constant_pool_resolve(this_cp, k, THREAD);
}
// Failed to resolve class. We must record the errors so that subsequent attempts
@@ -251,12 +251,12 @@
bool throw_orig_error = false;
{
- MonitorLockerEx ml(this_oop->lock());
+ MonitorLockerEx ml(this_cp->lock());
// some other thread has beaten us and has resolved the class.
- if (this_oop->tag_at(which).is_klass()) {
+ if (this_cp->tag_at(which).is_klass()) {
CLEAR_PENDING_EXCEPTION;
- entry = this_oop->resolved_klass_at(which);
+ entry = this_cp->resolved_klass_at(which);
return entry.get_klass();
}
@@ -267,12 +267,12 @@
// and OutOfMemoryError, etc, or if the thread was hit by stop()
// Needs clarification to section 5.4.3 of the VM spec (see 6308271)
}
- else if (!this_oop->tag_at(which).is_unresolved_klass_in_error()) {
- SystemDictionary::add_resolution_error(this_oop, which, error);
- this_oop->tag_at_put(which, JVM_CONSTANT_UnresolvedClassInError);
+ else if (!this_cp->tag_at(which).is_unresolved_klass_in_error()) {
+ SystemDictionary::add_resolution_error(this_cp, which, error);
+ this_cp->tag_at_put(which, JVM_CONSTANT_UnresolvedClassInError);
} else {
// some other thread has put the class in error state.
- error = SystemDictionary::find_resolution_error(this_oop, which);
+ error = SystemDictionary::find_resolution_error(this_cp, which);
assert(error != NULL, "checking");
throw_orig_error = true;
}
@@ -281,7 +281,7 @@
if (throw_orig_error) {
CLEAR_PENDING_EXCEPTION;
ResourceMark rm;
- const char* className = this_oop->unresolved_klass_at(which)->as_C_string();
+ const char* className = this_cp->unresolved_klass_at(which)->as_C_string();
THROW_MSG_0(error, className);
}
@@ -305,32 +305,32 @@
}
}
}
- if (k() != this_oop->pool_holder()) {
+ if (k() != this_cp->pool_holder()) {
// only print something if the classes are different
if (source_file != NULL) {
tty->print("RESOLVE %s %s %s:%d\n",
- this_oop->pool_holder()->external_name(),
+ this_cp->pool_holder()->external_name(),
InstanceKlass::cast(k())->external_name(), source_file, line_number);
} else {
tty->print("RESOLVE %s %s\n",
- this_oop->pool_holder()->external_name(),
+ this_cp->pool_holder()->external_name(),
InstanceKlass::cast(k())->external_name());
}
}
return k();
} else {
- MonitorLockerEx ml(this_oop->lock());
+ MonitorLockerEx ml(this_cp->lock());
// Only updated constant pool - if it is resolved.
- do_resolve = this_oop->tag_at(which).is_unresolved_klass();
+ do_resolve = this_cp->tag_at(which).is_unresolved_klass();
if (do_resolve) {
- ClassLoaderData* this_key = this_oop->pool_holder()->class_loader_data();
+ ClassLoaderData* this_key = this_cp->pool_holder()->class_loader_data();
this_key->record_dependency(k(), CHECK_NULL); // Can throw OOM
- this_oop->klass_at_put(which, k());
+ this_cp->klass_at_put(which, k());
}
}
}
- entry = this_oop->resolved_klass_at(which);
+ entry = this_cp->resolved_klass_at(which);
assert(entry.is_resolved() && entry.get_klass()->is_klass(), "must be resolved at this point");
return entry.get_klass();
}
@@ -340,8 +340,8 @@
// by compiler and exception handling. Also used to avoid classloads for
// instanceof operations. Returns NULL if the class has not been loaded or
// if the verification of constant pool failed
-Klass* ConstantPool::klass_at_if_loaded(constantPoolHandle this_oop, int which) {
- CPSlot entry = this_oop->slot_at(which);
+Klass* ConstantPool::klass_at_if_loaded(constantPoolHandle this_cp, int which) {
+ CPSlot entry = this_cp->slot_at(which);
if (entry.is_resolved()) {
assert(entry.get_klass()->is_klass(), "must be");
return entry.get_klass();
@@ -349,8 +349,8 @@
assert(entry.is_unresolved(), "must be either symbol or klass");
Thread *thread = Thread::current();
Symbol* name = entry.get_symbol();
- oop loader = this_oop->pool_holder()->class_loader();
- oop protection_domain = this_oop->pool_holder()->protection_domain();
+ oop loader = this_cp->pool_holder()->class_loader();
+ oop protection_domain = this_cp->pool_holder()->protection_domain();
Handle h_prot (thread, protection_domain);
Handle h_loader (thread, loader);
Klass* k = SystemDictionary::find(name, h_loader, h_prot, thread);
@@ -360,7 +360,7 @@
EXCEPTION_MARK;
KlassHandle klass(THREAD, k);
// return NULL if verification fails
- verify_constant_pool_resolve(this_oop, klass, THREAD);
+ verify_constant_pool_resolve(this_cp, klass, THREAD);
if (HAS_PENDING_EXCEPTION) {
CLEAR_PENDING_EXCEPTION;
return NULL;
@@ -373,8 +373,8 @@
}
-Klass* ConstantPool::klass_ref_at_if_loaded(constantPoolHandle this_oop, int which) {
- return klass_at_if_loaded(this_oop, this_oop->klass_ref_index_at(which));
+Klass* ConstantPool::klass_ref_at_if_loaded(constantPoolHandle this_cp, int which) {
+ return klass_at_if_loaded(this_cp, this_cp->klass_ref_index_at(which));
}
@@ -486,11 +486,11 @@
}
-void ConstantPool::verify_constant_pool_resolve(constantPoolHandle this_oop, KlassHandle k, TRAPS) {
+void ConstantPool::verify_constant_pool_resolve(constantPoolHandle this_cp, KlassHandle k, TRAPS) {
if (k->oop_is_instance() || k->oop_is_objArray()) {
- instanceKlassHandle holder (THREAD, this_oop->pool_holder());
- Klass* elem_oop = k->oop_is_instance() ? k() : ObjArrayKlass::cast(k())->bottom_klass();
- KlassHandle element (THREAD, elem_oop);
+ instanceKlassHandle holder (THREAD, this_cp->pool_holder());
+ Klass* elem = k->oop_is_instance() ? k() : ObjArrayKlass::cast(k())->bottom_klass();
+ KlassHandle element (THREAD, elem);
// The element type could be a typeArray - we only need the access check if it is
// an reference to another class
@@ -559,10 +559,10 @@
}
-void ConstantPool::resolve_string_constants_impl(constantPoolHandle this_oop, TRAPS) {
- for (int index = 1; index < this_oop->length(); index++) { // Index 0 is unused
- if (this_oop->tag_at(index).is_string()) {
- this_oop->string_at(index, CHECK);
+void ConstantPool::resolve_string_constants_impl(constantPoolHandle this_cp, TRAPS) {
+ for (int index = 1; index < this_cp->length(); index++) { // Index 0 is unused
+ if (this_cp->tag_at(index).is_string()) {
+ this_cp->string_at(index, CHECK);
}
}
}
@@ -585,11 +585,11 @@
// If resolution for MethodHandle or MethodType fails, save the exception
// in the resolution error table, so that the same exception is thrown again.
-void ConstantPool::save_and_throw_exception(constantPoolHandle this_oop, int which,
+void ConstantPool::save_and_throw_exception(constantPoolHandle this_cp, int which,
int tag, TRAPS) {
ResourceMark rm;
Symbol* error = PENDING_EXCEPTION->klass()->name();
- MonitorLockerEx ml(this_oop->lock()); // lock cpool to change tag.
+ MonitorLockerEx ml(this_cp->lock()); // lock cpool to change tag.
int error_tag = (tag == JVM_CONSTANT_MethodHandle) ?
JVM_CONSTANT_MethodHandleInError : JVM_CONSTANT_MethodTypeInError;
@@ -601,12 +601,12 @@
// and OutOfMemoryError, etc, or if the thread was hit by stop()
// Needs clarification to section 5.4.3 of the VM spec (see 6308271)
- } else if (this_oop->tag_at(which).value() != error_tag) {
- SystemDictionary::add_resolution_error(this_oop, which, error);
- this_oop->tag_at_put(which, error_tag);
+ } else if (this_cp->tag_at(which).value() != error_tag) {
+ SystemDictionary::add_resolution_error(this_cp, which, error);
+ this_cp->tag_at_put(which, error_tag);
} else {
// some other thread has put the class in error state.
- error = SystemDictionary::find_resolution_error(this_oop, which);
+ error = SystemDictionary::find_resolution_error(this_cp, which);
assert(error != NULL, "checking");
CLEAR_PENDING_EXCEPTION;
THROW_MSG(error, "");
@@ -617,7 +617,7 @@
// Called to resolve constants in the constant pool and return an oop.
// Some constant pool entries cache their resolved oop. This is also
// called to create oops from constants to use in arguments for invokedynamic
-oop ConstantPool::resolve_constant_at_impl(constantPoolHandle this_oop, int index, int cache_index, TRAPS) {
+oop ConstantPool::resolve_constant_at_impl(constantPoolHandle this_cp, int index, int cache_index, TRAPS) {
oop result_oop = NULL;
Handle throw_exception;
@@ -625,23 +625,23 @@
// It is possible that this constant is one which is cached in the objects.
// We'll do a linear search. This should be OK because this usage is rare.
assert(index > 0, "valid index");
- cache_index = this_oop->cp_to_object_index(index);
+ cache_index = this_cp->cp_to_object_index(index);
}
assert(cache_index == _no_index_sentinel || cache_index >= 0, "");
assert(index == _no_index_sentinel || index >= 0, "");
if (cache_index >= 0) {
- result_oop = this_oop->resolved_references()->obj_at(cache_index);
+ result_oop = this_cp->resolved_references()->obj_at(cache_index);
if (result_oop != NULL) {
return result_oop;
// That was easy...
}
- index = this_oop->object_to_cp_index(cache_index);
+ index = this_cp->object_to_cp_index(cache_index);
}
jvalue prim_value; // temp used only in a few cases below
- int tag_value = this_oop->tag_at(index).value();
+ int tag_value = this_cp->tag_at(index).value();
switch (tag_value) {
@@ -650,7 +650,7 @@
case JVM_CONSTANT_Class:
{
assert(cache_index == _no_index_sentinel, "should not have been set");
- Klass* resolved = klass_at_impl(this_oop, index, CHECK_NULL);
+ Klass* resolved = klass_at_impl(this_cp, index, CHECK_NULL);
// ldc wants the java mirror.
result_oop = resolved->java_mirror();
break;
@@ -658,17 +658,17 @@
case JVM_CONSTANT_String:
assert(cache_index != _no_index_sentinel, "should have been set");
- if (this_oop->is_pseudo_string_at(index)) {
- result_oop = this_oop->pseudo_string_at(index, cache_index);
+ if (this_cp->is_pseudo_string_at(index)) {
+ result_oop = this_cp->pseudo_string_at(index, cache_index);
break;
}
- result_oop = string_at_impl(this_oop, index, cache_index, CHECK_NULL);
+ result_oop = string_at_impl(this_cp, index, cache_index, CHECK_NULL);
break;
case JVM_CONSTANT_MethodHandleInError:
case JVM_CONSTANT_MethodTypeInError:
{
- Symbol* error = SystemDictionary::find_resolution_error(this_oop, index);
+ Symbol* error = SystemDictionary::find_resolution_error(this_cp, index);
guarantee(error != (Symbol*)NULL, "tag mismatch with resolution error table");
ResourceMark rm;
THROW_MSG_0(error, "");
@@ -677,72 +677,72 @@
case JVM_CONSTANT_MethodHandle:
{
- int ref_kind = this_oop->method_handle_ref_kind_at(index);
- int callee_index = this_oop->method_handle_klass_index_at(index);
- Symbol* name = this_oop->method_handle_name_ref_at(index);
- Symbol* signature = this_oop->method_handle_signature_ref_at(index);
+ int ref_kind = this_cp->method_handle_ref_kind_at(index);
+ int callee_index = this_cp->method_handle_klass_index_at(index);
+ Symbol* name = this_cp->method_handle_name_ref_at(index);
+ Symbol* signature = this_cp->method_handle_signature_ref_at(index);
if (PrintMiscellaneous)
tty->print_cr("resolve JVM_CONSTANT_MethodHandle:%d [%d/%d/%d] %s.%s",
- ref_kind, index, this_oop->method_handle_index_at(index),
+ ref_kind, index, this_cp->method_handle_index_at(index),
callee_index, name->as_C_string(), signature->as_C_string());
KlassHandle callee;
- { Klass* k = klass_at_impl(this_oop, callee_index, CHECK_NULL);
+ { Klass* k = klass_at_impl(this_cp, callee_index, CHECK_NULL);
callee = KlassHandle(THREAD, k);
}
- KlassHandle klass(THREAD, this_oop->pool_holder());
+ KlassHandle klass(THREAD, this_cp->pool_holder());
Handle value = SystemDictionary::link_method_handle_constant(klass, ref_kind,
callee, name, signature,
THREAD);
result_oop = value();
if (HAS_PENDING_EXCEPTION) {
- save_and_throw_exception(this_oop, index, tag_value, CHECK_NULL);
+ save_and_throw_exception(this_cp, index, tag_value, CHECK_NULL);
}
break;
}
case JVM_CONSTANT_MethodType:
{
- Symbol* signature = this_oop->method_type_signature_at(index);
+ Symbol* signature = this_cp->method_type_signature_at(index);
if (PrintMiscellaneous)
tty->print_cr("resolve JVM_CONSTANT_MethodType [%d/%d] %s",
- index, this_oop->method_type_index_at(index),
+ index, this_cp->method_type_index_at(index),
signature->as_C_string());
- KlassHandle klass(THREAD, this_oop->pool_holder());
+ KlassHandle klass(THREAD, this_cp->pool_holder());
Handle value = SystemDictionary::find_method_handle_type(signature, klass, THREAD);
result_oop = value();
if (HAS_PENDING_EXCEPTION) {
- save_and_throw_exception(this_oop, index, tag_value, CHECK_NULL);
+ save_and_throw_exception(this_cp, index, tag_value, CHECK_NULL);
}
break;
}
case JVM_CONSTANT_Integer:
assert(cache_index == _no_index_sentinel, "should not have been set");
- prim_value.i = this_oop->int_at(index);
+ prim_value.i = this_cp->int_at(index);
result_oop = java_lang_boxing_object::create(T_INT, &prim_value, CHECK_NULL);
break;
case JVM_CONSTANT_Float:
assert(cache_index == _no_index_sentinel, "should not have been set");
- prim_value.f = this_oop->float_at(index);
+ prim_value.f = this_cp->float_at(index);
result_oop = java_lang_boxing_object::create(T_FLOAT, &prim_value, CHECK_NULL);
break;
case JVM_CONSTANT_Long:
assert(cache_index == _no_index_sentinel, "should not have been set");
- prim_value.j = this_oop->long_at(index);
+ prim_value.j = this_cp->long_at(index);
result_oop = java_lang_boxing_object::create(T_LONG, &prim_value, CHECK_NULL);
break;
case JVM_CONSTANT_Double:
assert(cache_index == _no_index_sentinel, "should not have been set");
- prim_value.d = this_oop->double_at(index);
+ prim_value.d = this_cp->double_at(index);
result_oop = java_lang_boxing_object::create(T_DOUBLE, &prim_value, CHECK_NULL);
break;
default:
DEBUG_ONLY( tty->print_cr("*** %p: tag at CP[%d/%d] = %d",
- this_oop(), index, cache_index, tag_value) );
+ this_cp(), index, cache_index, tag_value) );
assert(false, "unexpected constant tag");
break;
}
@@ -750,15 +750,15 @@
if (cache_index >= 0) {
// Cache the oop here also.
Handle result_handle(THREAD, result_oop);
- MonitorLockerEx ml(this_oop->lock()); // don't know if we really need this
- oop result = this_oop->resolved_references()->obj_at(cache_index);
+ MonitorLockerEx ml(this_cp->lock()); // don't know if we really need this
+ oop result = this_cp->resolved_references()->obj_at(cache_index);
// Benign race condition: resolved_references may already be filled in while we were trying to lock.
// The important thing here is that all threads pick up the same result.
// It doesn't matter which racing thread wins, as long as only one
// result is used by all threads, and all future queries.
// That result may be either a resolved constant or a failure exception.
if (result == NULL) {
- this_oop->resolved_references()->obj_at_put(cache_index, result_handle());
+ this_cp->resolved_references()->obj_at_put(cache_index, result_handle());
return result_handle();
} else {
// Return the winning thread's result. This can be different than
@@ -778,8 +778,8 @@
}
-oop ConstantPool::resolve_bootstrap_specifier_at_impl(constantPoolHandle this_oop, int index, TRAPS) {
- assert(this_oop->tag_at(index).is_invoke_dynamic(), "Corrupted constant pool");
+oop ConstantPool::resolve_bootstrap_specifier_at_impl(constantPoolHandle this_cp, int index, TRAPS) {
+ assert(this_cp->tag_at(index).is_invoke_dynamic(), "Corrupted constant pool");
Handle bsm;
int argc;
@@ -787,14 +787,14 @@
// JVM_CONSTANT_InvokeDynamic is an ordered pair of [bootm, name&type], plus optional arguments
// The bootm, being a JVM_CONSTANT_MethodHandle, has its own cache entry.
// It is accompanied by the optional arguments.
- int bsm_index = this_oop->invoke_dynamic_bootstrap_method_ref_index_at(index);
- oop bsm_oop = this_oop->resolve_possibly_cached_constant_at(bsm_index, CHECK_NULL);
+ int bsm_index = this_cp->invoke_dynamic_bootstrap_method_ref_index_at(index);
+ oop bsm_oop = this_cp->resolve_possibly_cached_constant_at(bsm_index, CHECK_NULL);
if (!java_lang_invoke_MethodHandle::is_instance(bsm_oop)) {
THROW_MSG_NULL(vmSymbols::java_lang_LinkageError(), "BSM not an MethodHandle");
}
// Extract the optional static arguments.
- argc = this_oop->invoke_dynamic_argument_count_at(index);
+ argc = this_cp->invoke_dynamic_argument_count_at(index);
if (argc == 0) return bsm_oop;
bsm = Handle(THREAD, bsm_oop);
@@ -808,21 +808,21 @@
info->obj_at_put(0, bsm());
for (int i = 0; i < argc; i++) {
- int arg_index = this_oop->invoke_dynamic_argument_index_at(index, i);
- oop arg_oop = this_oop->resolve_possibly_cached_constant_at(arg_index, CHECK_NULL);
+ int arg_index = this_cp->invoke_dynamic_argument_index_at(index, i);
+ oop arg_oop = this_cp->resolve_possibly_cached_constant_at(arg_index, CHECK_NULL);
info->obj_at_put(1+i, arg_oop);
}
return info();
}
-oop ConstantPool::string_at_impl(constantPoolHandle this_oop, int which, int obj_index, TRAPS) {
+oop ConstantPool::string_at_impl(constantPoolHandle this_cp, int which, int obj_index, TRAPS) {
// If the string has already been interned, this entry will be non-null
- oop str = this_oop->resolved_references()->obj_at(obj_index);
+ oop str = this_cp->resolved_references()->obj_at(obj_index);
if (str != NULL) return str;
- Symbol* sym = this_oop->unresolved_string_at(which);
+ Symbol* sym = this_cp->unresolved_string_at(which);
str = StringTable::intern(sym, CHECK_(NULL));
- this_oop->string_at_put(which, obj_index, str);
+ this_cp->string_at_put(which, obj_index, str);
assert(java_lang_String::is_instance(str), "must be string");
return str;
}
--- a/hotspot/src/share/vm/oops/constantPool.hpp Tue Mar 25 09:26:18 2014 -0400
+++ b/hotspot/src/share/vm/oops/constantPool.hpp Wed Mar 26 21:47:45 2014 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -48,7 +48,7 @@
# include "bytes_ppc.hpp"
#endif
-// A constantPool is an array containing class constants as described in the
+// A ConstantPool is an array containing class constants as described in the
// class file.
//
// Most of the constant pool entries are written during class parsing, which
@@ -81,9 +81,10 @@
};
class KlassSizeStats;
+
class ConstantPool : public Metadata {
friend class VMStructs;
- friend class BytecodeInterpreter; // Directly extracts an oop in the pool for fast instanceof/checkcast
+ friend class BytecodeInterpreter; // Directly extracts a klass in the pool for fast instanceof/checkcast
friend class Universe; // For null constructor
private:
Array<u1>* _tags; // the tag array describing the constant pool's contents
@@ -747,13 +748,13 @@
friend class SystemDictionary;
// Used by compiler to prevent classloading.
- static Method* method_at_if_loaded (constantPoolHandle this_oop, int which);
- static bool has_appendix_at_if_loaded (constantPoolHandle this_oop, int which);
- static oop appendix_at_if_loaded (constantPoolHandle this_oop, int which);
- static bool has_method_type_at_if_loaded (constantPoolHandle this_oop, int which);
- static oop method_type_at_if_loaded (constantPoolHandle this_oop, int which);
- static Klass* klass_at_if_loaded (constantPoolHandle this_oop, int which);
- static Klass* klass_ref_at_if_loaded (constantPoolHandle this_oop, int which);
+ static Method* method_at_if_loaded (constantPoolHandle this_cp, int which);
+ static bool has_appendix_at_if_loaded (constantPoolHandle this_cp, int which);
+ static oop appendix_at_if_loaded (constantPoolHandle this_cp, int which);
+ static bool has_method_type_at_if_loaded (constantPoolHandle this_cp, int which);
+ static oop method_type_at_if_loaded (constantPoolHandle this_cp, int which);
+ static Klass* klass_at_if_loaded (constantPoolHandle this_cp, int which);
+ static Klass* klass_ref_at_if_loaded (constantPoolHandle this_cp, int which);
// Routines currently used for annotations (only called by jvm.cpp) but which might be used in the
// future by other Java code. These take constant pool indices rather than
@@ -811,19 +812,19 @@
}
// Performs the LinkResolver checks
- static void verify_constant_pool_resolve(constantPoolHandle this_oop, KlassHandle klass, TRAPS);
+ static void verify_constant_pool_resolve(constantPoolHandle this_cp, KlassHandle klass, TRAPS);
// Implementation of methods that needs an exposed 'this' pointer, in order to
// handle GC while executing the method
- static Klass* klass_at_impl(constantPoolHandle this_oop, int which, TRAPS);
- static oop string_at_impl(constantPoolHandle this_oop, int which, int obj_index, TRAPS);
+ static Klass* klass_at_impl(constantPoolHandle this_cp, int which, TRAPS);
+ static oop string_at_impl(constantPoolHandle this_cp, int which, int obj_index, TRAPS);
// Resolve string constants (to prevent allocation during compilation)
- static void resolve_string_constants_impl(constantPoolHandle this_oop, TRAPS);
+ static void resolve_string_constants_impl(constantPoolHandle this_cp, TRAPS);
- static oop resolve_constant_at_impl(constantPoolHandle this_oop, int index, int cache_index, TRAPS);
- static void save_and_throw_exception(constantPoolHandle this_oop, int which, int tag_value, TRAPS);
- static oop resolve_bootstrap_specifier_at_impl(constantPoolHandle this_oop, int index, TRAPS);
+ static oop resolve_constant_at_impl(constantPoolHandle this_cp, int index, int cache_index, TRAPS);
+ static void save_and_throw_exception(constantPoolHandle this_cp, int which, int tag_value, TRAPS);
+ static oop resolve_bootstrap_specifier_at_impl(constantPoolHandle this_cp, int index, TRAPS);
public:
// Merging ConstantPool* support:
--- a/hotspot/src/share/vm/oops/cpCache.cpp Tue Mar 25 09:26:18 2014 -0400
+++ b/hotspot/src/share/vm/oops/cpCache.cpp Wed Mar 26 21:47:45 2014 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -328,7 +328,7 @@
// the f1 method has signature '(Ljl/Object;Ljl/invoke/MethodType;)Ljl/Object;',
// not '(Ljava/lang/String;)Ljava/util/List;'.
// The fact that String and List are involved is encoded in the MethodType in refs[f2].
- // This allows us to create fewer method oops, while keeping type safety.
+ // This allows us to create fewer Methods, while keeping type safety.
//
objArrayHandle resolved_references = cpool->resolved_references();
--- a/hotspot/src/share/vm/oops/cpCache.hpp Tue Mar 25 09:26:18 2014 -0400
+++ b/hotspot/src/share/vm/oops/cpCache.hpp Wed Mar 26 21:47:45 2014 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -102,8 +102,9 @@
// _f1 = Method* for non-virtual calls, unused by virtual calls.
// for interface calls, which are essentially virtual but need a klass,
// contains Klass* for the corresponding interface.
-// for invokedynamic, f1 contains a site-specific CallSite object (as an appendix)
-// for invokehandle, f1 contains a site-specific MethodType object (as an appendix)
+// for invokedynamic and invokehandle, f1 contains the adapter method which
+// manages the actual call. The appendix is stored in the ConstantPool
+// resolved_references array.
// (upcoming metadata changes will move the appendix to a separate array)
// _f2 = vtable/itable index (or final Method*) for virtual calls only,
// unused by non-virtual. The is_vfinal flag indicates this is a
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp Tue Mar 25 09:26:18 2014 -0400
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Wed Mar 26 21:47:45 2014 -0400
@@ -432,8 +432,8 @@
if (!InstanceKlass::cast(super)->is_initialized()) return;
// call body to expose the this pointer
- instanceKlassHandle this_oop(thread, this);
- eager_initialize_impl(this_oop);
+ instanceKlassHandle this_k(thread, this);
+ eager_initialize_impl(this_k);
}
}
@@ -470,16 +470,16 @@
assert(!is_not_initialized(), "class must be initialized now");
}
-void InstanceKlass::eager_initialize_impl(instanceKlassHandle this_oop) {
+void InstanceKlass::eager_initialize_impl(instanceKlassHandle this_k) {
EXCEPTION_MARK;
- oop init_lock = this_oop->init_lock();
+ oop init_lock = this_k->init_lock();
ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
// abort if someone beat us to the initialization
- if (!this_oop->is_not_initialized()) return; // note: not equivalent to is_initialized()
-
- ClassState old_state = this_oop->init_state();
- link_class_impl(this_oop, true, THREAD);
+ if (!this_k->is_not_initialized()) return; // note: not equivalent to is_initialized()
+
+ ClassState old_state = this_k->init_state();
+ link_class_impl(this_k, true, THREAD);
if (HAS_PENDING_EXCEPTION) {
CLEAR_PENDING_EXCEPTION;
// Abort if linking the class throws an exception.
@@ -487,16 +487,16 @@
// Use a test to avoid redundantly resetting the state if there's
// no change. Set_init_state() asserts that state changes make
// progress, whereas here we might just be spinning in place.
- if( old_state != this_oop->_init_state )
- this_oop->set_init_state (old_state);
+ if( old_state != this_k->_init_state )
+ this_k->set_init_state (old_state);
} else {
// linking successfull, mark class as initialized
- this_oop->set_init_state (fully_initialized);
- this_oop->fence_and_clear_init_lock();
+ this_k->set_init_state (fully_initialized);
+ this_k->fence_and_clear_init_lock();
// trace
if (TraceClassInitialization) {
ResourceMark rm(THREAD);
- tty->print_cr("[Initialized %s without side effects]", this_oop->external_name());
+ tty->print_cr("[Initialized %s without side effects]", this_k->external_name());
}
}
}
@@ -508,8 +508,8 @@
void InstanceKlass::initialize(TRAPS) {
if (this->should_be_initialized()) {
HandleMark hm(THREAD);
- instanceKlassHandle this_oop(THREAD, this);
- initialize_impl(this_oop, CHECK);
+ instanceKlassHandle this_k(THREAD, this);
+ initialize_impl(this_k, CHECK);
// Note: at this point the class may be initialized
// OR it may be in the state of being initialized
// in case of recursive initialization!
@@ -520,11 +520,11 @@
bool InstanceKlass::verify_code(
- instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS) {
+ instanceKlassHandle this_k, bool throw_verifyerror, TRAPS) {
// 1) Verify the bytecodes
Verifier::Mode mode =
throw_verifyerror ? Verifier::ThrowException : Verifier::NoException;
- return Verifier::verify(this_oop, mode, this_oop->should_verify_class(), CHECK_false);
+ return Verifier::verify(this_k, mode, this_k->should_verify_class(), CHECK_false);
}
@@ -540,8 +540,8 @@
assert(is_loaded(), "must be loaded");
if (!is_linked()) {
HandleMark hm(THREAD);
- instanceKlassHandle this_oop(THREAD, this);
- link_class_impl(this_oop, true, CHECK);
+ instanceKlassHandle this_k(THREAD, this);
+ link_class_impl(this_k, true, CHECK);
}
}
@@ -551,22 +551,22 @@
assert(is_loaded(), "must be loaded");
if (!is_linked()) {
HandleMark hm(THREAD);
- instanceKlassHandle this_oop(THREAD, this);
- link_class_impl(this_oop, false, CHECK_false);
+ instanceKlassHandle this_k(THREAD, this);
+ link_class_impl(this_k, false, CHECK_false);
}
return is_linked();
}
bool InstanceKlass::link_class_impl(
- instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS) {
+ instanceKlassHandle this_k, bool throw_verifyerror, TRAPS) {
// check for error state
- if (this_oop->is_in_error_state()) {
+ if (this_k->is_in_error_state()) {
ResourceMark rm(THREAD);
THROW_MSG_(vmSymbols::java_lang_NoClassDefFoundError(),
- this_oop->external_name(), false);
+ this_k->external_name(), false);
}
// return if already verified
- if (this_oop->is_linked()) {
+ if (this_k->is_linked()) {
return true;
}
@@ -576,7 +576,7 @@
JavaThread* jt = (JavaThread*)THREAD;
// link super class before linking this class
- instanceKlassHandle super(THREAD, this_oop->super());
+ instanceKlassHandle super(THREAD, this_k->super());
if (super.not_null()) {
if (super->is_interface()) { // check if super class is an interface
ResourceMark rm(THREAD);
@@ -584,7 +584,7 @@
THREAD_AND_LOCATION,
vmSymbols::java_lang_IncompatibleClassChangeError(),
"class %s has interface %s as super class",
- this_oop->external_name(),
+ this_k->external_name(),
super->external_name()
);
return false;
@@ -594,7 +594,7 @@
}
// link all interfaces implemented by this class before linking this class
- Array<Klass*>* interfaces = this_oop->local_interfaces();
+ Array<Klass*>* interfaces = this_k->local_interfaces();
int num_interfaces = interfaces->length();
for (int index = 0; index < num_interfaces; index++) {
HandleMark hm(THREAD);
@@ -603,7 +603,7 @@
}
// in case the class is linked in the process of linking its superclasses
- if (this_oop->is_linked()) {
+ if (this_k->is_linked()) {
return true;
}
@@ -618,14 +618,14 @@
// verification & rewriting
{
- oop init_lock = this_oop->init_lock();
+ oop init_lock = this_k->init_lock();
ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
// rewritten will have been set if loader constraint error found
// on an earlier link attempt
// don't verify or rewrite if already rewritten
- if (!this_oop->is_linked()) {
- if (!this_oop->is_rewritten()) {
+ if (!this_k->is_linked()) {
+ if (!this_k->is_rewritten()) {
{
// Timer includes any side effects of class verification (resolution,
// etc), but not recursive entry into verify_code().
@@ -635,7 +635,7 @@
jt->get_thread_stat()->perf_recursion_counts_addr(),
jt->get_thread_stat()->perf_timers_addr(),
PerfClassTraceTime::CLASS_VERIFY);
- bool verify_ok = verify_code(this_oop, throw_verifyerror, THREAD);
+ bool verify_ok = verify_code(this_k, throw_verifyerror, THREAD);
if (!verify_ok) {
return false;
}
@@ -644,39 +644,39 @@
// Just in case a side-effect of verify linked this class already
// (which can sometimes happen since the verifier loads classes
// using custom class loaders, which are free to initialize things)
- if (this_oop->is_linked()) {
+ if (this_k->is_linked()) {
return true;
}
// also sets rewritten
- this_oop->rewrite_class(CHECK_false);
+ this_k->rewrite_class(CHECK_false);
}
// relocate jsrs and link methods after they are all rewritten
- this_oop->link_methods(CHECK_false);
+ this_k->link_methods(CHECK_false);
// Initialize the vtable and interface table after
// methods have been rewritten since rewrite may
// fabricate new Method*s.
// also does loader constraint checking
- if (!this_oop()->is_shared()) {
+ if (!this_k()->is_shared()) {
ResourceMark rm(THREAD);
- this_oop->vtable()->initialize_vtable(true, CHECK_false);
- this_oop->itable()->initialize_itable(true, CHECK_false);
+ this_k->vtable()->initialize_vtable(true, CHECK_false);
+ this_k->itable()->initialize_itable(true, CHECK_false);
}
#ifdef ASSERT
else {
ResourceMark rm(THREAD);
- this_oop->vtable()->verify(tty, true);
+ this_k->vtable()->verify(tty, true);
// In case itable verification is ever added.
- // this_oop->itable()->verify(tty, true);
+ // this_k->itable()->verify(tty, true);
}
#endif
- this_oop->set_init_state(linked);
+ this_k->set_init_state(linked);
if (JvmtiExport::should_post_class_prepare()) {
Thread *thread = THREAD;
assert(thread->is_Java_thread(), "thread->is_Java_thread()");
- JvmtiExport::post_class_prepare((JavaThread *) thread, this_oop());
+ JvmtiExport::post_class_prepare((JavaThread *) thread, this_k());
}
}
}
@@ -689,13 +689,13 @@
// verification but before the first method of the class is executed.
void InstanceKlass::rewrite_class(TRAPS) {
assert(is_loaded(), "must be loaded");
- instanceKlassHandle this_oop(THREAD, this);
- if (this_oop->is_rewritten()) {
- assert(this_oop()->is_shared(), "rewriting an unshared class?");
+ instanceKlassHandle this_k(THREAD, this);
+ if (this_k->is_rewritten()) {
+ assert(this_k()->is_shared(), "rewriting an unshared class?");
return;
}
- Rewriter::rewrite(this_oop, CHECK);
- this_oop->set_rewritten();
+ Rewriter::rewrite(this_k, CHECK);
+ this_k->set_rewritten();
}
// Now relocate and link method entry points after class is rewritten.
@@ -729,19 +729,19 @@
}
-void InstanceKlass::initialize_impl(instanceKlassHandle this_oop, TRAPS) {
+void InstanceKlass::initialize_impl(instanceKlassHandle this_k, TRAPS) {
// Make sure klass is linked (verified) before initialization
// A class could already be verified, since it has been reflected upon.
- this_oop->link_class(CHECK);
-
- DTRACE_CLASSINIT_PROBE(required, InstanceKlass::cast(this_oop()), -1);
+ this_k->link_class(CHECK);
+
+ DTRACE_CLASSINIT_PROBE(required, InstanceKlass::cast(this_k()), -1);
bool wait = false;
// refer to the JVM book page 47 for description of steps
// Step 1
{
- oop init_lock = this_oop->init_lock();
+ oop init_lock = this_k->init_lock();
ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
Thread *self = THREAD; // it's passed the current thread
@@ -750,29 +750,29 @@
// If we were to use wait() instead of waitInterruptibly() then
// we might end up throwing IE from link/symbol resolution sites
// that aren't expected to throw. This would wreak havoc. See 6320309.
- while(this_oop->is_being_initialized() && !this_oop->is_reentrant_initialization(self)) {
+ while(this_k->is_being_initialized() && !this_k->is_reentrant_initialization(self)) {
wait = true;
ol.waitUninterruptibly(CHECK);
}
// Step 3
- if (this_oop->is_being_initialized() && this_oop->is_reentrant_initialization(self)) {
- DTRACE_CLASSINIT_PROBE_WAIT(recursive, InstanceKlass::cast(this_oop()), -1,wait);
+ if (this_k->is_being_initialized() && this_k->is_reentrant_initialization(self)) {
+ DTRACE_CLASSINIT_PROBE_WAIT(recursive, InstanceKlass::cast(this_k()), -1,wait);
return;
}
// Step 4
- if (this_oop->is_initialized()) {
- DTRACE_CLASSINIT_PROBE_WAIT(concurrent, InstanceKlass::cast(this_oop()), -1,wait);
+ if (this_k->is_initialized()) {
+ DTRACE_CLASSINIT_PROBE_WAIT(concurrent, InstanceKlass::cast(this_k()), -1,wait);
return;
}
// Step 5
- if (this_oop->is_in_error_state()) {
- DTRACE_CLASSINIT_PROBE_WAIT(erroneous, InstanceKlass::cast(this_oop()), -1,wait);
+ if (this_k->is_in_error_state()) {
+ DTRACE_CLASSINIT_PROBE_WAIT(erroneous, InstanceKlass::cast(this_k()), -1,wait);
ResourceMark rm(THREAD);
const char* desc = "Could not initialize class ";
- const char* className = this_oop->external_name();
+ const char* className = this_k->external_name();
size_t msglen = strlen(desc) + strlen(className) + 1;
char* message = NEW_RESOURCE_ARRAY(char, msglen);
if (NULL == message) {
@@ -785,13 +785,13 @@
}
// Step 6
- this_oop->set_init_state(being_initialized);
- this_oop->set_init_thread(self);
+ this_k->set_init_state(being_initialized);
+ this_k->set_init_thread(self);
}
// Step 7
- Klass* super_klass = this_oop->super();
- if (super_klass != NULL && !this_oop->is_interface() && super_klass->should_be_initialized()) {
+ Klass* super_klass = this_k->super();
+ if (super_klass != NULL && !this_k->is_interface() && super_klass->should_be_initialized()) {
super_klass->initialize(THREAD);
if (HAS_PENDING_EXCEPTION) {
@@ -799,18 +799,18 @@
CLEAR_PENDING_EXCEPTION;
{
EXCEPTION_MARK;
- this_oop->set_initialization_state_and_notify(initialization_error, THREAD); // Locks object, set state, and notify all waiting threads
+ this_k->set_initialization_state_and_notify(initialization_error, THREAD); // Locks object, set state, and notify all waiting threads
CLEAR_PENDING_EXCEPTION; // ignore any exception thrown, superclass initialization error is thrown below
}
- DTRACE_CLASSINIT_PROBE_WAIT(super__failed, InstanceKlass::cast(this_oop()), -1,wait);
+ DTRACE_CLASSINIT_PROBE_WAIT(super__failed, InstanceKlass::cast(this_k()), -1,wait);
THROW_OOP(e());
}
}
- if (this_oop->has_default_methods()) {
+ if (this_k->has_default_methods()) {
// Step 7.5: initialize any interfaces which have default methods
- for (int i = 0; i < this_oop->local_interfaces()->length(); ++i) {
- Klass* iface = this_oop->local_interfaces()->at(i);
+ for (int i = 0; i < this_k->local_interfaces()->length(); ++i) {
+ Klass* iface = this_k->local_interfaces()->at(i);
InstanceKlass* ik = InstanceKlass::cast(iface);
if (ik->has_default_methods() && ik->should_be_initialized()) {
ik->initialize(THREAD);
@@ -821,7 +821,7 @@
{
EXCEPTION_MARK;
// Locks object, set state, and notify all waiting threads
- this_oop->set_initialization_state_and_notify(
+ this_k->set_initialization_state_and_notify(
initialization_error, THREAD);
// ignore any exception thrown, superclass initialization error is
@@ -829,7 +829,7 @@
CLEAR_PENDING_EXCEPTION;
}
DTRACE_CLASSINIT_PROBE_WAIT(
- super__failed, InstanceKlass::cast(this_oop()), -1, wait);
+ super__failed, InstanceKlass::cast(this_k()), -1, wait);
THROW_OOP(e());
}
}
@@ -840,7 +840,7 @@
{
assert(THREAD->is_Java_thread(), "non-JavaThread in initialize_impl");
JavaThread* jt = (JavaThread*)THREAD;
- DTRACE_CLASSINIT_PROBE_WAIT(clinit, InstanceKlass::cast(this_oop()), -1,wait);
+ DTRACE_CLASSINIT_PROBE_WAIT(clinit, InstanceKlass::cast(this_k()), -1,wait);
// Timer includes any side effects of class initialization (resolution,
// etc), but not recursive entry into call_class_initializer().
PerfClassTraceTime timer(ClassLoader::perf_class_init_time(),
@@ -849,14 +849,14 @@
jt->get_thread_stat()->perf_recursion_counts_addr(),
jt->get_thread_stat()->perf_timers_addr(),
PerfClassTraceTime::CLASS_CLINIT);
- this_oop->call_class_initializer(THREAD);
+ this_k->call_class_initializer(THREAD);
}
// Step 9
if (!HAS_PENDING_EXCEPTION) {
- this_oop->set_initialization_state_and_notify(fully_initialized, CHECK);
+ this_k->set_initialization_state_and_notify(fully_initialized, CHECK);
{ ResourceMark rm(THREAD);
- debug_only(this_oop->vtable()->verify(tty, true);)
+ debug_only(this_k->vtable()->verify(tty, true);)
}
}
else {
@@ -868,13 +868,13 @@
JvmtiExport::clear_detected_exception((JavaThread*)THREAD);
{
EXCEPTION_MARK;
- this_oop->set_initialization_state_and_notify(initialization_error, THREAD);
+ this_k->set_initialization_state_and_notify(initialization_error, THREAD);
CLEAR_PENDING_EXCEPTION; // ignore any exception thrown, class initialization error is thrown below
// JVMTI has already reported the pending exception
// JVMTI internal flag reset is needed in order to report ExceptionInInitializerError
JvmtiExport::clear_detected_exception((JavaThread*)THREAD);
}
- DTRACE_CLASSINIT_PROBE_WAIT(error, InstanceKlass::cast(this_oop()), -1,wait);
+ DTRACE_CLASSINIT_PROBE_WAIT(error, InstanceKlass::cast(this_k()), -1,wait);
if (e->is_a(SystemDictionary::Error_klass())) {
THROW_OOP(e());
} else {
@@ -884,7 +884,7 @@
&args);
}
}
- DTRACE_CLASSINIT_PROBE_WAIT(end, InstanceKlass::cast(this_oop()), -1,wait);
+ DTRACE_CLASSINIT_PROBE_WAIT(end, InstanceKlass::cast(this_k()), -1,wait);
}
@@ -894,11 +894,11 @@
set_initialization_state_and_notify_impl(kh, state, CHECK);
}
-void InstanceKlass::set_initialization_state_and_notify_impl(instanceKlassHandle this_oop, ClassState state, TRAPS) {
- oop init_lock = this_oop->init_lock();
+void InstanceKlass::set_initialization_state_and_notify_impl(instanceKlassHandle this_k, ClassState state, TRAPS) {
+ oop init_lock = this_k->init_lock();
ObjectLocker ol(init_lock, THREAD, init_lock != NULL);
- this_oop->set_init_state(state);
- this_oop->fence_and_clear_init_lock();
+ this_k->set_init_state(state);
+ this_k->fence_and_clear_init_lock();
ol.notify_all(CHECK);
}
@@ -952,12 +952,11 @@
void InstanceKlass::process_interfaces(Thread *thread) {
// link this class into the implementors list of every interface it implements
- Klass* this_as_klass_oop = this;
for (int i = local_interfaces()->length() - 1; i >= 0; i--) {
assert(local_interfaces()->at(i)->is_klass(), "must be a klass");
InstanceKlass* interf = InstanceKlass::cast(local_interfaces()->at(i));
assert(interf->is_interface(), "expected interface");
- interf->add_implementor(this_as_klass_oop);
+ interf->add_implementor(this);
}
}
@@ -1083,12 +1082,12 @@
}
Klass* InstanceKlass::array_klass_impl(bool or_null, int n, TRAPS) {
- instanceKlassHandle this_oop(THREAD, this);
- return array_klass_impl(this_oop, or_null, n, THREAD);
+ instanceKlassHandle this_k(THREAD, this);
+ return array_klass_impl(this_k, or_null, n, THREAD);
}
-Klass* InstanceKlass::array_klass_impl(instanceKlassHandle this_oop, bool or_null, int n, TRAPS) {
- if (this_oop->array_klasses() == NULL) {
+Klass* InstanceKlass::array_klass_impl(instanceKlassHandle this_k, bool or_null, int n, TRAPS) {
+ if (this_k->array_klasses() == NULL) {
if (or_null) return NULL;
ResourceMark rm;
@@ -1099,14 +1098,14 @@
MutexLocker ma(MultiArray_lock, THREAD);
// Check if update has already taken place
- if (this_oop->array_klasses() == NULL) {
- Klass* k = ObjArrayKlass::allocate_objArray_klass(this_oop->class_loader_data(), 1, this_oop, CHECK_NULL);
- this_oop->set_array_klasses(k);
+ if (this_k->array_klasses() == NULL) {
+ Klass* k = ObjArrayKlass::allocate_objArray_klass(this_k->class_loader_data(), 1, this_k, CHECK_NULL);
+ this_k->set_array_klasses(k);
}
}
}
// _this will always be set at this point
- ObjArrayKlass* oak = (ObjArrayKlass*)this_oop->array_klasses();
+ ObjArrayKlass* oak = (ObjArrayKlass*)this_k->array_klasses();
if (or_null) {
return oak->array_klass_or_null(n);
}
@@ -1133,20 +1132,20 @@
return NULL;
}
-void InstanceKlass::call_class_initializer_impl(instanceKlassHandle this_oop, TRAPS) {
+void InstanceKlass::call_class_initializer_impl(instanceKlassHandle this_k, TRAPS) {
if (ReplayCompiles &&
(ReplaySuppressInitializers == 1 ||
- ReplaySuppressInitializers >= 2 && this_oop->class_loader() != NULL)) {
+ ReplaySuppressInitializers >= 2 && this_k->class_loader() != NULL)) {
// Hide the existence of the initializer for the purpose of replaying the compile
return;
}
- methodHandle h_method(THREAD, this_oop->class_initializer());
- assert(!this_oop->is_initialized(), "we cannot initialize twice");
+ methodHandle h_method(THREAD, this_k->class_initializer());
+ assert(!this_k->is_initialized(), "we cannot initialize twice");
if (TraceClassInitialization) {
tty->print("%d Initializing ", call_class_initializer_impl_counter++);
- this_oop->name()->print_value();
- tty->print_cr("%s (" INTPTR_FORMAT ")", h_method() == NULL ? "(no method)" : "", (address)this_oop());
+ this_k->name()->print_value();
+ tty->print_cr("%s (" INTPTR_FORMAT ")", h_method() == NULL ? "(no method)" : "", (address)this_k());
}
if (h_method() != NULL) {
JavaCallArguments args; // No arguments
@@ -1296,8 +1295,8 @@
}
-void InstanceKlass::do_local_static_fields_impl(instanceKlassHandle this_oop, void f(fieldDescriptor* fd, TRAPS), TRAPS) {
- for (JavaFieldStream fs(this_oop()); !fs.done(); fs.next()) {
+void InstanceKlass::do_local_static_fields_impl(instanceKlassHandle this_k, void f(fieldDescriptor* fd, TRAPS), TRAPS) {
+ for (JavaFieldStream fs(this_k()); !fs.done(); fs.next()) {
if (fs.access_flags().is_static()) {
fieldDescriptor& fd = fs.field_descriptor();
f(&fd, CHECK);
@@ -1515,14 +1514,14 @@
}
/* jni_id_for_impl for jfieldIds only */
-JNIid* InstanceKlass::jni_id_for_impl(instanceKlassHandle this_oop, int offset) {
+JNIid* InstanceKlass::jni_id_for_impl(instanceKlassHandle this_k, int offset) {
MutexLocker ml(JfieldIdCreation_lock);
// Retry lookup after we got the lock
- JNIid* probe = this_oop->jni_ids() == NULL ? NULL : this_oop->jni_ids()->find(offset);
+ JNIid* probe = this_k->jni_ids() == NULL ? NULL : this_k->jni_ids()->find(offset);
if (probe == NULL) {
// Slow case, allocate new static field identifier
- probe = new JNIid(this_oop(), offset, this_oop->jni_ids());
- this_oop->set_jni_ids(probe);
+ probe = new JNIid(this_k(), offset, this_k->jni_ids());
+ this_k->set_jni_ids(probe);
}
return probe;
}
@@ -3161,8 +3160,8 @@
}
// Verify first subklass
- if (subklass_oop() != NULL) {
- guarantee(subklass_oop()->is_klass(), "should be klass");
+ if (subklass() != NULL) {
+ guarantee(subklass()->is_klass(), "should be klass");
}
// Verify siblings
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp Tue Mar 25 09:26:18 2014 -0400
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp Wed Mar 26 21:47:45 2014 -0400
@@ -43,35 +43,7 @@
// An InstanceKlass is the VM level representation of a Java class.
// It contains all information needed for at class at execution runtime.
-// InstanceKlass layout:
-// [C++ vtbl pointer ] Klass
-// [subtype cache ] Klass
-// [instance size ] Klass
-// [java mirror ] Klass
-// [super ] Klass
-// [access_flags ] Klass
-// [name ] Klass
-// [first subklass ] Klass
-// [next sibling ] Klass
-// [array klasses ]
-// [methods ]
-// [local interfaces ]
-// [transitive interfaces ]
-// [fields ]
-// [constants ]
-// [class loader ]
-// [source file name ]
-// [inner classes ]
-// [static field size ]
-// [nonstatic field size ]
-// [static oop fields size ]
-// [nonstatic oop maps size ]
-// [has finalize method ]
-// [deoptimization mark bit ]
-// [initialization state ]
-// [initializing thread ]
-// [Java vtable length ]
-// [oop map cache (stack maps) ]
+// InstanceKlass embedded field layout (after declared fields):
// [EMBEDDED Java vtable ] size in words = vtable_len
// [EMBEDDED nonstatic oop-map blocks] size in words = nonstatic_oop_map_size
// The embedded nonstatic oop-map blocks are short pairs (offset, length)
@@ -1031,16 +1003,16 @@
// Static methods that are used to implement member methods where an exposed this pointer
// is needed due to possible GCs
- static bool link_class_impl (instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS);
- static bool verify_code (instanceKlassHandle this_oop, bool throw_verifyerror, TRAPS);
- static void initialize_impl (instanceKlassHandle this_oop, TRAPS);
- static void eager_initialize_impl (instanceKlassHandle this_oop);
- static void set_initialization_state_and_notify_impl (instanceKlassHandle this_oop, ClassState state, TRAPS);
- static void call_class_initializer_impl (instanceKlassHandle this_oop, TRAPS);
- static Klass* array_klass_impl (instanceKlassHandle this_oop, bool or_null, int n, TRAPS);
- static void do_local_static_fields_impl (instanceKlassHandle this_oop, void f(fieldDescriptor* fd, TRAPS), TRAPS);
+ static bool link_class_impl (instanceKlassHandle this_k, bool throw_verifyerror, TRAPS);
+ static bool verify_code (instanceKlassHandle this_k, bool throw_verifyerror, TRAPS);
+ static void initialize_impl (instanceKlassHandle this_k, TRAPS);
+ static void eager_initialize_impl (instanceKlassHandle this_k);
+ static void set_initialization_state_and_notify_impl (instanceKlassHandle this_k, ClassState state, TRAPS);
+ static void call_class_initializer_impl (instanceKlassHandle this_k, TRAPS);
+ static Klass* array_klass_impl (instanceKlassHandle this_k, bool or_null, int n, TRAPS);
+ static void do_local_static_fields_impl (instanceKlassHandle this_k, void f(fieldDescriptor* fd, TRAPS), TRAPS);
/* jni_id_for_impl for jfieldID only */
- static JNIid* jni_id_for_impl (instanceKlassHandle this_oop, int offset);
+ static JNIid* jni_id_for_impl (instanceKlassHandle this_k, int offset);
// Returns the array class for the n'th dimension
Klass* array_klass_impl(bool or_null, int n, TRAPS);
--- a/hotspot/src/share/vm/oops/klass.cpp Tue Mar 25 09:26:18 2014 -0400
+++ b/hotspot/src/share/vm/oops/klass.cpp Wed Mar 26 21:47:45 2014 -0400
@@ -334,19 +334,11 @@
}
-Klass* Klass::subklass() const {
- return _subklass == NULL ? NULL : _subklass;
-}
-
InstanceKlass* Klass::superklass() const {
assert(super() == NULL || super()->oop_is_instance(), "must be instance klass");
return _super == NULL ? NULL : InstanceKlass::cast(_super);
}
-Klass* Klass::next_sibling() const {
- return _next_sibling == NULL ? NULL : _next_sibling;
-}
-
void Klass::set_subklass(Klass* s) {
assert(s != this, "sanity check");
_subklass = s;
@@ -365,7 +357,7 @@
assert((!super->is_interface() // interfaces cannot be supers
&& (super->superklass() == NULL || !is_interface())),
"an interface can only be a subklass of Object");
- Klass* prev_first_subklass = super->subklass_oop();
+ Klass* prev_first_subklass = super->subklass();
if (prev_first_subklass != NULL) {
// set our sibling to be the superklass' previous first subklass
set_next_sibling(prev_first_subklass);
@@ -405,7 +397,7 @@
assert(current->is_loader_alive(is_alive), "just checking, this should be live");
// Find and set the first alive subklass
- Klass* sub = current->subklass_oop();
+ Klass* sub = current->subklass();
while (sub != NULL && !sub->is_loader_alive(is_alive)) {
#ifndef PRODUCT
if (TraceClassUnloading && WizardMode) {
@@ -413,7 +405,7 @@
tty->print_cr("[Unlinking class (subclass) %s]", sub->external_name());
}
#endif
- sub = sub->next_sibling_oop();
+ sub = sub->next_sibling();
}
current->set_subklass(sub);
if (sub != NULL) {
@@ -421,13 +413,13 @@
}
// Find and set the first alive sibling
- Klass* sibling = current->next_sibling_oop();
+ Klass* sibling = current->next_sibling();
while (sibling != NULL && !sibling->is_loader_alive(is_alive)) {
if (TraceClassUnloading && WizardMode) {
ResourceMark rm;
tty->print_cr("[Unlinking class (sibling) %s]", sibling->external_name());
}
- sibling = sibling->next_sibling_oop();
+ sibling = sibling->next_sibling();
}
current->set_next_sibling(sibling);
if (sibling != NULL) {
--- a/hotspot/src/share/vm/oops/klass.hpp Tue Mar 25 09:26:18 2014 -0400
+++ b/hotspot/src/share/vm/oops/klass.hpp Wed Mar 26 21:47:45 2014 -0400
@@ -56,34 +56,6 @@
// actual type. (See oop.inline.hpp for some of the forwarding code.)
// ALL FUNCTIONS IMPLEMENTING THIS DISPATCH ARE PREFIXED WITH "oop_"!
-// Klass layout:
-// [C++ vtbl ptr ] (contained in Metadata)
-// [layout_helper ]
-// [super_check_offset ] for fast subtype checks
-// [name ]
-// [secondary_super_cache] for fast subtype checks
-// [secondary_supers ] array of 2ndary supertypes
-// [primary_supers 0]
-// [primary_supers 1]
-// [primary_supers 2]
-// ...
-// [primary_supers 7]
-// [java_mirror ]
-// [super ]
-// [subklass ] first subclass
-// [next_sibling ] link to chain additional subklasses
-// [next_link ]
-// [class_loader_data]
-// [modifier_flags]
-// [access_flags ]
-// [last_biased_lock_bulk_revocation_time] (64 bits)
-// [prototype_header]
-// [biased_lock_revocation_count]
-// [_modified_oops]
-// [_accumulated_modified_oops]
-// [trace_id]
-
-
// Forward declarations.
template <class T> class Array;
template <class T> class GrowableArray;
@@ -257,9 +229,9 @@
// Use InstanceKlass::contains_field_offset to classify field offsets.
// sub/superklass links
+ Klass* subklass() const { return _subklass; }
+ Klass* next_sibling() const { return _next_sibling; }
InstanceKlass* superklass() const;
- Klass* subklass() const;
- Klass* next_sibling() const;
void append_to_sibling_list(); // add newly created receiver to superklass' subklass list
void set_next_link(Klass* k) { _next_link = k; }
@@ -281,8 +253,6 @@
bool has_accumulated_modified_oops() { return _accumulated_modified_oops == 1; }
protected: // internal accessors
- Klass* subklass_oop() const { return _subklass; }
- Klass* next_sibling_oop() const { return _next_sibling; }
void set_subklass(Klass* s);
void set_next_sibling(Klass* s);
--- a/hotspot/src/share/vm/oops/method.cpp Tue Mar 25 09:26:18 2014 -0400
+++ b/hotspot/src/share/vm/oops/method.cpp Wed Mar 26 21:47:45 2014 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -577,12 +577,12 @@
}
-objArrayHandle Method::resolved_checked_exceptions_impl(Method* this_oop, TRAPS) {
- int length = this_oop->checked_exceptions_length();
+objArrayHandle Method::resolved_checked_exceptions_impl(Method* method, TRAPS) {
+ int length = method->checked_exceptions_length();
if (length == 0) { // common case
return objArrayHandle(THREAD, Universe::the_empty_class_klass_array());
} else {
- methodHandle h_this(THREAD, this_oop);
+ methodHandle h_this(THREAD, method);
objArrayOop m_oop = oopFactory::new_objArray(SystemDictionary::Class_klass(), length, CHECK_(objArrayHandle()));
objArrayHandle mirrors (THREAD, m_oop);
for (int i = 0; i < length; i++) {
--- a/hotspot/src/share/vm/oops/method.hpp Tue Mar 25 09:26:18 2014 -0400
+++ b/hotspot/src/share/vm/oops/method.hpp Wed Mar 26 21:47:45 2014 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,50 +40,15 @@
// A Method represents a Java method.
//
-// Memory layout (each line represents a word). Note that most applications load thousands of methods,
-// so keeping the size of this structure small has a big impact on footprint.
-//
-// The actual bytecodes are inlined after the end of the Method struct.
-//
-// There are bits in the access_flags telling whether inlined tables are present.
-// Note that accessing the line number and local variable tables is not performance critical at all.
-// Accessing the checked exceptions table is used by reflection, so we put that last to make access
-// to it fast.
-//
-// The line number table is compressed and inlined following the byte codes. It is found as the first
-// byte following the byte codes. The checked exceptions table and the local variable table are inlined
-// after the line number table, and indexed from the end of the method. We do not compress the checked
-// exceptions table since the average length is less than 2, and do not bother to compress the local
-// variable table either since it is mostly absent.
-//
-// Note that native_function and signature_handler has to be at fixed offsets (required by the interpreter)
+// Note that most applications load thousands of methods, so keeping the size of this
+// class small has a big impact on footprint.
//
-// |------------------------------------------------------|
-// | header |
-// | klass |
-// |------------------------------------------------------|
-// | ConstMethod* (metadata) |
-// |------------------------------------------------------|
-// | MethodData* (metadata) |
-// | MethodCounters |
-// |------------------------------------------------------|
-// | access_flags |
-// | vtable_index |
-// |------------------------------------------------------|
-// | result_index (C++ interpreter only) |
-// |------------------------------------------------------|
-// | method_size | intrinsic_id | flags |
-// |------------------------------------------------------|
-// | code (pointer) |
-// | i2i (pointer) |
-// | adapter (pointer) |
-// | from_compiled_entry (pointer) |
-// | from_interpreted_entry (pointer) |
-// |------------------------------------------------------|
-// | native_function (present only if native) |
-// | signature_handler (present only if native) |
-// |------------------------------------------------------|
-
+// Note that native_function and signature_handler have to be at fixed offsets
+// (required by the interpreter)
+//
+// Method embedded field layout (after declared fields):
+// [EMBEDDED native_function (present only if native) ]
+// [EMBEDDED signature_handler (present only if native) ]
class CheckedExceptionElement;
class LocalVariableTableElement;
@@ -661,7 +626,7 @@
// Static methods that are used to implement member methods where an exposed this pointer
// is needed due to possible GCs
- static objArrayHandle resolved_checked_exceptions_impl(Method* this_oop, TRAPS);
+ static objArrayHandle resolved_checked_exceptions_impl(Method* method, TRAPS);
// Returns the byte code index from the byte code pointer
int bci_from(address bcp) const;
--- a/hotspot/src/share/vm/utilities/debug.hpp Tue Mar 25 09:26:18 2014 -0400
+++ b/hotspot/src/share/vm/utilities/debug.hpp Wed Mar 26 21:47:45 2014 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -243,7 +243,6 @@
// out of shared space reporting
enum SharedSpaceType {
- SharedPermGen,
SharedReadOnly,
SharedReadWrite,
SharedMiscData