hotspot/src/share/vm/oops/method.cpp
changeset 14391 df0a1573d5bd
parent 14386 9ef88e958f4b
child 14488 ab48109f7d1b
--- a/hotspot/src/share/vm/oops/method.cpp	Thu Oct 04 14:55:57 2012 +0200
+++ b/hotspot/src/share/vm/oops/method.cpp	Tue Nov 06 15:09:37 2012 -0500
@@ -243,12 +243,12 @@
       warning("oopmap should only be accessed by the "
               "VM, GC task or CMS threads (or during debugging)");
       InterpreterOopMap local_mask;
-      InstanceKlass::cast(method_holder())->mask_for(h_this, bci, &local_mask);
+      method_holder()->mask_for(h_this, bci, &local_mask);
       local_mask.print();
     }
   }
 #endif
-  InstanceKlass::cast(method_holder())->mask_for(h_this, bci, mask);
+  method_holder()->mask_for(h_this, bci, mask);
   return;
 }
 
@@ -523,7 +523,7 @@
 bool Method::is_final_method() const {
   // %%% Should return true for private methods also,
   // since there is no way to override them.
-  return is_final() || Klass::cast(method_holder())->is_final();
+  return is_final() || method_holder()->is_final();
 }
 
 
@@ -555,7 +555,7 @@
 
 bool Method::has_valid_initializer_flags() const {
   return (is_static() ||
-          InstanceKlass::cast(method_holder())->major_version() < 51);
+          method_holder()->major_version() < 51);
 }
 
 bool Method::is_static_initializer() const {
@@ -617,7 +617,7 @@
   if( constants()->tag_at(klass_index).is_unresolved_klass() ) {
     Thread *thread = Thread::current();
     Symbol* klass_name = constants()->klass_name_at(klass_index);
-    Handle loader(thread, InstanceKlass::cast(method_holder())->class_loader());
+    Handle loader(thread, method_holder()->class_loader());
     Handle prot  (thread, Klass::cast(method_holder())->protection_domain());
     return SystemDictionary::find(klass_name, loader, prot, thread) != NULL;
   } else {
@@ -935,7 +935,7 @@
 
   // If method is an interface, we skip it - except if it
   // is a miranda method
-  if (InstanceKlass::cast(method_holder())->is_interface()) {
+  if (method_holder()->is_interface()) {
     // Check that method is not a miranda method
     if (ik->lookup_method(name(), signature()) == NULL) {
       // No implementation exist - so miranda method
@@ -1020,7 +1020,7 @@
     ConstantPool* cp_oop = ConstantPool::allocate(loader_data, cp_length, CHECK_(empty));
     cp = constantPoolHandle(THREAD, cp_oop);
   }
-  cp->set_pool_holder(holder());
+  cp->set_pool_holder(InstanceKlass::cast(holder()));
   cp->symbol_at_put(_imcp_invoke_name,       name);
   cp->symbol_at_put(_imcp_invoke_signature,  signature);
   cp->set_preresolution();
@@ -1237,8 +1237,8 @@
     return false;
   }
   bool sig_is_loaded = true;
-  Handle class_loader(THREAD, InstanceKlass::cast(m->method_holder())->class_loader());
-  Handle protection_domain(THREAD, Klass::cast(m->method_holder())->protection_domain());
+  Handle class_loader(THREAD, m->method_holder()->class_loader());
+  Handle protection_domain(THREAD, m->method_holder()->protection_domain());
   ResourceMark rm(THREAD);
   Symbol*  signature = m->signature();
   for(SignatureStream ss(signature); !ss.is_done(); ss.next()) {
@@ -1264,8 +1264,8 @@
 }
 
 bool Method::has_unloaded_classes_in_signature(methodHandle m, TRAPS) {
-  Handle class_loader(THREAD, InstanceKlass::cast(m->method_holder())->class_loader());
-  Handle protection_domain(THREAD, Klass::cast(m->method_holder())->protection_domain());
+  Handle class_loader(THREAD, m->method_holder()->class_loader());
+  Handle protection_domain(THREAD, m->method_holder()->protection_domain());
   ResourceMark rm(THREAD);
   Symbol*  signature = m->signature();
   for(SignatureStream ss(signature); !ss.is_done(); ss.next()) {
@@ -1472,7 +1472,7 @@
 
 
 Bytecodes::Code Method::orig_bytecode_at(int bci) const {
-  BreakpointInfo* bp = InstanceKlass::cast(method_holder())->breakpoints();
+  BreakpointInfo* bp = method_holder()->breakpoints();
   for (; bp != NULL; bp = bp->next()) {
     if (bp->match(this, bci)) {
       return bp->orig_bytecode();
@@ -1484,7 +1484,7 @@
 
 void Method::set_orig_bytecode_at(int bci, Bytecodes::Code code) {
   assert(code != Bytecodes::_breakpoint, "cannot patch breakpoints this way");
-  BreakpointInfo* bp = InstanceKlass::cast(method_holder())->breakpoints();
+  BreakpointInfo* bp = method_holder()->breakpoints();
   for (; bp != NULL; bp = bp->next()) {
     if (bp->match(this, bci)) {
       bp->set_orig_bytecode(code);
@@ -1494,7 +1494,7 @@
 }
 
 void Method::set_breakpoint(int bci) {
-  InstanceKlass* ik = InstanceKlass::cast(method_holder());
+  InstanceKlass* ik = method_holder();
   BreakpointInfo *bp = new BreakpointInfo(this, bci);
   bp->set_next(ik->breakpoints());
   ik->set_breakpoints(bp);
@@ -1503,7 +1503,7 @@
 }
 
 static void clear_matches(Method* m, int bci) {
-  InstanceKlass* ik = InstanceKlass::cast(m->method_holder());
+  InstanceKlass* ik = m->method_holder();
   BreakpointInfo* prev_bp = NULL;
   BreakpointInfo* next_bp;
   for (BreakpointInfo* bp = ik->breakpoints(); bp != NULL; bp = next_bp) {
@@ -1786,7 +1786,7 @@
 bool Method::is_method_id(jmethodID mid) {
   Method* m = resolve_jmethod_id(mid);
   assert(m != NULL, "should be called with non-null method");
-  InstanceKlass* ik = InstanceKlass::cast(m->method_holder());
+  InstanceKlass* ik = m->method_holder();
   ClassLoaderData* cld = ik->class_loader_data();
   if (cld->jmethod_ids() == NULL) return false;
   return (cld->jmethod_ids()->contains((Method**)mid));