From 7db4d46c3904d1a6949f053e6fc5e971cd519088 Mon Sep 17 00:00:00 2001 From: nelanbu Date: Fri, 6 Sep 2024 06:44:54 +0000 Subject: [PATCH] 8330159: [C2] Remove or clarify Compile::init_start Reviewed-by: chagedorn, dlong --- src/hotspot/share/opto/compile.cpp | 15 +++++++-------- src/hotspot/share/opto/compile.hpp | 2 +- src/hotspot/share/opto/generateOptoStub.cpp | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index 0ea3bfd122af0..58a716abd216c 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -754,14 +754,14 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci, init_tf(TypeFunc::make(domain, range)); StartNode* s = new StartOSRNode(root(), domain); initial_gvn()->set_type_bottom(s); - init_start(s); + verify_start(s); cg = CallGenerator::for_osr(method(), entry_bci()); } else { // Normal case. init_tf(TypeFunc::make(method())); StartNode* s = new StartNode(root(), tf()->domain()); initial_gvn()->set_type_bottom(s); - init_start(s); + verify_start(s); if (method()->intrinsic_id() == vmIntrinsics::_Reference_get) { // With java.lang.ref.reference.get() we must go through the // intrinsic - even when get() is the root @@ -1105,13 +1105,12 @@ void Compile::Init(bool aliasing) { probe_alias_cache(nullptr)->_index = AliasIdxTop; } -//---------------------------init_start---------------------------------------- -// Install the StartNode on this compile object. -void Compile::init_start(StartNode* s) { - if (failing()) - return; // already failing - assert(s == start(), ""); +#ifdef ASSERT +// Verify that the current StartNode is valid. +void Compile::verify_start(StartNode* s) const { + assert(failing() || s == start(), "should be StartNode"); } +#endif /** * Return the 'StartNode'. We must not have a pending failure, since the ideal graph diff --git a/src/hotspot/share/opto/compile.hpp b/src/hotspot/share/opto/compile.hpp index 15c91f6ad12fa..e1574da568bf9 100644 --- a/src/hotspot/share/opto/compile.hpp +++ b/src/hotspot/share/opto/compile.hpp @@ -864,7 +864,7 @@ class Compile : public Phase { RootNode* root() const { return _root; } void set_root(RootNode* r) { _root = r; } StartNode* start() const; // (Derived from root.) - void init_start(StartNode* s); + void verify_start(StartNode* s) const NOT_DEBUG_RETURN; Node* immutable_memory(); Node* recent_alloc_ctl() const { return _recent_alloc_ctl; } diff --git a/src/hotspot/share/opto/generateOptoStub.cpp b/src/hotspot/share/opto/generateOptoStub.cpp index e22f484c17955..2f940439045f7 100644 --- a/src/hotspot/share/opto/generateOptoStub.cpp +++ b/src/hotspot/share/opto/generateOptoStub.cpp @@ -261,7 +261,7 @@ void GraphKit::gen_stub(address C_function, frameptr(), returnadr()); root()->add_req(_gvn.transform(to_exc)); // bind to root to keep live - C->init_start(start); + C->verify_start(start); //----------------------------- // If this is a normal subroutine return, issue the return and be done.