hotspot/src/share/vm/oops/method.cpp
changeset 16617 6235d2c7549f
parent 16352 1ff72c6eaa70
child 16631 c6860a0ebc99
equal deleted inserted replaced
16616:4c8e1c4a798b 16617:6235d2c7549f
   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
  1176 vmSymbols::SID Method::klass_id_for_intrinsics(Klass* holder) {
  1202 vmSymbols::SID Method::klass_id_for_intrinsics(Klass* holder) {
  1177   // if loader is not the default loader (i.e., != NULL), we can't know the intrinsics
  1203   // if loader is not the default loader (i.e., != NULL), we can't know the intrinsics
  1178   // because we are not loading from core libraries
  1204   // because we are not loading from core libraries
  1179   // exception: the AES intrinsics come from lib/ext/sunjce_provider.jar
  1205   // exception: the AES intrinsics come from lib/ext/sunjce_provider.jar
  1180   // which does not use the class default class loader so we check for its loader here
  1206   // which does not use the class default class loader so we check for its loader here
  1181   if ((InstanceKlass::cast(holder)->class_loader() != NULL) &&
  1207   InstanceKlass* ik = InstanceKlass::cast(holder);
  1182        InstanceKlass::cast(holder)->class_loader()->klass()->name() != vmSymbols::sun_misc_Launcher_ExtClassLoader()) {
  1208   if ((ik->class_loader() != NULL) && !SystemDictionary::is_ext_class_loader(ik->class_loader())) {
  1183     return vmSymbols::NO_SID;   // regardless of name, no intrinsics here
  1209     return vmSymbols::NO_SID;   // regardless of name, no intrinsics here
  1184   }
  1210   }
  1185 
  1211 
  1186   // see if the klass name is well-known:
  1212   // see if the klass name is well-known:
  1187   Symbol* klass_name = InstanceKlass::cast(holder)->name();
  1213   Symbol* klass_name = ik->name();
  1188   return vmSymbols::find_sid(klass_name);
  1214   return vmSymbols::find_sid(klass_name);
  1189 }
  1215 }
  1190 
  1216 
  1191 void Method::init_intrinsic_id() {
  1217 void Method::init_intrinsic_id() {
  1192   assert(_intrinsic_id == vmIntrinsics::_none, "do this just once");
  1218   assert(_intrinsic_id == vmIntrinsics::_none, "do this just once");