Skip to content

Commit

Permalink
JDK-8320335: Remove RegisterFinalizersAtInit after setting it to true
Browse files Browse the repository at this point in the history
Assume the option is always true and remove all uses of the option
  • Loading branch information
DanHeidinga committed Nov 20, 2023
1 parent 180df75 commit 1147b75
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/hotspot/share/c1/c1_GraphBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/classfile/classFileParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4135,8 +4135,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.
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/interpreter/abstractInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/interpreter/rewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,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) {
Expand Down
3 changes: 0 additions & 3 deletions src/hotspot/share/oops/instanceKlass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1503,9 +1503,6 @@ instanceOop InstanceKlass::allocate_instance(TRAPS) {
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;
}

Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/oops/instanceKlass.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,6 @@ class InstanceKlass: public Klass {
// 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 {
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/opto/parse1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2197,8 +2197,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();
}

Expand Down

0 comments on commit 1147b75

Please sign in to comment.