Skip to content

Commit 127bfe4

Browse files
author
Vladimir Ivanov
committed
8266074: Vtable-based CHA implementation
Reviewed-by: kvn, jrose, dlong
1 parent 347d41d commit 127bfe4

File tree

11 files changed

+551
-75
lines changed

11 files changed

+551
-75
lines changed

src/hotspot/share/c1/c1_GraphBuilder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,7 @@ void GraphBuilder::invoke(Bytecodes::Code code) {
20262026
// by dynamic class loading. Be sure to test the "static" receiver
20272027
// dest_method here, as opposed to the actual receiver, which may
20282028
// falsely lead us to believe that the receiver is final or private.
2029-
dependency_recorder()->assert_unique_concrete_method(actual_recv, cha_monomorphic_target);
2029+
dependency_recorder()->assert_unique_concrete_method(actual_recv, cha_monomorphic_target, callee_holder, target);
20302030
}
20312031
code = Bytecodes::_invokespecial;
20322032
}

src/hotspot/share/ci/bcEscapeAnalyzer.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ void BCEscapeAnalyzer::invoke(StateInfo &state, Bytecodes::Code code, ciMethod*
346346
(code == Bytecodes::_invokevirtual && !target->is_final_method())) {
347347
_dependencies.append(actual_recv);
348348
_dependencies.append(inline_target);
349+
_dependencies.append(callee_holder);
350+
_dependencies.append(target);
351+
assert(callee_holder->is_interface() == (code == Bytecodes::_invokeinterface), "sanity");
349352
}
350353
_dependencies.appendAll(analyzer.dependencies());
351354
}
@@ -1495,9 +1498,11 @@ void BCEscapeAnalyzer::copy_dependencies(Dependencies *deps) {
14951498
// callee will trigger recompilation.
14961499
deps->assert_evol_method(method());
14971500
}
1498-
for (int i = 0; i < _dependencies.length(); i+=2) {
1499-
ciKlass *k = _dependencies.at(i)->as_klass();
1500-
ciMethod *m = _dependencies.at(i+1)->as_method();
1501-
deps->assert_unique_concrete_method(k, m);
1501+
for (int i = 0; i < _dependencies.length(); i+=4) {
1502+
ciKlass* recv_klass = _dependencies.at(i+0)->as_klass();
1503+
ciMethod* target = _dependencies.at(i+1)->as_method();
1504+
ciKlass* resolved_klass = _dependencies.at(i+2)->as_klass();
1505+
ciMethod* resolved_method = _dependencies.at(i+3)->as_method();
1506+
deps->assert_unique_concrete_method(recv_klass, target, resolved_klass, resolved_method);
15021507
}
15031508
}

src/hotspot/share/ci/ciMethod.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,15 @@ ciMethod* ciMethod::find_monomorphic_target(ciInstanceKlass* caller,
714714
{
715715
MutexLocker locker(Compile_lock);
716716
InstanceKlass* context = actual_recv->get_instanceKlass();
717-
target = methodHandle(THREAD, Dependencies::find_unique_concrete_method(context, root_m->get_Method()));
717+
if (UseVtableBasedCHA) {
718+
target = methodHandle(THREAD, Dependencies::find_unique_concrete_method(context,
719+
root_m->get_Method(),
720+
callee_holder->get_Klass(),
721+
this->get_Method()));
722+
} else {
723+
target = methodHandle(THREAD, Dependencies::find_unique_concrete_method(context, root_m->get_Method()));
724+
}
725+
assert(target() == NULL || !target()->is_abstract(), "not allowed");
718726
// %%% Should upgrade this ciMethod API to look for 1 or 2 concrete methods.
719727
}
720728

src/hotspot/share/code/codeCache.cpp

+11-3
Original file line numberDiff line numberDiff line change
@@ -1184,10 +1184,18 @@ void CodeCache::flush_dependents_on(InstanceKlass* dependee) {
11841184

11851185
if (number_of_nmethods_with_dependencies() == 0) return;
11861186

1187-
KlassDepChange changes(dependee);
1187+
int marked = 0;
1188+
if (dependee->is_linked()) {
1189+
// Class initialization state change.
1190+
KlassInitDepChange changes(dependee);
1191+
marked = mark_for_deoptimization(changes);
1192+
} else {
1193+
// New class is loaded.
1194+
NewKlassDepChange changes(dependee);
1195+
marked = mark_for_deoptimization(changes);
1196+
}
11881197

1189-
// Compute the dependent nmethods
1190-
if (mark_for_deoptimization(changes) > 0) {
1198+
if (marked > 0) {
11911199
// At least one nmethod has been marked for deoptimization
11921200
Deoptimization::deoptimize_all_marked();
11931201
}

0 commit comments

Comments
 (0)