Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit 9c50b8e

Browse files
committedMar 16, 2021
8263587: C2: JVMS not cloned when needs_clone_jvms() is true
Reviewed-by: goetz, vlivanov
1 parent 68deb24 commit 9c50b8e

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed
 

‎src/hotspot/share/opto/callnode.hpp

+9-24
Original file line numberDiff line numberDiff line change
@@ -616,8 +616,9 @@ class CallNode : public SafePointNode {
616616
// For macro nodes, the JVMState gets modified during expansion. If calls
617617
// use MachConstantBase, it gets modified during matching. So when cloning
618618
// the node the JVMState must be cloned. Default is not to clone.
619-
virtual void clone_jvms(Compile* C) {
620-
if (C->needs_clone_jvms() && jvms() != NULL) {
619+
virtual bool needs_clone_jvms(Compile* C) { return C->needs_clone_jvms(); }
620+
void clone_jvms(Compile* C) {
621+
if ((jvms() != NULL) && needs_clone_jvms(C)) {
621622
set_jvms(jvms()->clone_deep(C));
622623
jvms()->set_map_deep(this);
623624
}
@@ -737,11 +738,8 @@ class CallStaticJavaNode : public CallJavaNode {
737738
}
738739
// Late inlining modifies the JVMState, so we need to clone it
739740
// when the call node is cloned (because it is macro node).
740-
virtual void clone_jvms(Compile* C) {
741-
if ((jvms() != NULL) && is_boxing_method()) {
742-
set_jvms(jvms()->clone_deep(C));
743-
jvms()->set_map_deep(this);
744-
}
741+
virtual bool needs_clone_jvms(Compile* C) {
742+
return is_boxing_method() || CallNode::needs_clone_jvms(C);
745743
}
746744

747745
virtual int Opcode() const;
@@ -766,11 +764,8 @@ class CallDynamicJavaNode : public CallJavaNode {
766764

767765
// Late inlining modifies the JVMState, so we need to clone it
768766
// when the call node is cloned.
769-
virtual void clone_jvms(Compile* C) {
770-
if ((jvms() != NULL) && IncrementalInlineVirtual) {
771-
set_jvms(jvms()->clone_deep(C));
772-
jvms()->set_map_deep(this);
773-
}
767+
virtual bool needs_clone_jvms(Compile* C) {
768+
return IncrementalInlineVirtual || CallNode::needs_clone_jvms(C);
774769
}
775770

776771
int _vtable_index;
@@ -923,12 +918,7 @@ class AllocateNode : public CallNode {
923918
AllocateNode(Compile* C, const TypeFunc *atype, Node *ctrl, Node *mem, Node *abio,
924919
Node *size, Node *klass_node, Node *initial_test);
925920
// Expansion modifies the JVMState, so we need to clone it
926-
virtual void clone_jvms(Compile* C) {
927-
if (jvms() != NULL) {
928-
set_jvms(jvms()->clone_deep(C));
929-
jvms()->set_map_deep(this);
930-
}
931-
}
921+
virtual bool needs_clone_jvms(Compile* C) { return true; }
932922
virtual int Opcode() const;
933923
virtual uint ideal_reg() const { return Op_RegP; }
934924
virtual bool guaranteed_safepoint() { return false; }
@@ -1142,12 +1132,7 @@ class LockNode : public AbstractLockNode {
11421132

11431133
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
11441134
// Expansion modifies the JVMState, so we need to clone it
1145-
virtual void clone_jvms(Compile* C) {
1146-
if (jvms() != NULL) {
1147-
set_jvms(jvms()->clone_deep(C));
1148-
jvms()->set_map_deep(this);
1149-
}
1150-
}
1135+
virtual bool needs_clone_jvms(Compile* C) { return true; }
11511136

11521137
bool is_nested_lock_region(); // Is this Lock nested?
11531138
bool is_nested_lock_region(Compile * c); // Why isn't this Lock nested?

0 commit comments

Comments
 (0)