Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/method.cpp @ 8883:b9a918201d47
Merge with hsx25
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Sat, 06 Apr 2013 20:04:06 +0200 |
parents | 6c4db417385a 0ca3dd0ffaba |
children | ff5a32117e02 |
comparison
equal
deleted
inserted
replaced
8660:d47b52b0ff68 | 8883:b9a918201d47 |
---|---|
75 int size = Method::size(access_flags.is_native()); | 75 int size = Method::size(access_flags.is_native()); |
76 | 76 |
77 return new (loader_data, size, false, THREAD) Method(cm, access_flags, size); | 77 return new (loader_data, size, false, THREAD) Method(cm, access_flags, size); |
78 } | 78 } |
79 | 79 |
80 Method::Method(ConstMethod* xconst, | 80 Method::Method(ConstMethod* xconst, AccessFlags access_flags, int size) { |
81 AccessFlags access_flags, int size) { | |
82 No_Safepoint_Verifier no_safepoint; | 81 No_Safepoint_Verifier no_safepoint; |
83 set_constMethod(xconst); | 82 set_constMethod(xconst); |
84 set_access_flags(access_flags); | 83 set_access_flags(access_flags); |
85 set_method_size(size); | 84 set_method_size(size); |
86 set_name_index(0); | |
87 set_signature_index(0); | |
88 #ifdef CC_INTERP | 85 #ifdef CC_INTERP |
89 set_result_index(T_VOID); | 86 set_result_index(T_VOID); |
90 #endif | 87 #endif |
91 set_constants(NULL); | |
92 set_max_stack(0); | |
93 set_max_locals(0); | |
94 set_intrinsic_id(vmIntrinsics::_none); | 88 set_intrinsic_id(vmIntrinsics::_none); |
95 set_jfr_towrite(false); | 89 set_jfr_towrite(false); |
90 set_force_inline(false); | |
91 set_hidden(false); | |
92 set_dont_inline(false); | |
96 set_method_data(NULL); | 93 set_method_data(NULL); |
97 set_interpreter_throwout_count(0); | 94 set_interpreter_throwout_count(0); |
98 set_vtable_index(Method::garbage_vtable_index); | 95 set_vtable_index(Method::garbage_vtable_index); |
99 | 96 |
100 // Fix and bury in Method* | 97 // Fix and bury in Method* |
804 NOT_PRODUCT(set_compiled_invocation_count(0);) | 801 NOT_PRODUCT(set_compiled_invocation_count(0);) |
805 invocation_counter()->reset(); | 802 invocation_counter()->reset(); |
806 backedge_counter()->reset(); | 803 backedge_counter()->reset(); |
807 _adapter = NULL; | 804 _adapter = NULL; |
808 _from_compiled_entry = NULL; | 805 _from_compiled_entry = NULL; |
809 assert(_method_data == NULL, "unexpected method data?"); | 806 |
807 // In case of DumpSharedSpaces, _method_data should always be NULL. | |
808 // | |
809 // During runtime (!DumpSharedSpaces), when we are cleaning a | |
810 // shared class that failed to load, this->link_method() may | |
811 // have already been called (before an exception happened), so | |
812 // this->_method_data may not be NULL. | |
813 assert(!DumpSharedSpaces || _method_data == NULL, "unexpected method data?"); | |
814 | |
810 set_method_data(NULL); | 815 set_method_data(NULL); |
811 set_interpreter_throwout_count(0); | 816 set_interpreter_throwout_count(0); |
812 set_interpreter_invocation_count(0); | 817 set_interpreter_invocation_count(0); |
813 } | 818 } |
814 | 819 |
964 } | 969 } |
965 | 970 |
966 // caching this method should be just fine | 971 // caching this method should be just fine |
967 return false; | 972 return false; |
968 } | 973 } |
974 | |
975 | |
976 /** | |
977 * Returns true if this is one of the specially treated methods for | |
978 * security related stack walks (like Reflection.getCallerClass). | |
979 */ | |
980 bool Method::is_ignored_by_security_stack_walk() const { | |
981 const bool use_new_reflection = JDK_Version::is_gte_jdk14x_version() && UseNewReflection; | |
982 | |
983 assert(intrinsic_id() != vmIntrinsics::_invoke || Universe::reflect_invoke_cache()->is_same_method((Method*)this), "sanity"); | |
984 if (intrinsic_id() == vmIntrinsics::_invoke) { | |
985 // This is Method.invoke() -- ignore it | |
986 return true; | |
987 } | |
988 if (use_new_reflection && | |
989 method_holder()->is_subclass_of(SystemDictionary::reflect_MethodAccessorImpl_klass())) { | |
990 // This is an auxilary frame -- ignore it | |
991 return true; | |
992 } | |
993 if (is_method_handle_intrinsic() || is_compiled_lambda_form()) { | |
994 // This is an internal adapter frame for method handles -- ignore it | |
995 return true; | |
996 } | |
997 return false; | |
998 } | |
999 | |
969 | 1000 |
970 // Constant pool structure for invoke methods: | 1001 // Constant pool structure for invoke methods: |
971 enum { | 1002 enum { |
972 _imcp_invoke_name = 1, // utf8: 'invokeExact', etc. | 1003 _imcp_invoke_name = 1, // utf8: 'invokeExact', etc. |
973 _imcp_invoke_signature, // utf8: (variable Symbol*) | 1004 _imcp_invoke_signature, // utf8: (variable Symbol*) |
1168 memcpy((void*)stackmap_data->adr_at(0), | 1199 memcpy((void*)stackmap_data->adr_at(0), |
1169 (void*)m->stackmap_data()->adr_at(0), code_attribute_length); | 1200 (void*)m->stackmap_data()->adr_at(0), code_attribute_length); |
1170 newm->set_stackmap_data(stackmap_data); | 1201 newm->set_stackmap_data(stackmap_data); |
1171 } | 1202 } |
1172 | 1203 |
1204 // copy annotations over to new method | |
1205 newcm->copy_annotations_from(cm); | |
1173 return newm; | 1206 return newm; |
1174 } | 1207 } |
1175 | 1208 |
1176 vmSymbols::SID Method::klass_id_for_intrinsics(Klass* holder) { | 1209 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 | 1210 // 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 | 1211 // because we are not loading from core libraries |
1179 // exception: the AES intrinsics come from lib/ext/sunjce_provider.jar | 1212 // 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 | 1213 // which does not use the class default class loader so we check for its loader here |
1181 if ((InstanceKlass::cast(holder)->class_loader() != NULL) && | 1214 InstanceKlass* ik = InstanceKlass::cast(holder); |
1182 InstanceKlass::cast(holder)->class_loader()->klass()->name() != vmSymbols::sun_misc_Launcher_ExtClassLoader()) { | 1215 if ((ik->class_loader() != NULL) && !SystemDictionary::is_ext_class_loader(ik->class_loader())) { |
1183 return vmSymbols::NO_SID; // regardless of name, no intrinsics here | 1216 return vmSymbols::NO_SID; // regardless of name, no intrinsics here |
1184 } | 1217 } |
1185 | 1218 |
1186 // see if the klass name is well-known: | 1219 // see if the klass name is well-known: |
1187 Symbol* klass_name = InstanceKlass::cast(holder)->name(); | 1220 Symbol* klass_name = ik->name(); |
1188 return vmSymbols::find_sid(klass_name); | 1221 return vmSymbols::find_sid(klass_name); |
1189 } | 1222 } |
1190 | 1223 |
1191 void Method::init_intrinsic_id() { | 1224 void Method::init_intrinsic_id() { |
1192 assert(_intrinsic_id == vmIntrinsics::_none, "do this just once"); | 1225 assert(_intrinsic_id == vmIntrinsics::_none, "do this just once"); |