-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8349860: Make Class.isArray(), Class.isInterface() and Class.isPrimitive() non-native #23572
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f0133fc
072f332
c0e9919
e8119a2
2d9b9ff
3e731b9
d08091a
7a4c595
0234743
c23718b
db7c978
591abdd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1187,20 +1187,6 @@ JVM_ENTRY(jobjectArray, JVM_GetClassInterfaces(JNIEnv *env, jclass cls)) | |
JVM_END | ||
|
||
|
||
JVM_ENTRY(jboolean, JVM_IsInterface(JNIEnv *env, jclass cls)) | ||
oop mirror = JNIHandles::resolve_non_null(cls); | ||
if (java_lang_Class::is_primitive(mirror)) { | ||
return JNI_FALSE; | ||
} | ||
Klass* k = java_lang_Class::as_Klass(mirror); | ||
jboolean result = k->is_interface(); | ||
assert(!result || k->is_instance_klass(), | ||
"all interfaces are instance types"); | ||
// The compiler intrinsic for isInterface tests the | ||
// Klass::_access_flags bits in the same way. | ||
return result; | ||
JVM_END | ||
|
||
JVM_ENTRY(jboolean, JVM_IsHiddenClass(JNIEnv *env, jclass cls)) | ||
oop mirror = JNIHandles::resolve_non_null(cls); | ||
if (java_lang_Class::is_primitive(mirror)) { | ||
|
@@ -1259,18 +1245,6 @@ JVM_ENTRY(jobject, JVM_FindScopedValueBindings(JNIEnv *env, jclass cls)) | |
return nullptr; | ||
JVM_END | ||
|
||
JVM_ENTRY(jboolean, JVM_IsArrayClass(JNIEnv *env, jclass cls)) | ||
coleenp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls)); | ||
return (k != nullptr) && k->is_array_klass() ? true : false; | ||
JVM_END | ||
|
||
|
||
JVM_ENTRY(jboolean, JVM_IsPrimitiveClass(JNIEnv *env, jclass cls)) | ||
oop mirror = JNIHandles::resolve_non_null(cls); | ||
return (jboolean) java_lang_Class::is_primitive(mirror); | ||
JVM_END | ||
|
||
|
||
JVM_ENTRY(jobjectArray, JVM_GetDeclaredClasses(JNIEnv *env, jclass ofClass)) | ||
JvmtiVMObjectAllocEventCollector oam; | ||
// ofClass is a reference to a java_lang_Class object. The mirror object | ||
|
@@ -2305,7 +2279,23 @@ JVM_END | |
// The function returns a Klass* of the _scratch_class if the verifier | ||
// was invoked in the middle of the class redefinition. | ||
// Otherwise it returns its argument value which is the _the_class Klass*. | ||
// Please, refer to the description in the jvmtiThreadSate.hpp. | ||
// Please, refer to the description in the jvmtiThreadState.hpp. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this "RedefineClasses support" comment still belong here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think so. The comment in jvmtiThreadState.hpp has details why this is. We do a mirror switch before verification apparently because of bug 6214132 it says. |
||
JVM_ENTRY(jboolean, JVM_IsInterface(JNIEnv *env, jclass cls)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JVM_IsInteface is deleted in Class.c, what purpose is this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The old classfile verifier uses JVM_IsInterface. |
||
oop mirror = JNIHandles::resolve_non_null(cls); | ||
if (java_lang_Class::is_primitive(mirror)) { | ||
return JNI_FALSE; | ||
} | ||
Klass* k = java_lang_Class::as_Klass(mirror); | ||
// This isn't necessary since answer is the same since redefinition | ||
// has already checked this matches for the scratch class. | ||
// k = JvmtiThreadState::class_to_verify_considering_redefinition(k, thread); | ||
jboolean result = k->is_interface(); | ||
assert(!result || k->is_instance_klass(), | ||
"all interfaces are instance types"); | ||
return result; | ||
JVM_END | ||
|
||
|
||
JVM_ENTRY(const char*, JVM_GetClassNameUTF(JNIEnv *env, jclass cls)) | ||
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls)); | ||
|
Uh oh!
There was an error while loading. Please reload this page.