8341444: Unnecessary check for JSRs in CDS
Reviewed-by: dholmes, coleenp
This commit is contained in:
parent
8174cbd5cb
commit
28252bb48d
@ -2452,11 +2452,11 @@ void InstanceKlass::metaspace_pointers_do(MetaspaceClosure* it) {
|
||||
#endif
|
||||
#if INCLUDE_CDS
|
||||
// For "old" classes with methods containing the jsr bytecode, the _methods array will
|
||||
// be rewritten during runtime (see Rewriter::rewrite_jsrs()). So setting the _methods to
|
||||
// be writable. The length check on the _methods is necessary because classes which
|
||||
// don't have any methods share the Universe::_the_empty_method_array which is in the RO region.
|
||||
if (_methods != nullptr && _methods->length() > 0 &&
|
||||
!can_be_verified_at_dumptime() && methods_contain_jsr_bytecode()) {
|
||||
// be rewritten during runtime (see Rewriter::rewrite_jsrs()) but they cannot be safely
|
||||
// checked here with ByteCodeStream. All methods that can't be verified are made writable.
|
||||
// The length check on the _methods is necessary because classes which don't have any
|
||||
// methods share the Universe::_the_empty_method_array which is in the RO region.
|
||||
if (_methods != nullptr && _methods->length() > 0 && !can_be_verified_at_dumptime()) {
|
||||
// To handle jsr bytecode, new Method* maybe stored into _methods
|
||||
it->push(&_methods, MetaspaceClosure::_writable);
|
||||
} else {
|
||||
@ -2697,21 +2697,6 @@ bool InstanceKlass::can_be_verified_at_dumptime() const {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool InstanceKlass::methods_contain_jsr_bytecode() const {
|
||||
Thread* thread = Thread::current();
|
||||
for (int i = 0; i < _methods->length(); i++) {
|
||||
methodHandle m(thread, _methods->at(i));
|
||||
BytecodeStream bcs(m);
|
||||
while (!bcs.is_last_bytecode()) {
|
||||
Bytecodes::Code opcode = bcs.next();
|
||||
if (opcode == Bytecodes::_jsr || opcode == Bytecodes::_jsr_w) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // INCLUDE_CDS
|
||||
|
||||
#if INCLUDE_JVMTI
|
||||
|
@ -1116,7 +1116,6 @@ public:
|
||||
void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, PackageEntry* pkg_entry, TRAPS);
|
||||
void init_shared_package_entry();
|
||||
bool can_be_verified_at_dumptime() const;
|
||||
bool methods_contain_jsr_bytecode() const;
|
||||
void compute_has_loops_flag_for_methods();
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user