8286556: Remove EagerInitialization develop option

Reviewed-by: rehn, redestad
This commit is contained in:
Coleen Phillimore 2022-05-11 16:19:49 +00:00
parent 89de756ffb
commit cec23b1b07
5 changed files with 1 additions and 72 deletions

View File

@ -1453,7 +1453,6 @@ void SystemDictionary::define_instance_class(InstanceKlass* k, Handle class_load
// Grabs and releases SystemDictionary_lock
update_dictionary(name_hash, k, class_loader);
}
k->eager_initialize(THREAD);
// notify jvmti
if (JvmtiExport::should_post_class_load()) {

View File

@ -711,25 +711,6 @@ klassItable InstanceKlass::itable() const {
return klassItable(const_cast<InstanceKlass*>(this));
}
void InstanceKlass::eager_initialize(Thread *thread) {
if (!EagerInitialization) return;
if (this->is_not_initialized()) {
// abort if the the class has a class initializer
if (this->class_initializer() != NULL) return;
// abort if it is java.lang.Object (initialization is handled in genesis)
Klass* super_klass = super();
if (super_klass == NULL) return;
// abort if the super class should be initialized
if (!InstanceKlass::cast(super_klass)->is_initialized()) return;
// call body to expose the this pointer
eager_initialize_impl();
}
}
// JVMTI spec thinks there are signers and protection domain in the
// instanceKlass. These accessors pretend these fields are there.
// The hprof specification also thinks these fields are in InstanceKlass.
@ -764,38 +745,6 @@ void InstanceKlass::fence_and_clear_init_lock() {
assert(!is_not_initialized(), "class must be initialized now");
}
void InstanceKlass::eager_initialize_impl() {
EXCEPTION_MARK;
HandleMark hm(THREAD);
Handle h_init_lock(THREAD, init_lock());
ObjectLocker ol(h_init_lock, THREAD);
// abort if someone beat us to the initialization
if (!is_not_initialized()) return; // note: not equivalent to is_initialized()
ClassState old_state = init_state();
link_class_impl(THREAD);
if (HAS_PENDING_EXCEPTION) {
CLEAR_PENDING_EXCEPTION;
// Abort if linking the class throws an exception.
// Use a test to avoid redundantly resetting the state if there's
// no change. Set_init_state() asserts that state changes make
// progress, whereas here we might just be spinning in place.
if (old_state != _init_state)
set_init_state(old_state);
} else {
// linking successful, mark class as initialized
set_init_state(fully_initialized);
fence_and_clear_init_lock();
// trace
if (log_is_enabled(Info, class, init)) {
ResourceMark rm(THREAD);
log_info(class, init)("[Initialized %s without side effects]", external_name());
}
}
}
// See "The Virtual Machine Specification" section 2.16.5 for a detailed explanation of the class initialization
// process. The step comments refers to the procedure described in that section.

View File

@ -574,9 +574,6 @@ public:
void link_methods(TRAPS);
Method* class_initializer() const;
// set the class to initialized if no static initializer is present
void eager_initialize(Thread *thread);
// reference type
ReferenceType reference_type() const { return (ReferenceType)_reference_type; }
void set_reference_type(ReferenceType t) {
@ -1179,7 +1176,6 @@ private:
bool verify_code (TRAPS);
void initialize_impl (TRAPS);
void initialize_super_interfaces (TRAPS);
void eager_initialize_impl ();
void add_initialization_error(JavaThread* current, Handle exception);
oop get_initialization_error(JavaThread* current);

View File

@ -973,9 +973,6 @@ const intx ObjectAlignmentInBytes = 8;
product(bool, UsePopCountInstruction, false, \
"Use population count instruction") \
\
develop(bool, EagerInitialization, false, \
"Eagerly initialize classes if possible") \
\
product(bool, LogTouchedMethods, false, DIAGNOSTIC, \
"Log methods which have been ever touched in runtime") \
\

View File

@ -53,19 +53,7 @@ public class ClassInitializationTest {
out.shouldContain("Verification for BadMap50 failed");
out.shouldContain("Fail over class verification to old verifier for: BadMap50");
// (2)
if (Platform.isDebugBuild()) {
pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+init=info",
"-Xverify:all",
"-XX:+EagerInitialization",
"-Xmx128m",
InnerClass.class.getName());
out = new OutputAnalyzer(pb.start());
out.shouldContain("[Initialized").shouldContain("without side effects]");
out.shouldHaveExitValue(0);
}
// (3) class+init should turn off.
// (2) class+init should turn off.
pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+init=off",
"-Xverify:all",
"-Xmx128m",