mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-05 03:05:47 +00:00
8340141: C1: rework ciMethod::equals following 8338471
Reviewed-by: kvn, vlivanov
This commit is contained in:
parent
76e874c08e
commit
293323c3e2
@ -2121,7 +2121,7 @@ void GraphBuilder::invoke(Bytecodes::Code code) {
|
||||
}
|
||||
|
||||
if (cha_monomorphic_target != nullptr) {
|
||||
assert(!target->can_be_statically_bound() || target->equals(cha_monomorphic_target), "");
|
||||
assert(!target->can_be_statically_bound() || target == cha_monomorphic_target, "");
|
||||
assert(!cha_monomorphic_target->is_abstract(), "");
|
||||
if (!cha_monomorphic_target->can_be_statically_bound(actual_recv)) {
|
||||
// If we inlined because CHA revealed only a single target method,
|
||||
|
||||
@ -742,6 +742,13 @@ ciMethod* ciMethod::find_monomorphic_target(ciInstanceKlass* caller,
|
||||
if (target() == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Redefinition support.
|
||||
if (this->is_old() || root_m->is_old() || target->is_old()) {
|
||||
guarantee(CURRENT_THREAD_ENV->jvmti_state_changed(), "old method not detected");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (target() == root_m->get_Method()) {
|
||||
return root_m;
|
||||
}
|
||||
@ -781,22 +788,6 @@ bool ciMethod::can_omit_stack_trace() const {
|
||||
return _can_omit_stack_trace;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciMethod::equals
|
||||
//
|
||||
// Returns true if the methods are the same, taking redefined methods
|
||||
// into account.
|
||||
bool ciMethod::equals(const ciMethod* m) const {
|
||||
if (this == m) return true;
|
||||
VM_ENTRY_MARK;
|
||||
Method* m1 = this->get_Method();
|
||||
Method* m2 = m->get_Method();
|
||||
if (m1->is_old()) m1 = m1->get_new_method();
|
||||
if (m2->is_old()) m2 = m2->get_new_method();
|
||||
return m1 == m2;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciMethod::resolve_invoke
|
||||
//
|
||||
@ -835,6 +826,12 @@ ciMethod* ciMethod::resolve_invoke(ciKlass* caller, ciKlass* exact_receiver, boo
|
||||
|
||||
ciMethod* result = this;
|
||||
if (m != get_Method()) {
|
||||
// Redefinition support.
|
||||
if (this->is_old() || m->is_old()) {
|
||||
guarantee(CURRENT_THREAD_ENV->jvmti_state_changed(), "old method not detected");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
result = CURRENT_THREAD_ENV->get_method(m);
|
||||
}
|
||||
|
||||
@ -1495,3 +1492,10 @@ bool ciMethod::is_consistent_info(ciMethod* declared_method, ciMethod* resolved_
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// ciMethod::is_old
|
||||
//
|
||||
// Return true for redefined methods
|
||||
bool ciMethod::is_old() const {
|
||||
ASSERT_IN_VM;
|
||||
return get_Method()->is_old();
|
||||
}
|
||||
|
||||
@ -360,13 +360,12 @@ class ciMethod : public ciMetadata {
|
||||
bool is_vector_method() const;
|
||||
bool is_object_initializer() const;
|
||||
bool is_scoped() const;
|
||||
bool is_old() const;
|
||||
|
||||
bool can_be_statically_bound(ciInstanceKlass* context) const;
|
||||
|
||||
bool can_omit_stack_trace() const;
|
||||
|
||||
bool equals(const ciMethod* m) const;
|
||||
|
||||
// Replay data methods
|
||||
static void dump_name_as_ascii(outputStream* st, Method* method);
|
||||
void dump_name_as_ascii(outputStream* st);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user