RFR: 8330851: C2: More efficient TypeFunc creation
Amit Kumar
amitkumar at openjdk.org
Sun Nov 24 09:18:52 UTC 2024
On Mon, 18 Nov 2024 20:16:02 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
> > Is there some arena-specific check that exists, which could be used here ?
>
> `_type_arena != &_Compile_types` on current `Compile` should reliably detect when shared type dictionary is being populated.
I can't access `_type_arena` in the initialize method directly. So will this change be fine:
diff --git a/src/hotspot/share/opto/compile.hpp b/src/hotspot/share/opto/compile.hpp
index 05e24bf3f6e..6dbed935218 100644
--- a/src/hotspot/share/opto/compile.hpp
+++ b/src/hotspot/share/opto/compile.hpp
@@ -964,6 +964,7 @@ class Compile : public Phase {
Dict* type_dict() { return _type_dict; }
size_t type_last_size() { return _type_last_size; }
int num_alias_types() { return _num_alias_types; }
+ Arena* compile_type_arena() { return &_Compile_types; }
void init_type_arena() { _type_arena = &_Compile_types; }
void set_type_arena(Arena* a) { _type_arena = a; }
diff --git a/src/hotspot/share/opto/runtime.cpp b/src/hotspot/share/opto/runtime.cpp
index b91844d383f..95cab3fd117 100644
--- a/src/hotspot/share/opto/runtime.cpp
+++ b/src/hotspot/share/opto/runtime.cpp
@@ -2044,7 +2044,8 @@ NamedCounter* OptoRuntime::new_named_counter(JVMState* youngest_jvms, NamedCount
return c;
}
-void OptoRuntime::initialize_types() {
+void OptoRuntime::initialize_types(Compile* current) {
+ assert(current->type_arena() != current->compile_type_arena(), "should be shared arena");
new_instance_Type_init();
new_array_Type_init();
multianewarray2_Type_init();
diff --git a/src/hotspot/share/opto/runtime.hpp b/src/hotspot/share/opto/runtime.hpp
index 14dc03fef25..b2c32366157 100644
--- a/src/hotspot/share/opto/runtime.hpp
+++ b/src/hotspot/share/opto/runtime.hpp
@@ -770,7 +770,7 @@ class OptoRuntime : public AllStatic {
// dumps all the named counters
static void print_named_counters();
- static void initialize_types();
+ static void initialize_types(Compile* current);
};
#endif // SHARE_OPTO_RUNTIME_HPP
diff --git a/src/hotspot/share/opto/type.cpp b/src/hotspot/share/opto/type.cpp
index 40d688085b5..86949786284 100644
--- a/src/hotspot/share/opto/type.cpp
+++ b/src/hotspot/share/opto/type.cpp
@@ -713,7 +713,7 @@ void Type::Initialize_shared(Compile* current) {
mreg2type[Op_VecZ] = TypeVect::VECTZ;
LockNode::lock_type_init();
- OptoRuntime::initialize_types();
+ OptoRuntime::initialize_types(current);
// Restore working type arena.
current->set_type_arena(save);
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21782#issuecomment-2489319551
More information about the hotspot-compiler-dev
mailing list