Skip to content
3 changes: 1 addition & 2 deletions src/hotspot/share/ci/ciEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1609,8 +1609,7 @@ void ciEnv::dump_replay_data_helper(outputStream* out) {
GrowableArray<ciMetadata*>* objects = _factory->get_ci_metadata();
out->print_cr("# %d ciObject found", objects->length());

// The very first entry is the InstanceKlass of the root method of the current compilation in order to get the right
// (class loader???) protection domain to load subsequent classes during replay compilation.
// The very first entry is the InstanceKlass of the root method of the current compilation.
ciInstanceKlass::dump_replay_instanceKlass(out, task()->method()->method_holder());

for (int i = 0; i < objects->length(); i++) {
Expand Down
42 changes: 0 additions & 42 deletions src/hotspot/share/classfile/javaClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4689,47 +4689,6 @@ DependencyContext java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdepend
return dep_ctx;
}

// Support for java_security_AccessControlContext

int java_security_AccessControlContext::_context_offset;
int java_security_AccessControlContext::_privilegedContext_offset;
int java_security_AccessControlContext::_isPrivileged_offset;
int java_security_AccessControlContext::_isAuthorized_offset;

#define ACCESSCONTROLCONTEXT_FIELDS_DO(macro) \
macro(_context_offset, k, "context", protectiondomain_signature, false); \
macro(_privilegedContext_offset, k, "privilegedContext", accesscontrolcontext_signature, false); \
macro(_isPrivileged_offset, k, "isPrivileged", bool_signature, false); \
macro(_isAuthorized_offset, k, "isAuthorized", bool_signature, false)

void java_security_AccessControlContext::compute_offsets() {
assert(_isPrivileged_offset == 0, "offsets should be initialized only once");
InstanceKlass* k = vmClasses::AccessControlContext_klass();
ACCESSCONTROLCONTEXT_FIELDS_DO(FIELD_COMPUTE_OFFSET);
}

#if INCLUDE_CDS
void java_security_AccessControlContext::serialize_offsets(SerializeClosure* f) {
ACCESSCONTROLCONTEXT_FIELDS_DO(FIELD_SERIALIZE_OFFSET);
}
#endif

oop java_security_AccessControlContext::create(objArrayHandle context, bool isPrivileged, Handle privileged_context, TRAPS) {
assert(_isPrivileged_offset != 0, "offsets should have been initialized");
assert(_isAuthorized_offset != 0, "offsets should have been initialized");
// Ensure klass is initialized
vmClasses::AccessControlContext_klass()->initialize(CHECK_NULL);
// Allocate result
oop result = vmClasses::AccessControlContext_klass()->allocate_instance(CHECK_NULL);
// Fill in values
result->obj_field_put(_context_offset, context());
result->obj_field_put(_privilegedContext_offset, privileged_context());
result->bool_field_put(_isPrivileged_offset, isPrivileged);
result->bool_field_put(_isAuthorized_offset, true);
return result;
}


// Support for java_lang_ClassLoader

int java_lang_ClassLoader::_loader_data_offset;
Expand Down Expand Up @@ -5380,7 +5339,6 @@ void java_lang_InternalError::serialize_offsets(SerializeClosure* f) {
f(java_lang_invoke_CallSite) \
f(java_lang_invoke_ConstantCallSite) \
f(java_lang_invoke_MethodHandleNatives_CallSiteContext) \
f(java_security_AccessControlContext) \
f(java_lang_reflect_AccessibleObject) \
f(java_lang_reflect_Method) \
f(java_lang_reflect_Constructor) \
Expand Down
21 changes: 0 additions & 21 deletions src/hotspot/share/classfile/javaClasses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1463,27 +1463,6 @@ class java_lang_invoke_MethodHandleNatives_CallSiteContext : AllStatic {
static bool is_instance(oop obj);
};

// Interface to java.security.AccessControlContext objects

class java_security_AccessControlContext: AllStatic {
private:
// Note that for this class the layout changed between JDK1.2 and JDK1.3,
// so we compute the offsets at startup rather than hard-wiring them.
static int _context_offset;
static int _privilegedContext_offset;
static int _isPrivileged_offset;
static int _isAuthorized_offset;

static void compute_offsets();
public:
static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
static oop create(objArrayHandle context, bool isPrivileged, Handle privileged_context, TRAPS);

// Debugging/initialization
friend class JavaClasses;
};


// Interface to java.lang.ClassLoader objects

#define CLASSLOADER_INJECTED_FIELDS(macro) \
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/classfile/systemDictionary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ class SystemDictionary : AllStatic {

// compute java_mirror (java.lang.Class instance) for a type ("I", "[[B", "LFoo;", etc.)
// Either the accessing_klass or the CL can be non-null, but not both.
// callee will fill in CL from AK, if they are needed
// Callee will fill in CL from the accessing klass, if they are needed.
static Handle find_java_mirror_for_type(Symbol* signature,
Klass* accessing_klass,
SignatureStream::FailureMode failure_mode,
Expand Down
4 changes: 1 addition & 3 deletions src/hotspot/share/classfile/vmClassMacros.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -62,8 +62,6 @@
do_klass(RuntimeException_klass, java_lang_RuntimeException ) \
do_klass(SecurityManager_klass, java_lang_SecurityManager ) \
do_klass(ProtectionDomain_klass, java_security_ProtectionDomain ) \
do_klass(AccessControlContext_klass, java_security_AccessControlContext ) \
do_klass(AccessController_klass, java_security_AccessController ) \
do_klass(SecureClassLoader_klass, java_security_SecureClassLoader ) \
do_klass(ClassNotFoundException_klass, java_lang_ClassNotFoundException ) \
do_klass(Record_klass, java_lang_Record ) \
Expand Down
7 changes: 0 additions & 7 deletions src/hotspot/share/classfile/vmSymbols.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ class SerializeClosure;
template(java_lang_SecurityManager, "java/lang/SecurityManager") \
template(java_lang_ScopedValue, "java/lang/ScopedValue") \
template(java_lang_ScopedValue_Carrier, "java/lang/ScopedValue$Carrier") \
template(java_security_AccessControlContext, "java/security/AccessControlContext") \
template(java_security_AccessController, "java/security/AccessController") \
template(executePrivileged_name, "executePrivileged") \
template(java_security_CodeSource, "java/security/CodeSource") \
template(java_security_ProtectionDomain, "java/security/ProtectionDomain") \
template(java_security_SecureClassLoader, "java/security/SecureClassLoader") \
Expand Down Expand Up @@ -487,7 +484,6 @@ class SerializeClosure;
template(input_stream_void_signature, "(Ljava/io/InputStream;)V") \
template(input_stream_signature, "Ljava/io/InputStream;") \
template(print_stream_signature, "Ljava/io/PrintStream;") \
template(security_manager_signature, "Ljava/lang/SecurityManager;") \
template(defineOrCheckPackage_name, "defineOrCheckPackage") \
template(defineOrCheckPackage_signature, "(Ljava/lang/String;Ljava/util/jar/Manifest;Ljava/net/URL;)Ljava/lang/Package;") \
template(getProtectionDomain_name, "getProtectionDomain") \
Expand Down Expand Up @@ -601,9 +597,6 @@ class SerializeClosure;
template(void_string_signature, "()Ljava/lang/String;") \
template(object_array_object_signature, "([Ljava/lang/Object;)Ljava/lang/Object;") \
template(object_object_array_object_signature, "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;")\
template(protectiondomain_signature, "[Ljava/security/ProtectionDomain;") \
template(accesscontrolcontext_signature, "Ljava/security/AccessControlContext;") \
template(class_protectiondomain_signature, "(Ljava/lang/Class;Ljava/security/ProtectionDomain;)V") \
template(thread_signature, "Ljava/lang/Thread;") \
template(thread_fieldholder_signature, "Ljava/lang/Thread$FieldHolder;") \
template(threadgroup_signature, "Ljava/lang/ThreadGroup;") \
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/oops/method.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,7 @@ bool Method::is_ignored_by_security_stack_walk() const {
// This is Method.invoke() -- ignore it
return true;
}
// This also looks obsolete
if (method_holder()->is_subclass_of(vmClasses::reflect_MethodAccessorImpl_klass())) {
// This is an auxiliary frame -- ignore it
return true;
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/prims/jvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ static void trace_class_resolution_impl(Klass* to_class, TRAPS) {
vframeStream vfst(jthread);

// scan up the stack skipping ClassLoader, AccessController and PrivilegedAction frames
// It was this thing - is this no longer needed also? We won't have these frames anymore, right (except class loader)?
TempNewSymbol access_controller = SymbolTable::new_symbol("java/security/AccessController");
Klass* access_controller_klass = SystemDictionary::resolve_or_fail(access_controller, false, CHECK);
TempNewSymbol privileged_action = SymbolTable::new_symbol("java/security/PrivilegedAction");
Expand Down Expand Up @@ -3063,6 +3064,7 @@ JVM_ENTRY(jobjectArray, JVM_GetClassContext(JNIEnv *env))

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() &&
Expand Down