8320522: Remove code related to RegisterFinalizersAtInit

Reviewed-by: coleenp, ayang, kbarrett
This commit is contained in:
Dan Heidinga 2024-04-19 15:03:18 +00:00 committed by Coleen Phillimore
parent 650ca65a4f
commit 3c1d1d93d7
13 changed files with 13 additions and 30 deletions

@ -3611,7 +3611,7 @@ void TemplateTable::_new() {
__ ldrw(r3,
Address(r4,
Klass::layout_helper_offset()));
// test to see if it has a finalizer or is malformed in some way
// test to see if it is malformed in some way
__ tbnz(r3, exact_log2(Klass::_lh_instance_slow_path_bit), slow_case);
// Allocate the instance:

@ -3971,7 +3971,7 @@ void TemplateTable::_new() {
__ b(slow_case, ne);
__ load_resolved_klass_at_offset(Rcpool, Rindex, Rklass);
// make sure klass is initialized & doesn't have finalizer
// make sure klass is initialized
// make sure klass is fully initialized
__ ldrb(Rtemp, Address(Rklass, InstanceKlass::init_state_offset()));
__ cmp(Rtemp, InstanceKlass::fully_initialized);
@ -3980,7 +3980,7 @@ void TemplateTable::_new() {
// get instance_size in InstanceKlass (scaled to a count of bytes)
__ ldr_u32(Rsize, Address(Rklass, Klass::layout_helper_offset()));
// test to see if it has a finalizer or is malformed in some way
// test to see if it is malformed in some way
// Klass::_lh_instance_slow_path_bit is really a bit mask, not bit number
__ tbnz(Rsize, exact_log2(Klass::_lh_instance_slow_path_bit), slow_case);

@ -3809,7 +3809,7 @@ void TemplateTable::_new() {
__ lwz(Rinstance_size, in_bytes(Klass::layout_helper_offset()), RinstanceKlass);
// Make sure klass does not have has_finalizer, or is abstract, or interface or java/lang/Class.
// Make sure klass is not abstract, or interface or java/lang/Class.
__ andi_(R0, Rinstance_size, Klass::_lh_instance_slow_path_bit); // slow path bit equals 0?
__ bne(CCR0, Lslow_case);

@ -3554,7 +3554,7 @@ void TemplateTable::_new() {
// get instance_size in InstanceKlass (scaled to a count of bytes)
__ lwu(x13, Address(x14, Klass::layout_helper_offset()));
// test to see if it has a finalizer or is malformed in some way
// test to see if is malformed in some way
__ test_bit(t0, x13, exact_log2(Klass::_lh_instance_slow_path_bit));
__ bnez(t0, slow_case);

@ -4057,10 +4057,9 @@ void TemplateTable::_new() {
__ jcc(Assembler::notEqual, slow_case);
#endif
// make sure klass doesn't have finalizer
// get instance_size in InstanceKlass (scaled to a count of bytes)
__ movl(rdx, Address(rcx, Klass::layout_helper_offset()));
// test to see if it has a finalizer or is malformed in some way
// test to see if it is malformed in some way
__ testl(rdx, Klass::_lh_instance_slow_path_bit);
__ jcc(Assembler::notZero, slow_case);

@ -1556,8 +1556,7 @@ void GraphBuilder::call_register_finalizer() {
void GraphBuilder::method_return(Value x, bool ignore_return) {
if (RegisterFinalizersAtInit &&
method()->intrinsic_id() == vmIntrinsics::_Object_init) {
if (method()->intrinsic_id() == vmIntrinsics::_Object_init) {
call_register_finalizer();
}

@ -4188,8 +4188,7 @@ void ClassFileParser::set_precomputed_flags(InstanceKlass* ik) {
// If it cannot be fast-path allocated, set a bit in the layout helper.
// See documentation of InstanceKlass::can_be_fastpath_allocated().
assert(ik->size_helper() > 0, "layout_helper is initialized");
if ((!RegisterFinalizersAtInit && ik->has_finalizer())
|| ik->is_abstract() || ik->is_interface()
if (ik->is_abstract() || ik->is_interface()
|| (ik->name() == vmSymbols::java_lang_Class() && ik->class_loader() == nullptr)
|| ik->size_helper() >= FastAllocateSizeLimit) {
// Forbid fast-path allocation.

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
@ -149,7 +149,7 @@ AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(const methodHan
case vmIntrinsics::_dsqrt_strict: return java_lang_math_sqrt_strict;
case vmIntrinsics::_Reference_get: return java_lang_ref_reference_get;
case vmIntrinsics::_Object_init:
if (RegisterFinalizersAtInit && m->code_size() == 1) {
if (m->code_size() == 1) {
// We need to execute the special return bytecode to check for
// finalizer registration so create a normal frame.
return zerolocals;

@ -531,7 +531,7 @@ void Rewriter::rewrite_bytecodes(TRAPS) {
// determine index maps for Method* rewriting
compute_index_maps();
if (RegisterFinalizersAtInit && _klass->name() == vmSymbols::java_lang_Object()) {
if (_klass->name() == vmSymbols::java_lang_Object()) {
bool did_rewrite = false;
int i = _methods->length();
while (i-- > 0) {

@ -1509,16 +1509,8 @@ instanceOop InstanceKlass::register_finalizer(instanceOop i, TRAPS) {
}
instanceOop InstanceKlass::allocate_instance(TRAPS) {
bool has_finalizer_flag = has_finalizer(); // Query before possible GC
size_t size = size_helper(); // Query before forming handle.
instanceOop i;
i = (instanceOop)Universe::heap()->obj_allocate(this, size, CHECK_NULL);
if (has_finalizer_flag && !RegisterFinalizersAtInit) {
i = register_finalizer(i, CHECK_NULL);
}
return i;
return (instanceOop)Universe::heap()->obj_allocate(this, size, CHECK_NULL);
}
instanceOop InstanceKlass::allocate_instance(oop java_class, TRAPS) {

@ -959,7 +959,6 @@ public:
// This bit is initialized in classFileParser.cpp.
// It is false under any of the following conditions:
// - the class is abstract (including any interface)
// - the class has a finalizer (if !RegisterFinalizersAtInit)
// - the class size is larger than FastAllocateSizeLimit
// - the class is java/lang/Class, which cannot be allocated directly
bool can_be_fastpath_allocated() const {

@ -2239,8 +2239,7 @@ void Parse::rtm_deopt() {
//------------------------------return_current---------------------------------
// Append current _map to _exit_return
void Parse::return_current(Node* value) {
if (RegisterFinalizersAtInit &&
method()->intrinsic_id() == vmIntrinsics::_Object_init) {
if (method()->intrinsic_id() == vmIntrinsics::_Object_init) {
call_register_finalizer();
}

@ -671,10 +671,6 @@ const int ObjectAlignmentInBytes = 8;
product(bool, PrintWarnings, true, \
"Print JVM warnings to output stream") \
\
product(bool, RegisterFinalizersAtInit, true, \
"(Deprecated) Register finalizable objects at end of " \
"Object.<init> or after allocation") \
\
develop(bool, RegisterReferences, true, \
"Tell whether the VM should register soft/weak/final/phantom " \
"references") \