aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/runtime
diff options
context:
space:
mode:
authorcoleenp <none@none>2012-11-06 15:09:37 -0500
committercoleenp <none@none>2012-11-06 15:09:37 -0500
commit17aa43774e8fb719c06bf5756b6ec1fa82f2201a (patch)
tree4ce00b2aa794b9d32ead67e1c4941243cf8eab63 /src/share/vm/runtime
parent94a7d834b26f0eb35ffe618d0a3b60c8a4951a4f (diff)
8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
Summary: Change types of above methods and field to InstanceKlass and remove unneeded casts from the source files. Reviewed-by: dholmes, coleenp, zgu Contributed-by: harold.seigel@oracle.com
Diffstat (limited to 'src/share/vm/runtime')
-rw-r--r--src/share/vm/runtime/compilationPolicy.cpp2
-rw-r--r--src/share/vm/runtime/deoptimization.cpp6
-rw-r--r--src/share/vm/runtime/fieldDescriptor.cpp6
-rw-r--r--src/share/vm/runtime/fieldDescriptor.hpp60
-rw-r--r--src/share/vm/runtime/javaCalls.cpp6
-rw-r--r--src/share/vm/runtime/reflection.cpp14
-rw-r--r--src/share/vm/runtime/vframe.cpp12
-rw-r--r--src/share/vm/runtime/vmStructs.cpp2
8 files changed, 54 insertions, 54 deletions
diff --git a/src/share/vm/runtime/compilationPolicy.cpp b/src/share/vm/runtime/compilationPolicy.cpp
index 940978cf7..73b8f8393 100644
--- a/src/share/vm/runtime/compilationPolicy.cpp
+++ b/src/share/vm/runtime/compilationPolicy.cpp
@@ -627,7 +627,7 @@ const char* StackWalkCompPolicy::shouldNotInline(methodHandle m) {
// negative filter: should send NOT be inlined? returns NULL (--> inline) or rejection msg
if (m->is_abstract()) return (_msg = "abstract method");
// note: we allow ik->is_abstract()
- if (!InstanceKlass::cast(m->method_holder())->is_initialized()) return (_msg = "method holder not initialized");
+ if (!m->method_holder()->is_initialized()) return (_msg = "method holder not initialized");
if (m->is_native()) return (_msg = "native method");
nmethod* m_code = m->code();
if (m_code != NULL && m_code->code_size() > InlineSmallCode)
diff --git a/src/share/vm/runtime/deoptimization.cpp b/src/share/vm/runtime/deoptimization.cpp
index 962b98827..01f4dc75f 100644
--- a/src/share/vm/runtime/deoptimization.cpp
+++ b/src/share/vm/runtime/deoptimization.cpp
@@ -1191,12 +1191,12 @@ void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int i
if (!constant_pool->tag_at(index).is_symbol()) return;
- Handle class_loader (THREAD, InstanceKlass::cast(constant_pool->pool_holder())->class_loader());
+ Handle class_loader (THREAD, constant_pool->pool_holder()->class_loader());
Symbol* symbol = constant_pool->symbol_at(index);
// class name?
if (symbol->byte_at(0) != '(') {
- Handle protection_domain (THREAD, Klass::cast(constant_pool->pool_holder())->protection_domain());
+ Handle protection_domain (THREAD, constant_pool->pool_holder()->protection_domain());
SystemDictionary::resolve_or_null(symbol, class_loader, protection_domain, CHECK);
return;
}
@@ -1206,7 +1206,7 @@ void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int i
for (SignatureStream ss(symbol); !ss.is_done(); ss.next()) {
if (ss.is_object()) {
Symbol* class_name = ss.as_symbol(CHECK);
- Handle protection_domain (THREAD, Klass::cast(constant_pool->pool_holder())->protection_domain());
+ Handle protection_domain (THREAD, constant_pool->pool_holder()->protection_domain());
SystemDictionary::resolve_or_null(class_name, class_loader, protection_domain, CHECK);
}
}
diff --git a/src/share/vm/runtime/fieldDescriptor.cpp b/src/share/vm/runtime/fieldDescriptor.cpp
index 23011684d..001d5d23e 100644
--- a/src/share/vm/runtime/fieldDescriptor.cpp
+++ b/src/share/vm/runtime/fieldDescriptor.cpp
@@ -36,7 +36,7 @@
oop fieldDescriptor::loader() const {
- return InstanceKlass::cast(_cp->pool_holder())->class_loader();
+ return _cp->pool_holder()->class_loader();
}
Symbol* fieldDescriptor::generic_signature() const {
@@ -45,7 +45,7 @@ Symbol* fieldDescriptor::generic_signature() const {
}
int idx = 0;
- InstanceKlass* ik = InstanceKlass::cast(field_holder());
+ InstanceKlass* ik = field_holder();
for (AllFieldStream fs(ik); !fs.done(); fs.next()) {
if (idx == _index) {
return fs.generic_signature();
@@ -58,7 +58,7 @@ Symbol* fieldDescriptor::generic_signature() const {
}
AnnotationArray* fieldDescriptor::annotations() const {
- InstanceKlass* ik = InstanceKlass::cast(field_holder());
+ InstanceKlass* ik = field_holder();
Array<AnnotationArray*>* md = ik->fields_annotations();
if (md == NULL)
return NULL;
diff --git a/src/share/vm/runtime/fieldDescriptor.hpp b/src/share/vm/runtime/fieldDescriptor.hpp
index 496b160cd..00caf8984 100644
--- a/src/share/vm/runtime/fieldDescriptor.hpp
+++ b/src/share/vm/runtime/fieldDescriptor.hpp
@@ -43,12 +43,12 @@ class fieldDescriptor VALUE_OBJ_CLASS_SPEC {
// update the access_flags for the field in the klass
void update_klass_field_access_flag() {
- InstanceKlass* ik = InstanceKlass::cast(field_holder());
+ InstanceKlass* ik = field_holder();
ik->field(index())->set_access_flags(_access_flags.as_short());
}
FieldInfo* field() const {
- InstanceKlass* ik = InstanceKlass::cast(field_holder());
+ InstanceKlass* ik = field_holder();
return ik->field(_index);
}
@@ -59,46 +59,46 @@ class fieldDescriptor VALUE_OBJ_CLASS_SPEC {
Symbol* signature() const {
return field()->signature(_cp);
}
- Klass* field_holder() const { return _cp->pool_holder(); }
- ConstantPool* constants() const { return _cp(); }
- AccessFlags access_flags() const { return _access_flags; }
- oop loader() const;
+ InstanceKlass* field_holder() const { return _cp->pool_holder(); }
+ ConstantPool* constants() const { return _cp(); }
+ AccessFlags access_flags() const { return _access_flags; }
+ oop loader() const;
// Offset (in words) of field from start of instanceOop / Klass*
- int offset() const { return field()->offset(); }
- Symbol* generic_signature() const;
- int index() const { return _index; }
- AnnotationArray* annotations() const;
+ int offset() const { return field()->offset(); }
+ Symbol* generic_signature() const;
+ int index() const { return _index; }
+ AnnotationArray* annotations() const;
// Initial field value
- bool has_initial_value() const { return field()->initval_index() != 0; }
- int initial_value_index() const { return field()->initval_index(); }
+ bool has_initial_value() const { return field()->initval_index() != 0; }
+ int initial_value_index() const { return field()->initval_index(); }
constantTag initial_value_tag() const; // The tag will return true on one of is_int(), is_long(), is_single(), is_double()
- jint int_initial_value() const;
- jlong long_initial_value() const;
- jfloat float_initial_value() const;
- jdouble double_initial_value() const;
- oop string_initial_value(TRAPS) const;
+ jint int_initial_value() const;
+ jlong long_initial_value() const;
+ jfloat float_initial_value() const;
+ jdouble double_initial_value() const;
+ oop string_initial_value(TRAPS) const;
// Field signature type
- BasicType field_type() const { return FieldType::basic_type(signature()); }
+ BasicType field_type() const { return FieldType::basic_type(signature()); }
// Access flags
- bool is_public() const { return access_flags().is_public(); }
- bool is_private() const { return access_flags().is_private(); }
- bool is_protected() const { return access_flags().is_protected(); }
- bool is_package_private() const { return !is_public() && !is_private() && !is_protected(); }
+ bool is_public() const { return access_flags().is_public(); }
+ bool is_private() const { return access_flags().is_private(); }
+ bool is_protected() const { return access_flags().is_protected(); }
+ bool is_package_private() const { return !is_public() && !is_private() && !is_protected(); }
- bool is_static() const { return access_flags().is_static(); }
- bool is_final() const { return access_flags().is_final(); }
- bool is_volatile() const { return access_flags().is_volatile(); }
- bool is_transient() const { return access_flags().is_transient(); }
+ bool is_static() const { return access_flags().is_static(); }
+ bool is_final() const { return access_flags().is_final(); }
+ bool is_volatile() const { return access_flags().is_volatile(); }
+ bool is_transient() const { return access_flags().is_transient(); }
- bool is_synthetic() const { return access_flags().is_synthetic(); }
+ bool is_synthetic() const { return access_flags().is_synthetic(); }
- bool is_field_access_watched() const { return access_flags().is_field_access_watched(); }
+ bool is_field_access_watched() const { return access_flags().is_field_access_watched(); }
bool is_field_modification_watched() const
- { return access_flags().is_field_modification_watched(); }
- bool has_generic_signature() const { return access_flags().field_has_generic_signature(); }
+ { return access_flags().is_field_modification_watched(); }
+ bool has_generic_signature() const { return access_flags().field_has_generic_signature(); }
void set_is_field_access_watched(const bool value) {
_access_flags.set_is_field_access_watched(value);
diff --git a/src/share/vm/runtime/javaCalls.cpp b/src/share/vm/runtime/javaCalls.cpp
index 0eb14c462..fe965acb9 100644
--- a/src/share/vm/runtime/javaCalls.cpp
+++ b/src/share/vm/runtime/javaCalls.cpp
@@ -189,7 +189,7 @@ void JavaCalls::call_default_constructor(JavaThread* thread, methodHandle method
assert(method->name() == vmSymbols::object_initializer_name(), "Should only be called for default constructor");
assert(method->signature() == vmSymbols::void_method_signature(), "Should only be called for default constructor");
- InstanceKlass* ik = InstanceKlass::cast(method->method_holder());
+ InstanceKlass* ik = method->method_holder();
if (ik->is_initialized() && ik->has_vanilla_constructor()) {
// safe to skip constructor call
} else {
@@ -344,11 +344,11 @@ void JavaCalls::call_helper(JavaValue* result, methodHandle* m, JavaCallArgument
#ifdef ASSERT
- { Klass* holder = method->method_holder();
+ { InstanceKlass* holder = method->method_holder();
// A klass might not be initialized since JavaCall's might be used during the executing of
// the <clinit>. For example, a Thread.start might start executing on an object that is
// not fully initialized! (bad Java programming style)
- assert(InstanceKlass::cast(holder)->is_linked(), "rewritting must have taken place");
+ assert(holder->is_linked(), "rewritting must have taken place");
}
#endif
diff --git a/src/share/vm/runtime/reflection.cpp b/src/share/vm/runtime/reflection.cpp
index d87c7ae08..d4756bcf9 100644
--- a/src/share/vm/runtime/reflection.cpp
+++ b/src/share/vm/runtime/reflection.cpp
@@ -56,14 +56,14 @@ static void trace_class_resolution(Klass* to_class) {
vframeStream vfst(jthread);
// skip over any frames belonging to java.lang.Class
while (!vfst.at_end() &&
- InstanceKlass::cast(vfst.method()->method_holder())->name() == vmSymbols::java_lang_Class()) {
+ vfst.method()->method_holder()->name() == vmSymbols::java_lang_Class()) {
vfst.next();
}
if (!vfst.at_end()) {
// this frame is a likely suspect
caller = vfst.method()->method_holder();
line_number = vfst.method()->line_number_from_bci(vfst.bci());
- Symbol* s = InstanceKlass::cast(vfst.method()->method_holder())->source_file_name();
+ Symbol* s = vfst.method()->method_holder()->source_file_name();
if (s != NULL) {
source_file = s->as_C_string();
}
@@ -642,8 +642,8 @@ oop get_mirror_from_signature(methodHandle method, SignatureStream* ss, TRAPS) {
case T_OBJECT:
case T_ARRAY:
Symbol* name = ss->as_symbol(CHECK_NULL);
- oop loader = InstanceKlass::cast(method->method_holder())->class_loader();
- oop protection_domain = InstanceKlass::cast(method->method_holder())->protection_domain();
+ oop loader = method->method_holder()->class_loader();
+ oop protection_domain = method->method_holder()->protection_domain();
Klass* k = SystemDictionary::resolve_or_fail(
name,
Handle(THREAD, loader),
@@ -714,7 +714,7 @@ oop Reflection::new_method(methodHandle method, bool intern_name, bool for_const
assert(!method()->is_initializer() ||
(for_constant_pool_access && method()->is_static()) ||
(method()->name() == vmSymbols::class_initializer_name()
- && Klass::cast(method()->method_holder())->is_interface() && JDK_Version::is_jdk12x_version()), "should call new_constructor instead");
+ && method()->method_holder()->is_interface() && JDK_Version::is_jdk12x_version()), "should call new_constructor instead");
instanceKlassHandle holder (THREAD, method->method_holder());
int slot = method->method_idnum();
@@ -832,7 +832,7 @@ oop Reflection::new_field(fieldDescriptor* fd, bool intern_name, TRAPS) {
Handle type = new_type(signature, holder, CHECK_NULL);
Handle rh = java_lang_reflect_Field::create(CHECK_NULL);
- java_lang_reflect_Field::set_clazz(rh(), Klass::cast(fd->field_holder())->java_mirror());
+ java_lang_reflect_Field::set_clazz(rh(), fd->field_holder()->java_mirror());
java_lang_reflect_Field::set_slot(rh(), fd->index());
java_lang_reflect_Field::set_name(rh(), name());
java_lang_reflect_Field::set_type(rh(), type());
@@ -900,7 +900,7 @@ oop Reflection::invoke(instanceKlassHandle klass, methodHandle reflected_method,
method = reflected_method;
} else {
// resolve based on the receiver
- if (InstanceKlass::cast(reflected_method->method_holder())->is_interface()) {
+ if (reflected_method->method_holder()->is_interface()) {
// resolve interface call
if (ReflectionWrapResolutionErrors) {
// new default: 6531596
diff --git a/src/share/vm/runtime/vframe.cpp b/src/share/vm/runtime/vframe.cpp
index b1c2db818..382ac4b09 100644
--- a/src/share/vm/runtime/vframe.cpp
+++ b/src/share/vm/runtime/vframe.cpp
@@ -161,7 +161,7 @@ void javaVFrame::print_lock_info_on(outputStream* st, int frame_count) {
// If this is the first frame, and java.lang.Object.wait(...) then print out the receiver.
if (frame_count == 0) {
if (method()->name() == vmSymbols::wait_name() &&
- InstanceKlass::cast(method()->method_holder())->name() == vmSymbols::java_lang_Object()) {
+ method()->method_holder()->name() == vmSymbols::java_lang_Object()) {
StackValueCollection* locs = locals();
if (!locs->is_empty()) {
StackValue* sv = locs->at(0);
@@ -407,7 +407,7 @@ void vframeStreamCommon::security_get_caller_frame(int depth) {
if (Universe::reflect_invoke_cache()->is_same_method(method())) {
// This is Method.invoke() -- skip it
} else if (use_new_reflection &&
- Klass::cast(method()->method_holder())
+ method()->method_holder()
->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) {
// This is an auxilary frame -- skip it
} else if (method()->is_method_handle_intrinsic() ||
@@ -471,8 +471,8 @@ void vframeStreamCommon::skip_prefixed_method_and_wrappers() {
void vframeStreamCommon::skip_reflection_related_frames() {
while (!at_end() &&
(JDK_Version::is_gte_jdk14x_version() && UseNewReflection &&
- (Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) ||
- Klass::cast(method()->method_holder())->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) {
+ (method()->method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass()) ||
+ method()->method_holder()->is_subclass_of(SystemDictionary::reflect_ConstructorAccessorImpl_klass())))) {
next();
}
}
@@ -547,13 +547,13 @@ void javaVFrame::print() {
void javaVFrame::print_value() const {
Method* m = method();
- Klass* k = m->method_holder();
+ InstanceKlass* k = m->method_holder();
tty->print_cr("frame( sp=" INTPTR_FORMAT ", unextended_sp=" INTPTR_FORMAT ", fp=" INTPTR_FORMAT ", pc=" INTPTR_FORMAT ")",
_fr.sp(), _fr.unextended_sp(), _fr.fp(), _fr.pc());
tty->print("%s.%s", Klass::cast(k)->internal_name(), m->name()->as_C_string());
if (!m->is_native()) {
- Symbol* source_name = InstanceKlass::cast(k)->source_file_name();
+ Symbol* source_name = k->source_file_name();
int line_number = m->line_number_from_bci(bci());
if (source_name != NULL && (line_number != -1)) {
tty->print("(%s:%d)", source_name->as_C_string(), line_number);
diff --git a/src/share/vm/runtime/vmStructs.cpp b/src/share/vm/runtime/vmStructs.cpp
index 367f3f8e0..eb6d3cd78 100644
--- a/src/share/vm/runtime/vmStructs.cpp
+++ b/src/share/vm/runtime/vmStructs.cpp
@@ -289,7 +289,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
nonstatic_field(CompiledICHolder, _holder_klass, Klass*) \
nonstatic_field(ConstantPool, _tags, Array<u1>*) \
nonstatic_field(ConstantPool, _cache, ConstantPoolCache*) \
- nonstatic_field(ConstantPool, _pool_holder, Klass*) \
+ nonstatic_field(ConstantPool, _pool_holder, InstanceKlass*) \
nonstatic_field(ConstantPool, _operands, Array<u2>*) \
nonstatic_field(ConstantPool, _length, int) \
nonstatic_field(ConstantPool, _resolved_references, jobject) \