86 #include "utilities/dtrace.hpp" |
86 #include "utilities/dtrace.hpp" |
87 #include "utilities/events.hpp" |
87 #include "utilities/events.hpp" |
88 #include "utilities/histogram.hpp" |
88 #include "utilities/histogram.hpp" |
89 #include "utilities/macros.hpp" |
89 #include "utilities/macros.hpp" |
90 #include "utilities/vmError.hpp" |
90 #include "utilities/vmError.hpp" |
91 #if INCLUDE_JVMCI |
|
92 #include "jvmci/jvmciCompiler.hpp" |
|
93 #include "jvmci/jvmciRuntime.hpp" |
|
94 #endif |
|
95 |
91 |
96 static jint CurrentVersion = JNI_VERSION_10; |
92 static jint CurrentVersion = JNI_VERSION_10; |
97 |
93 |
98 #ifdef _WIN32 |
94 #ifdef _WIN32 |
99 extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* ); |
95 extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* ); |
1316 |
1312 |
1317 if (name == NULL || signature == NULL) { |
1313 if (name == NULL || signature == NULL) { |
1318 THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), name_str); |
1314 THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), name_str); |
1319 } |
1315 } |
1320 |
1316 |
|
1317 Klass* klass = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)); |
|
1318 |
1321 // Throw a NoSuchMethodError exception if we have an instance of a |
1319 // Throw a NoSuchMethodError exception if we have an instance of a |
1322 // primitive java.lang.Class |
1320 // primitive java.lang.Class |
1323 if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(clazz))) { |
1321 if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(clazz))) { |
1324 THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), name_str); |
1322 ResourceMark rm; |
1325 } |
1323 THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), err_msg("%s%s.%s%s", is_static ? "static " : "", klass->signature_name(), name_str, sig)); |
1326 |
1324 } |
1327 Klass* klass = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)); |
|
1328 |
1325 |
1329 // Make sure class is linked and initialized before handing id's out to |
1326 // Make sure class is linked and initialized before handing id's out to |
1330 // Method*s. |
1327 // Method*s. |
1331 klass->initialize(CHECK_NULL); |
1328 klass->initialize(CHECK_NULL); |
1332 |
1329 |
1344 if (m == NULL && klass->is_instance_klass()) { |
1341 if (m == NULL && klass->is_instance_klass()) { |
1345 m = InstanceKlass::cast(klass)->lookup_method_in_ordered_interfaces(name, signature); |
1342 m = InstanceKlass::cast(klass)->lookup_method_in_ordered_interfaces(name, signature); |
1346 } |
1343 } |
1347 } |
1344 } |
1348 if (m == NULL || (m->is_static() != is_static)) { |
1345 if (m == NULL || (m->is_static() != is_static)) { |
1349 THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), name_str); |
1346 ResourceMark rm; |
|
1347 THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), err_msg("%s%s.%s%s", is_static ? "static " : "", klass->signature_name(), name_str, sig)); |
1350 } |
1348 } |
1351 return m->jmethod_id(); |
1349 return m->jmethod_id(); |
1352 } |
1350 } |
1353 |
1351 |
1354 |
1352 |
2012 JNIWrapper("GetFieldID"); |
2010 JNIWrapper("GetFieldID"); |
2013 HOTSPOT_JNI_GETFIELDID_ENTRY(env, clazz, (char *) name, (char *) sig); |
2011 HOTSPOT_JNI_GETFIELDID_ENTRY(env, clazz, (char *) name, (char *) sig); |
2014 jfieldID ret = 0; |
2012 jfieldID ret = 0; |
2015 DT_RETURN_MARK(GetFieldID, jfieldID, (const jfieldID&)ret); |
2013 DT_RETURN_MARK(GetFieldID, jfieldID, (const jfieldID&)ret); |
2016 |
2014 |
|
2015 Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)); |
|
2016 |
2017 // The class should have been loaded (we have an instance of the class |
2017 // The class should have been loaded (we have an instance of the class |
2018 // passed in) so the field and signature should already be in the symbol |
2018 // passed in) so the field and signature should already be in the symbol |
2019 // table. If they're not there, the field doesn't exist. |
2019 // table. If they're not there, the field doesn't exist. |
2020 TempNewSymbol fieldname = SymbolTable::probe(name, (int)strlen(name)); |
2020 TempNewSymbol fieldname = SymbolTable::probe(name, (int)strlen(name)); |
2021 TempNewSymbol signame = SymbolTable::probe(sig, (int)strlen(sig)); |
2021 TempNewSymbol signame = SymbolTable::probe(sig, (int)strlen(sig)); |
2022 if (fieldname == NULL || signame == NULL) { |
2022 if (fieldname == NULL || signame == NULL) { |
2023 THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name); |
2023 ResourceMark rm; |
2024 } |
2024 THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), err_msg("%s.%s %s", k->external_name(), name, sig)); |
2025 Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(clazz)); |
2025 } |
|
2026 |
2026 // Make sure class is initialized before handing id's out to fields |
2027 // Make sure class is initialized before handing id's out to fields |
2027 k->initialize(CHECK_NULL); |
2028 k->initialize(CHECK_NULL); |
2028 |
2029 |
2029 fieldDescriptor fd; |
2030 fieldDescriptor fd; |
2030 if (!k->is_instance_klass() || |
2031 if (!k->is_instance_klass() || |
2031 !InstanceKlass::cast(k)->find_field(fieldname, signame, false, &fd)) { |
2032 !InstanceKlass::cast(k)->find_field(fieldname, signame, false, &fd)) { |
2032 THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), (char*) name); |
2033 ResourceMark rm; |
|
2034 THROW_MSG_0(vmSymbols::java_lang_NoSuchFieldError(), err_msg("%s.%s %s", k->external_name(), name, sig)); |
2033 } |
2035 } |
2034 |
2036 |
2035 // A jfieldID for a non-static field is simply the offset of the field within the instanceOop |
2037 // A jfieldID for a non-static field is simply the offset of the field within the instanceOop |
2036 // It may also have hash bits for k, if VerifyJNIFields is turned on. |
2038 // It may also have hash bits for k, if VerifyJNIFields is turned on. |
2037 ret = jfieldIDWorkaround::to_instance_jfieldID(k, fd.offset()); |
2039 ret = jfieldIDWorkaround::to_instance_jfieldID(k, fd.offset()); |