hotspot/src/share/vm/opto/doCall.cpp
changeset 30223 82ab7b6b4927
parent 28640 01e4ca94fb0d
child 32582 56619bb8bcaa
equal deleted inserted replaced
30222:bfe6be3c4ef8 30223:82ab7b6b4927
   957 
   957 
   958 
   958 
   959 ciMethod* Compile::optimize_virtual_call(ciMethod* caller, int bci, ciInstanceKlass* klass,
   959 ciMethod* Compile::optimize_virtual_call(ciMethod* caller, int bci, ciInstanceKlass* klass,
   960                                          ciKlass* holder, ciMethod* callee,
   960                                          ciKlass* holder, ciMethod* callee,
   961                                          const TypeOopPtr* receiver_type, bool is_virtual,
   961                                          const TypeOopPtr* receiver_type, bool is_virtual,
   962                                          bool& call_does_dispatch, int& vtable_index) {
   962                                          bool& call_does_dispatch, int& vtable_index,
       
   963                                          bool check_access) {
   963   // Set default values for out-parameters.
   964   // Set default values for out-parameters.
   964   call_does_dispatch = true;
   965   call_does_dispatch = true;
   965   vtable_index       = Method::invalid_vtable_index;
   966   vtable_index       = Method::invalid_vtable_index;
   966 
   967 
   967   // Choose call strategy.
   968   // Choose call strategy.
   968   ciMethod* optimized_virtual_method = optimize_inlining(caller, bci, klass, callee, receiver_type);
   969   ciMethod* optimized_virtual_method = optimize_inlining(caller, bci, klass, callee,
       
   970                                                          receiver_type, check_access);
   969 
   971 
   970   // Have the call been sufficiently improved such that it is no longer a virtual?
   972   // Have the call been sufficiently improved such that it is no longer a virtual?
   971   if (optimized_virtual_method != NULL) {
   973   if (optimized_virtual_method != NULL) {
   972     callee             = optimized_virtual_method;
   974     callee             = optimized_virtual_method;
   973     call_does_dispatch = false;
   975     call_does_dispatch = false;
   978   return callee;
   980   return callee;
   979 }
   981 }
   980 
   982 
   981 // Identify possible target method and inlining style
   983 // Identify possible target method and inlining style
   982 ciMethod* Compile::optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* klass,
   984 ciMethod* Compile::optimize_inlining(ciMethod* caller, int bci, ciInstanceKlass* klass,
   983                                      ciMethod* callee, const TypeOopPtr* receiver_type) {
   985                                      ciMethod* callee, const TypeOopPtr* receiver_type,
       
   986                                      bool check_access) {
   984   // only use for virtual or interface calls
   987   // only use for virtual or interface calls
   985 
   988 
   986   // If it is obviously final, do not bother to call find_monomorphic_target,
   989   // If it is obviously final, do not bother to call find_monomorphic_target,
   987   // because the class hierarchy checks are not needed, and may fail due to
   990   // because the class hierarchy checks are not needed, and may fail due to
   988   // incompletely loaded classes.  Since we do our own class loading checks
   991   // incompletely loaded classes.  Since we do our own class loading checks
  1018       actual_receiver_is_exact = receiver_type->klass_is_exact();
  1021       actual_receiver_is_exact = receiver_type->klass_is_exact();
  1019     }
  1022     }
  1020   }
  1023   }
  1021 
  1024 
  1022   ciInstanceKlass*   calling_klass = caller->holder();
  1025   ciInstanceKlass*   calling_klass = caller->holder();
  1023   ciMethod* cha_monomorphic_target = callee->find_monomorphic_target(calling_klass, klass, actual_receiver);
  1026   ciMethod* cha_monomorphic_target = callee->find_monomorphic_target(calling_klass, klass, actual_receiver, check_access);
  1024   if (cha_monomorphic_target != NULL) {
  1027   if (cha_monomorphic_target != NULL) {
  1025     assert(!cha_monomorphic_target->is_abstract(), "");
  1028     assert(!cha_monomorphic_target->is_abstract(), "");
  1026     // Look at the method-receiver type.  Does it add "too much information"?
  1029     // Look at the method-receiver type.  Does it add "too much information"?
  1027     ciKlass*    mr_klass = cha_monomorphic_target->holder();
  1030     ciKlass*    mr_klass = cha_monomorphic_target->holder();
  1028     const Type* mr_type  = TypeInstPtr::make(TypePtr::BotPTR, mr_klass);
  1031     const Type* mr_type  = TypeInstPtr::make(TypePtr::BotPTR, mr_klass);