Skip to content

Commit

Permalink
8349559: Compiler interface doesn't need to store protection domain
Browse files Browse the repository at this point in the history
Reviewed-by: vlivanov, iklam
  • Loading branch information
coleenp committed Feb 7, 2025
1 parent f0ea38b commit 1ed9ef1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 41 deletions.
20 changes: 1 addition & 19 deletions src/hotspot/share/ci/ciInstanceKlass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,10 @@ ciInstanceKlass::ciInstanceKlass(Klass* k) :
JavaThread *thread = JavaThread::current();
if (ciObjectFactory::is_initialized()) {
_loader = JNIHandles::make_local(thread, ik->class_loader());
_protection_domain = JNIHandles::make_local(thread,
ik->protection_domain());
_is_shared = false;
} else {
Handle h_loader(thread, ik->class_loader());
Handle h_protection_domain(thread, ik->protection_domain());
_loader = JNIHandles::make_global(h_loader);
_protection_domain = JNIHandles::make_global(h_protection_domain);
_is_shared = true;
}

Expand All @@ -118,7 +114,7 @@ ciInstanceKlass::ciInstanceKlass(Klass* k) :

// Version for unloaded classes:
ciInstanceKlass::ciInstanceKlass(ciSymbol* name,
jobject loader, jobject protection_domain)
jobject loader)
: ciKlass(name, T_OBJECT)
{
assert(name->char_at(0) != JVM_SIGNATURE_ARRAY, "not an instance klass");
Expand All @@ -129,7 +125,6 @@ ciInstanceKlass::ciInstanceKlass(ciSymbol* name,
_is_hidden = false;
_is_record = false;
_loader = loader;
_protection_domain = protection_domain;
_is_shared = false;
_super = nullptr;
_java_mirror = nullptr;
Expand Down Expand Up @@ -171,19 +166,6 @@ jobject ciInstanceKlass::loader_handle() {
return _loader;
}

// ------------------------------------------------------------------
// ciInstanceKlass::protection_domain
oop ciInstanceKlass::protection_domain() {
ASSERT_IN_VM;
return JNIHandles::resolve(_protection_domain);
}

// ------------------------------------------------------------------
// ciInstanceKlass::protection_domain_handle
jobject ciInstanceKlass::protection_domain_handle() {
return _protection_domain;
}

// ------------------------------------------------------------------
// ciInstanceKlass::field_cache
//
Expand Down
8 changes: 2 additions & 6 deletions src/hotspot/share/ci/ciInstanceKlass.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2025, 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 @@ -49,7 +49,6 @@ class ciInstanceKlass : public ciKlass {
enum SubklassValue { subklass_unknown, subklass_false, subklass_true };

jobject _loader;
jobject _protection_domain;

InstanceKlass::ClassState _init_state; // state of class
bool _is_shared;
Expand Down Expand Up @@ -84,7 +83,7 @@ class ciInstanceKlass : public ciKlass {

protected:
ciInstanceKlass(Klass* k);
ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain);
ciInstanceKlass(ciSymbol* name, jobject loader);

InstanceKlass* get_instanceKlass() const {
return InstanceKlass::cast(get_Klass());
Expand All @@ -93,9 +92,6 @@ class ciInstanceKlass : public ciKlass {
oop loader();
jobject loader_handle();

oop protection_domain();
jobject protection_domain_handle();

const char* type_string() { return "ciInstanceKlass"; }

bool is_in_package_impl(const char* packagename, int len);
Expand Down
5 changes: 1 addition & 4 deletions src/hotspot/share/ci/ciKlass.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2025, 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 @@ -65,9 +65,6 @@ class ciKlass : public ciType {
virtual oop loader() { return nullptr; }
virtual jobject loader_handle() { return nullptr; }

virtual oop protection_domain() { return nullptr; }
virtual jobject protection_domain_handle() { return nullptr; }

const char* type_string() { return "ciKlass"; }

void print_impl(outputStream* st);
Expand Down
6 changes: 1 addition & 5 deletions src/hotspot/share/ci/ciObjArrayKlass.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2025, 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 @@ -58,10 +58,6 @@ class ciObjArrayKlass : public ciArrayKlass {
oop loader() { return _base_element_klass->loader(); }
jobject loader_handle() { return _base_element_klass->loader_handle(); }

oop protection_domain() { return _base_element_klass->protection_domain(); }
jobject protection_domain_handle() { return _base_element_klass->protection_domain_handle(); }


public:
// The one-level type of the array elements.
ciKlass* element_klass();
Expand Down
10 changes: 3 additions & 7 deletions src/hotspot/share/ci/ciObjectFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ void ciObjectFactory::init_shared_objects() {

ciEnv::_unloaded_cisymbol = ciObjectFactory::get_symbol(vmSymbols::dummy_symbol());
// Create dummy InstanceKlass and ObjArrayKlass object and assign them idents
ciEnv::_unloaded_ciinstance_klass = new (_arena) ciInstanceKlass(ciEnv::_unloaded_cisymbol, nullptr, nullptr);
ciEnv::_unloaded_ciinstance_klass = new (_arena) ciInstanceKlass(ciEnv::_unloaded_cisymbol, nullptr);
init_ident_of(ciEnv::_unloaded_ciinstance_klass);
ciEnv::_unloaded_ciobjarrayklass = new (_arena) ciObjArrayKlass(ciEnv::_unloaded_cisymbol, ciEnv::_unloaded_ciinstance_klass, 1);
init_ident_of(ciEnv::_unloaded_ciobjarrayklass);
Expand Down Expand Up @@ -467,13 +467,11 @@ ciKlass* ciObjectFactory::get_unloaded_klass(ciKlass* accessing_klass,
oop domain = nullptr;
if (accessing_klass != nullptr) {
loader = accessing_klass->loader();
domain = accessing_klass->protection_domain();
}
for (int i = 0; i < _unloaded_klasses.length(); i++) {
ciKlass* entry = _unloaded_klasses.at(i);
if (entry->name()->equals(name) &&
entry->loader() == loader &&
entry->protection_domain() == domain) {
entry->loader() == loader) {
// We've found a match.
return entry;
}
Expand Down Expand Up @@ -512,12 +510,10 @@ ciKlass* ciObjectFactory::get_unloaded_klass(ciKlass* accessing_klass,
new_klass = new (arena()) ciObjArrayKlass(name, element_klass, dimension);
} else {
jobject loader_handle = nullptr;
jobject domain_handle = nullptr;
if (accessing_klass != nullptr) {
loader_handle = accessing_klass->loader_handle();
domain_handle = accessing_klass->protection_domain_handle();
}
new_klass = new (arena()) ciInstanceKlass(name, loader_handle, domain_handle);
new_klass = new (arena()) ciInstanceKlass(name, loader_handle);
}
init_ident_of(new_klass);
_unloaded_klasses.append(new_klass);
Expand Down

0 comments on commit 1ed9ef1

Please sign in to comment.