8258242: Type profile pollution occurs when memory segments of different kinds are used

Reviewed-by: vlivanov, redestad
This commit is contained in:
Maurizio Cimadamore 2020-12-15 13:50:40 +00:00
parent 09e8675f56
commit 7ff9c85639
8 changed files with 225 additions and 10 deletions

View file

@ -1600,6 +1600,18 @@ bool MethodData::profile_unsafe(const methodHandle& m, int bci) {
return false;
}
bool MethodData::profile_memory_access(const methodHandle& m, int bci) {
Bytecode_invoke inv(m , bci);
if (inv.is_invokestatic()) {
if (inv.klass() == vmSymbols::jdk_incubator_foreign_MemoryAccess()) {
if (inv.name()->starts_with("get") || inv.name()->starts_with("set")) {
return true;
}
}
}
return false;
}
int MethodData::profile_arguments_flag() {
return TypeProfileLevel % 10;
}
@ -1629,6 +1641,10 @@ bool MethodData::profile_arguments_for_invoke(const methodHandle& m, int bci) {
return true;
}
if (profile_memory_access(m, bci)) {
return true;
}
assert(profile_arguments_jsr292_only(), "inconsistent");
return profile_jsr292(m, bci);
}