8153312: Constrain AppCDS behavior

Reviewed-by: iklam, acorn, mschoene
This commit is contained in:
Jiangli Zhou 2016-04-20 16:39:37 -04:00
parent 2a09a3923a
commit bd07a43e61
7 changed files with 131 additions and 19 deletions

View file

@ -313,6 +313,33 @@ void Method::remove_unshareable_info() {
unlink_method();
}
void Method::set_vtable_index(int index) {
if (is_shared() && !MetaspaceShared::remapped_readwrite()) {
// At runtime initialize_vtable is rerun as part of link_class_impl()
// for a shared class loaded by the non-boot loader to obtain the loader
// constraints based on the runtime classloaders' context.
return; // don't write into the shared class
} else {
_vtable_index = index;
}
}
void Method::set_itable_index(int index) {
if (is_shared() && !MetaspaceShared::remapped_readwrite()) {
// At runtime initialize_itable is rerun as part of link_class_impl()
// for a shared class loaded by the non-boot loader to obtain the loader
// constraints based on the runtime classloaders' context. The dumptime
// itable index should be the same as the runtime index.
assert(_vtable_index == itable_index_max - index,
"archived itable index is different from runtime index");
return; // dont write into the shared class
} else {
_vtable_index = itable_index_max - index;
}
assert(valid_itable_index(), "");
}
bool Method::was_executed_more_than(int n) {
// Invocation counter is reset when the Method* is compiled.