Skip to content
2 changes: 1 addition & 1 deletion src/hotspot/share/classfile/javaClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,7 @@ JFR_ONLY(int java_lang_Thread::_jfr_epoch_offset;)
#define THREAD_FIELDS_DO(macro) \
macro(_holder_offset, k, "holder", thread_fieldholder_signature, false); \
macro(_name_offset, k, vmSymbols::name_name(), string_signature, false); \
macro(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), classloader_signature, false); \
macro(_contextClassLoader_offset, k, "contextClassLoader", classloader_signature, false); \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't think the context class loader was related to SM in any way. ??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't. This symbol was near the ones I deleted, and I deleted it by mistake, so I moved it here.

macro(_eetop_offset, k, "eetop", long_signature, false); \
macro(_interrupted_offset, k, "interrupted", bool_signature, false); \
macro(_interruptLock_offset, k, "interruptLock", object_signature, false); \
Expand Down
3 changes: 0 additions & 3 deletions src/hotspot/share/classfile/vmSymbols.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,6 @@ class SerializeClosure;
template(getCause_name, "getCause") \
template(initCause_name, "initCause") \
template(getProperty_name, "getProperty") \
template(context_name, "context") \
template(contextClassLoader_name, "contextClassLoader") \
template(getClassContext_name, "getClassContext") \
template(wait_name, "wait0") \
template(forName_name, "forName") \
template(forName0_name, "forName0") \
Expand Down
6 changes: 0 additions & 6 deletions src/hotspot/share/include/jvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,6 @@ JVM_GetNextThreadIdOffset(JNIEnv *env, jclass threadClass);
JNIEXPORT void JNICALL
JVM_RegisterContinuationMethods(JNIEnv *env, jclass cls);

/*
* java.lang.SecurityManager
*/
JNIEXPORT jobjectArray JNICALL
JVM_GetClassContext(JNIEnv *env);

/*
* java.lang.Package
*/
Expand Down
40 changes: 0 additions & 40 deletions src/hotspot/share/prims/jvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3055,46 +3055,6 @@ JVM_ENTRY(void, JVM_SetScopedValueCache(JNIEnv* env, jclass threadClass,
thread->set_scopedValueCache(objs);
JVM_END

// java.lang.SecurityManager ///////////////////////////////////////////////////////////////////////

JVM_ENTRY(jobjectArray, JVM_GetClassContext(JNIEnv *env))
ResourceMark rm(THREAD);
JvmtiVMObjectAllocEventCollector oam;
vframeStream vfst(thread);

if (vmClasses::reflect_CallerSensitive_klass() != nullptr) {
// This must only be called from SecurityManager.getClassContext
// Also this?
Method* m = vfst.method();
if (!(m->method_holder() == vmClasses::SecurityManager_klass() &&
m->name() == vmSymbols::getClassContext_name() &&
m->signature() == vmSymbols::void_class_array_signature())) {
THROW_MSG_NULL(vmSymbols::java_lang_InternalError(), "JVM_GetClassContext must only be called from SecurityManager.getClassContext");
}
}

// Collect method holders
GrowableArray<Klass*>* klass_array = new GrowableArray<Klass*>();
for (; !vfst.at_end(); vfst.security_next()) {
Method* m = vfst.method();
// Native frames are not returned
if (!m->is_ignored_by_security_stack_walk() && !m->is_native()) {
Klass* holder = m->method_holder();
assert(holder->is_klass(), "just checking");
klass_array->append(holder);
}
}

// Create result array of type [Ljava/lang/Class;
objArrayOop result = oopFactory::new_objArray(vmClasses::Class_klass(), klass_array->length(), CHECK_NULL);
// Fill in mirrors corresponding to method holders
for (int i = 0; i < klass_array->length(); i++) {
result->obj_at_put(i, klass_array->at(i)->java_mirror());
}

return (jobjectArray) JNIHandles::make_local(THREAD, result);
JVM_END


// java.lang.Package ////////////////////////////////////////////////////////////////

Expand Down