8171008: Integrate AOT compiler into JDK

Co-authored-by: Christian Thalinger <cthalinger@twitter.com>
Co-authored-by: Dean Long <dean.long@oracle.com>
Co-authored-by: Dmitrij Pochepko <dmitrij.pochepko@oracle.com>
Co-authored-by: Dmitry Chuyko <dmitry.chuyko@oracle.com>
Co-authored-by: Doug Simon <doug.simon@oracle.com>
Co-authored-by: Eric Caspole <eric.caspole@oracle.com>
Co-authored-by: Igor Ignatyev <igor.ignatyev@oracle.com>
Co-authored-by: Igor Veresov <igor.veresov@oracle.com>
Co-authored-by: John Rose <john.r.rose@oracle.com>
Co-authored-by: Morris Meyer <morris.meyer@oracle.com>
Co-authored-by: Niclas Adlertz <niclas.adlertz@oracle.com>
Co-authored-by: Rickard Backman <rickard.backman@oracle.com>
Reviewed-by: erikj, mchung, psandoz, coleenp, iklam, stefank, simonis
This commit is contained in:
Bharadwaj Yadavalli 2016-12-11 19:07:04 -08:00 committed by Vladimir Kozlov
parent 3ef35612c7
commit 2841c5eb2b
262 changed files with 19625 additions and 676 deletions

View file

@ -23,8 +23,10 @@
*/
#include "precompiled.hpp"
#include "aot/aotLoader.hpp"
#include "classfile/classFileParser.hpp"
#include "classfile/classFileStream.hpp"
#include "classfile/classLoader.hpp"
#include "classfile/javaClasses.hpp"
#include "classfile/moduleEntry.hpp"
#include "classfile/systemDictionary.hpp"
@ -145,7 +147,8 @@ InstanceKlass* InstanceKlass::allocate_instance_klass(const ClassFileParser& par
parser.itable_size(),
nonstatic_oop_map_size(parser.total_oop_map_count()),
parser.is_interface(),
parser.is_anonymous());
parser.is_anonymous(),
should_store_fingerprint());
const Symbol* const class_name = parser.class_name();
assert(class_name != NULL, "invariant");
@ -788,6 +791,9 @@ void InstanceKlass::initialize_impl(instanceKlassHandle this_k, TRAPS) {
}
// Look for aot compiled methods for this klass, including class initializer.
AOTLoader::load_for_klass(this_k, THREAD);
// Step 8
{
assert(THREAD->is_Java_thread(), "non-JavaThread in initialize_impl");
@ -1951,6 +1957,72 @@ void InstanceKlass::clean_method_data(BoolObjectClosure* is_alive) {
}
}
bool InstanceKlass::supers_have_passed_fingerprint_checks() {
if (java_super() != NULL && !java_super()->has_passed_fingerprint_check()) {
ResourceMark rm;
log_trace(class, fingerprint)("%s : super %s not fingerprinted", external_name(), java_super()->external_name());
return false;
}
Array<Klass*>* local_interfaces = this->local_interfaces();
if (local_interfaces != NULL) {
int length = local_interfaces->length();
for (int i = 0; i < length; i++) {
InstanceKlass* intf = InstanceKlass::cast(local_interfaces->at(i));
if (!intf->has_passed_fingerprint_check()) {
ResourceMark rm;
log_trace(class, fingerprint)("%s : interface %s not fingerprinted", external_name(), intf->external_name());
return false;
}
}
}
return true;
}
bool InstanceKlass::should_store_fingerprint() {
#if INCLUDE_AOT
// We store the fingerprint into the InstanceKlass only in the following 2 cases:
if (EnableJVMCI && !UseJVMCICompiler) {
// (1) We are running AOT to generate a shared library.
return true;
}
if (DumpSharedSpaces) {
// (2) We are running -Xshare:dump to create a shared archive
return true;
}
#endif
// In all other cases we might set the _misc_has_passed_fingerprint_check bit,
// but do not store the 64-bit fingerprint to save space.
return false;
}
bool InstanceKlass::has_stored_fingerprint() const {
#if INCLUDE_AOT
return should_store_fingerprint() || is_shared();
#else
return false;
#endif
}
uint64_t InstanceKlass::get_stored_fingerprint() const {
address adr = adr_fingerprint();
if (adr != NULL) {
return (uint64_t)Bytes::get_native_u8(adr); // adr may not be 64-bit aligned
}
return 0;
}
void InstanceKlass::store_fingerprint(uint64_t fingerprint) {
address adr = adr_fingerprint();
if (adr != NULL) {
Bytes::put_native_u8(adr, (u8)fingerprint); // adr may not be 64-bit aligned
ResourceMark rm;
log_trace(class, fingerprint)("stored as " PTR64_FORMAT " for class %s", fingerprint, external_name());
}
}
static void remove_unshareable_in_class(Klass* k) {
// remove klass's unshareable info