From cb17e450b322c19304ab6bb68c04d52dc988f534 Mon Sep 17 00:00:00 2001 From: Roman Kennke Date: Thu, 18 Oct 2018 21:14:49 +0200 Subject: [PATCH] 8212603: Need to step over GC barriers in Node::eqv_uncast() Reviewed-by: shade, kvn, eosterlund --- src/hotspot/share/opto/node.cpp | 7 +++++++ src/hotspot/share/opto/node.hpp | 7 +++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/hotspot/share/opto/node.cpp b/src/hotspot/share/opto/node.cpp index 1252f50ce5a..acbc68a2fc8 100644 --- a/src/hotspot/share/opto/node.cpp +++ b/src/hotspot/share/opto/node.cpp @@ -899,6 +899,13 @@ Node* Node::uncast() const { return (Node*) this; } +bool Node::eqv_uncast(const Node* n) const { + BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2(); + Node* obj1 = bs->step_over_gc_barrier(const_cast(this)); + Node* obj2 = bs->step_over_gc_barrier(const_cast(n)); + return (obj1->uncast() == obj2->uncast()); +} + // Find out of current node that matches opcode. Node* Node::find_out_with(int opcode) { for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) { diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp index f5717d78f95..7b5b96ad33e 100644 --- a/src/hotspot/share/opto/node.hpp +++ b/src/hotspot/share/opto/node.hpp @@ -457,10 +457,9 @@ protected: // Strip away casting. (It is depth-limited.) Node* uncast() const; - // Return whether two Nodes are equivalent, after stripping casting. - bool eqv_uncast(const Node* n) const { - return (this->uncast() == n->uncast()); - } + // Return whether two Nodes are equivalent, after stripping casting + // and GC barriers. + bool eqv_uncast(const Node* n) const; // Find out of current node that matches opcode. Node* find_out_with(int opcode);