Skip to content

Commit 0ddcd70

Browse files
committed
8335120: assert(!target->can_be_statically_bound() || target == cha_monomorphic_target) failed
Reviewed-by: kvn, vlivanov
1 parent 26e3d53 commit 0ddcd70

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/hotspot/share/c1/c1_GraphBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2116,7 +2116,7 @@ void GraphBuilder::invoke(Bytecodes::Code code) {
21162116
}
21172117

21182118
if (cha_monomorphic_target != nullptr) {
2119-
assert(!target->can_be_statically_bound() || target == cha_monomorphic_target, "");
2119+
assert(!target->can_be_statically_bound() || target->equals(cha_monomorphic_target), "");
21202120
assert(!cha_monomorphic_target->is_abstract(), "");
21212121
if (!cha_monomorphic_target->can_be_statically_bound(actual_recv)) {
21222122
// If we inlined because CHA revealed only a single target method,

src/hotspot/share/ci/ciMethod.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,22 @@ bool ciMethod::can_omit_stack_trace() const {
781781
return _can_omit_stack_trace;
782782
}
783783

784+
// ------------------------------------------------------------------
785+
// ciMethod::equals
786+
//
787+
// Returns true if the methods are the same, taking redefined methods
788+
// into account.
789+
bool ciMethod::equals(const ciMethod* m) const {
790+
if (this == m) return true;
791+
VM_ENTRY_MARK;
792+
Method* m1 = this->get_Method();
793+
Method* m2 = m->get_Method();
794+
if (m1->is_old()) m1 = m1->get_new_method();
795+
if (m2->is_old()) m2 = m2->get_new_method();
796+
return m1 == m2;
797+
}
798+
799+
784800
// ------------------------------------------------------------------
785801
// ciMethod::resolve_invoke
786802
//

src/hotspot/share/ci/ciMethod.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ class ciMethod : public ciMetadata {
366366

367367
bool can_omit_stack_trace() const;
368368

369+
bool equals(const ciMethod* m) const;
370+
369371
// Replay data methods
370372
static void dump_name_as_ascii(outputStream* st, Method* method);
371373
void dump_name_as_ascii(outputStream* st);

0 commit comments

Comments
 (0)