Skip to content
Permalink
Browse files
8261449: Micro-optimize JVM_LatestUserDefinedLoader
Reviewed-by: dholmes, stuefe, alanb
  • Loading branch information
shipilev committed Feb 11, 2021
1 parent 837bd89 commit 49cf13d2fb1581342cda8c43360ac931e52a4d3e
Showing with 7 additions and 16 deletions.
  1. +7 −3 src/hotspot/share/prims/jvm.cpp
  2. +0 −9 src/hotspot/share/runtime/vframe.cpp
  3. +0 −4 src/hotspot/share/runtime/vframe.hpp
@@ -3287,10 +3287,14 @@ JVM_END

JVM_ENTRY(jobject, JVM_LatestUserDefinedLoader(JNIEnv *env))
for (vframeStream vfst(thread); !vfst.at_end(); vfst.next()) {
vfst.skip_reflection_related_frames(); // Only needed for 1.4 reflection
oop loader = vfst.method()->method_holder()->class_loader();
InstanceKlass* ik = vfst.method()->method_holder();
oop loader = ik->class_loader();
if (loader != NULL && !SystemDictionary::is_platform_class_loader(loader)) {
return JNIHandles::make_local(THREAD, loader);
// Skip reflection related frames
if (!ik->is_subclass_of(vmClasses::reflect_MethodAccessorImpl_klass()) &&
!ik->is_subclass_of(vmClasses::reflect_ConstructorAccessorImpl_klass())) {
return JNIHandles::make_local(THREAD, loader);
}
}
}
return NULL;
@@ -562,15 +562,6 @@ void vframeStreamCommon::skip_prefixed_method_and_wrappers() {
}
}


void vframeStreamCommon::skip_reflection_related_frames() {
while (!at_end() &&
(method()->method_holder()->is_subclass_of(vmClasses::reflect_MethodAccessorImpl_klass()) ||
method()->method_holder()->is_subclass_of(vmClasses::reflect_ConstructorAccessorImpl_klass()))) {
next();
}
}

javaVFrame* vframeStreamCommon::asJavaVFrame() {
javaVFrame* result = NULL;
if (_mode == compiled_mode) {
@@ -328,10 +328,6 @@ class vframeStreamCommon : StackObj {
// Implements security traversal. Skips depth no. of frame including
// special security frames and prefixed native methods
void security_get_caller_frame(int depth);

// Helper routine for JVM_LatestUserDefinedLoader -- needed for 1.4
// reflection implementation
void skip_reflection_related_frames();
};

class vframeStream : public vframeStreamCommon {

0 comments on commit 49cf13d

Please sign in to comment.