Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8266074: Vtable-based CHA implementation #3727

Closed
wants to merge 8 commits into from
Closed
Changes from 4 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -2026,7 +2026,7 @@ void GraphBuilder::invoke(Bytecodes::Code code) {
// by dynamic class loading. Be sure to test the "static" receiver
// dest_method here, as opposed to the actual receiver, which may
// falsely lead us to believe that the receiver is final or private.
dependency_recorder()->assert_unique_concrete_method(actual_recv, cha_monomorphic_target);
dependency_recorder()->assert_unique_concrete_method(actual_recv, cha_monomorphic_target, callee_holder, target);
}
code = Bytecodes::_invokespecial;
}
@@ -346,6 +346,9 @@ void BCEscapeAnalyzer::invoke(StateInfo &state, Bytecodes::Code code, ciMethod*
(code == Bytecodes::_invokevirtual && !target->is_final_method())) {
_dependencies.append(actual_recv);
_dependencies.append(inline_target);
_dependencies.append(callee_holder);
_dependencies.append(target);
assert(callee_holder->is_interface() == (code == Bytecodes::_invokeinterface), "sanity");
}
_dependencies.appendAll(analyzer.dependencies());
}
@@ -1495,9 +1498,11 @@ void BCEscapeAnalyzer::copy_dependencies(Dependencies *deps) {
// callee will trigger recompilation.
deps->assert_evol_method(method());
}
for (int i = 0; i < _dependencies.length(); i+=2) {
ciKlass *k = _dependencies.at(i)->as_klass();
ciMethod *m = _dependencies.at(i+1)->as_method();
deps->assert_unique_concrete_method(k, m);
for (int i = 0; i < _dependencies.length(); i+=4) {
ciKlass* recv_klass = _dependencies.at(i+0)->as_klass();
ciMethod* target = _dependencies.at(i+1)->as_method();
ciKlass* resolved_klass = _dependencies.at(i+2)->as_klass();
ciMethod* resolved_method = _dependencies.at(i+3)->as_method();
deps->assert_unique_concrete_method(recv_klass, target, resolved_klass, resolved_method);
}
}
@@ -712,7 +712,15 @@ ciMethod* ciMethod::find_monomorphic_target(ciInstanceKlass* caller,
{
MutexLocker locker(Compile_lock);
InstanceKlass* context = actual_recv->get_instanceKlass();
target = methodHandle(THREAD, Dependencies::find_unique_concrete_method(context, root_m->get_Method()));
if (UseVtableBasedCHA) {
target = methodHandle(THREAD, Dependencies::find_unique_concrete_method(context,
root_m->get_Method(),
callee_holder->get_Klass(),
this->get_Method()));
} else {
target = methodHandle(THREAD, Dependencies::find_unique_concrete_method(context, root_m->get_Method()));
}
assert(target() == NULL || !target()->is_abstract(), "not allowed");
// %%% Should upgrade this ciMethod API to look for 1 or 2 concrete methods.
}

@@ -1184,10 +1184,18 @@ void CodeCache::flush_dependents_on(InstanceKlass* dependee) {

if (number_of_nmethods_with_dependencies() == 0) return;

KlassDepChange changes(dependee);
int marked = 0;
if (dependee->is_linked()) {
// Class initialization state change.
KlassInitDepChange changes(dependee);
marked = mark_for_deoptimization(changes);
} else {
// New class is loaded.
NewKlassDepChange changes(dependee);
marked = mark_for_deoptimization(changes);
}

// Compute the dependent nmethods
if (mark_for_deoptimization(changes) > 0) {
if (marked > 0) {
// At least one nmethod has been marked for deoptimization
Deoptimization::deoptimize_all_marked();
}