8230199: consolidate signature parsing code in HotSpot sources

Add a new Signature class to support basic signature queries and enhance SignatureStream class to parse field signatures in addition to methods.

Co-authored-by: John Rose <john.r.rose@oracle.com>
Reviewed-by: coleenp, dholmes, fparain, hseigel
This commit is contained in:
Lois Foltan 2020-02-06 14:29:57 +00:00
parent 2ede36b3a3
commit d19a396e96
57 changed files with 1394 additions and 1498 deletions

View file

@ -1,7 +1,7 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1165,7 +1165,7 @@ static int reassign_fields_by_klass(InstanceKlass* klass, frame* fr, RegisterMap
if (!fs.access_flags().is_static() && (!skip_internal || !fs.access_flags().is_internal())) {
ReassignedField field;
field._offset = fs.offset();
field._type = FieldType::basic_type(fs.signature());
field._type = Signature::basic_type(fs.signature());
fields->append(field);
}
}
@ -1606,33 +1606,20 @@ Deoptimization::get_method_data(JavaThread* thread, const methodHandle& m,
#if COMPILER2_OR_JVMCI
void Deoptimization::load_class_by_index(const constantPoolHandle& constant_pool, int index, TRAPS) {
// in case of an unresolved klass entry, load the class.
// In case of an unresolved klass entry, load the class.
// This path is exercised from case _ldc in Parse::do_one_bytecode,
// and probably nowhere else.
// Even that case would benefit from simply re-interpreting the
// bytecode, without paying special attention to the class index.
// So this whole "class index" feature should probably be removed.
if (constant_pool->tag_at(index).is_unresolved_klass()) {
Klass* tk = constant_pool->klass_at_ignore_error(index, CHECK);
return;
}
if (!constant_pool->tag_at(index).is_symbol()) return;
Handle class_loader (THREAD, constant_pool->pool_holder()->class_loader());
Symbol* symbol = constant_pool->symbol_at(index);
// class name?
if (symbol->char_at(0) != '(') {
Handle protection_domain (THREAD, constant_pool->pool_holder()->protection_domain());
SystemDictionary::resolve_or_null(symbol, class_loader, protection_domain, CHECK);
return;
}
// then it must be a signature!
ResourceMark rm(THREAD);
for (SignatureStream ss(symbol); !ss.is_done(); ss.next()) {
if (ss.is_object()) {
Symbol* class_name = ss.as_symbol();
Handle protection_domain (THREAD, constant_pool->pool_holder()->protection_domain());
SystemDictionary::resolve_or_null(class_name, class_loader, protection_domain, CHECK);
}
}
assert(!constant_pool->tag_at(index).is_symbol(),
"no symbolic names here, please");
}