From 6fa9730ce49876394d3f12125496e9b4943468e0 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Mon, 25 Jan 2021 10:52:22 +0900 Subject: [PATCH 1/2] 8260338: Some fields in HaltNode is not cloned --- src/hotspot/share/opto/node.cpp | 6 +++++- src/hotspot/share/opto/rootnode.cpp | 3 ++- src/hotspot/share/opto/rootnode.hpp | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/opto/node.cpp b/src/hotspot/share/opto/node.cpp index bcbd700498e8d..e14d67110be0c 100644 --- a/src/hotspot/share/opto/node.cpp +++ b/src/hotspot/share/opto/node.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2021, 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 @@ -568,6 +568,10 @@ Node *Node::clone() const { if (n->is_SafePoint()) { n->as_SafePoint()->clone_replaced_nodes(); } + if (n->is_Halt()) { + n->as_Halt()->_reachable = this->as_Halt()->_reachable; + n->as_Halt()->_halt_reason = this->as_Halt()->_halt_reason; + } return n; // Return the clone } diff --git a/src/hotspot/share/opto/rootnode.cpp b/src/hotspot/share/opto/rootnode.cpp index 6d4270732acfd..b5f41ad385109 100644 --- a/src/hotspot/share/opto/rootnode.cpp +++ b/src/hotspot/share/opto/rootnode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2021, 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 @@ -74,6 +74,7 @@ HaltNode::HaltNode(Node* ctrl, Node* frameptr, const char* halt_reason, bool rea } const Type *HaltNode::bottom_type() const { return Type::BOTTOM; } +uint HaltNode::size_of() const { return sizeof(*this); } //------------------------------Ideal------------------------------------------ Node *HaltNode::Ideal(PhaseGVN *phase, bool can_reshape) { diff --git a/src/hotspot/share/opto/rootnode.hpp b/src/hotspot/share/opto/rootnode.hpp index f71acf8bacaa5..d86a880bb70bc 100644 --- a/src/hotspot/share/opto/rootnode.hpp +++ b/src/hotspot/share/opto/rootnode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2021, 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 @@ -50,6 +50,8 @@ class RootNode : public LoopNode { //------------------------------HaltNode--------------------------------------- // Throw an exception & die class HaltNode : public Node { +protected: + virtual uint size_of() const; public: const char* _halt_reason; bool _reachable; From 88e6327718012683628d81be869668dceaea0de2 Mon Sep 17 00:00:00 2001 From: Yasumasa Suenaga Date: Mon, 25 Jan 2021 16:45:28 +0900 Subject: [PATCH 2/2] Revert change for node.cpp --- src/hotspot/share/opto/node.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/hotspot/share/opto/node.cpp b/src/hotspot/share/opto/node.cpp index e14d67110be0c..bcbd700498e8d 100644 --- a/src/hotspot/share/opto/node.cpp +++ b/src/hotspot/share/opto/node.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2020, 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 @@ -568,10 +568,6 @@ Node *Node::clone() const { if (n->is_SafePoint()) { n->as_SafePoint()->clone_replaced_nodes(); } - if (n->is_Halt()) { - n->as_Halt()->_reachable = this->as_Halt()->_reachable; - n->as_Halt()->_halt_reason = this->as_Halt()->_halt_reason; - } return n; // Return the clone }