hotspot/src/share/vm/oops/method.cpp
changeset 16631 c6860a0ebc99
parent 16588 7e90e795813e
parent 16617 6235d2c7549f
child 17000 11bf92e571a2
equal deleted inserted replaced
16610:899daa32f6a0 16631:c6860a0ebc99
   965 
   965 
   966   // caching this method should be just fine
   966   // caching this method should be just fine
   967   return false;
   967   return false;
   968 }
   968 }
   969 
   969 
       
   970 
       
   971 /**
       
   972  *  Returns true if this is one of the specially treated methods for
       
   973  *  security related stack walks (like Reflection.getCallerClass).
       
   974  */
       
   975 bool Method::is_ignored_by_security_stack_walk() const {
       
   976   const bool use_new_reflection = JDK_Version::is_gte_jdk14x_version() && UseNewReflection;
       
   977 
       
   978   assert(intrinsic_id() != vmIntrinsics::_invoke || Universe::reflect_invoke_cache()->is_same_method((Method*)this), "sanity");
       
   979   if (intrinsic_id() == vmIntrinsics::_invoke) {
       
   980     // This is Method.invoke() -- ignore it
       
   981     return true;
       
   982   }
       
   983   if (use_new_reflection &&
       
   984       method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) {
       
   985     // This is an auxilary frame -- ignore it
       
   986     return true;
       
   987   }
       
   988   if (is_method_handle_intrinsic() || is_compiled_lambda_form()) {
       
   989     // This is an internal adapter frame for method handles -- ignore it
       
   990     return true;
       
   991   }
       
   992   return false;
       
   993 }
       
   994 
       
   995 
   970 // Constant pool structure for invoke methods:
   996 // Constant pool structure for invoke methods:
   971 enum {
   997 enum {
   972   _imcp_invoke_name = 1,        // utf8: 'invokeExact', etc.
   998   _imcp_invoke_name = 1,        // utf8: 'invokeExact', etc.
   973   _imcp_invoke_signature,       // utf8: (variable Symbol*)
   999   _imcp_invoke_signature,       // utf8: (variable Symbol*)
   974   _imcp_limit
  1000   _imcp_limit
  1178 vmSymbols::SID Method::klass_id_for_intrinsics(Klass* holder) {
  1204 vmSymbols::SID Method::klass_id_for_intrinsics(Klass* holder) {
  1179   // if loader is not the default loader (i.e., != NULL), we can't know the intrinsics
  1205   // if loader is not the default loader (i.e., != NULL), we can't know the intrinsics
  1180   // because we are not loading from core libraries
  1206   // because we are not loading from core libraries
  1181   // exception: the AES intrinsics come from lib/ext/sunjce_provider.jar
  1207   // exception: the AES intrinsics come from lib/ext/sunjce_provider.jar
  1182   // which does not use the class default class loader so we check for its loader here
  1208   // which does not use the class default class loader so we check for its loader here
  1183   if ((InstanceKlass::cast(holder)->class_loader() != NULL) &&
  1209   InstanceKlass* ik = InstanceKlass::cast(holder);
  1184        InstanceKlass::cast(holder)->class_loader()->klass()->name() != vmSymbols::sun_misc_Launcher_ExtClassLoader()) {
  1210   if ((ik->class_loader() != NULL) && !SystemDictionary::is_ext_class_loader(ik->class_loader())) {
  1185     return vmSymbols::NO_SID;   // regardless of name, no intrinsics here
  1211     return vmSymbols::NO_SID;   // regardless of name, no intrinsics here
  1186   }
  1212   }
  1187 
  1213 
  1188   // see if the klass name is well-known:
  1214   // see if the klass name is well-known:
  1189   Symbol* klass_name = InstanceKlass::cast(holder)->name();
  1215   Symbol* klass_name = ik->name();
  1190   return vmSymbols::find_sid(klass_name);
  1216   return vmSymbols::find_sid(klass_name);
  1191 }
  1217 }
  1192 
  1218 
  1193 void Method::init_intrinsic_id() {
  1219 void Method::init_intrinsic_id() {
  1194   assert(_intrinsic_id == vmIntrinsics::_none, "do this just once");
  1220   assert(_intrinsic_id == vmIntrinsics::_none, "do this just once");