< prev index next > src/hotspot/share/ci/ciObjectFactory.cpp
Print this page
Handle keyHandle(Thread::current(), key);
assert(Universe::heap()->is_in(keyHandle()), "must be");
NonPermObject* &bucket = find_non_perm(keyHandle);
if (bucket != nullptr) {
! return bucket->object();
}
// The ciObject does not yet exist. Create it and insert it
// into the cache.
ciObject* new_object = create_new_object(keyHandle());
Handle keyHandle(Thread::current(), key);
assert(Universe::heap()->is_in(keyHandle()), "must be");
NonPermObject* &bucket = find_non_perm(keyHandle);
if (bucket != nullptr) {
! ciObject* obj = bucket->object();
+ notice_object_access(obj);
+ return obj;
}
// The ciObject does not yet exist. Create it and insert it
// into the cache.
ciObject* new_object = create_new_object(keyHandle());
init_ident_of(new_object);
assert(Universe::heap()->is_in(new_object->get_oop()), "must be");
// Not a perm-space object.
insert_non_perm(bucket, keyHandle, new_object);
! notice_new_object(new_object);
return new_object;
}
! void ciObjectFactory::notice_new_object(ciBaseObject* new_object) {
if (TrainingData::need_data()) {
ciEnv* env = ciEnv::current();
if (env->task() != nullptr) {
// Note: task will be null during init_compiler_runtime.
CompileTrainingData* td = env->task()->training_data();
init_ident_of(new_object);
assert(Universe::heap()->is_in(new_object->get_oop()), "must be");
// Not a perm-space object.
insert_non_perm(bucket, keyHandle, new_object);
! notice_object_access(new_object);
return new_object;
}
! void ciObjectFactory::notice_object_access(ciBaseObject* new_object) {
if (TrainingData::need_data()) {
ciEnv* env = ciEnv::current();
if (env->task() != nullptr) {
// Note: task will be null during init_compiler_runtime.
CompileTrainingData* td = env->task()->training_data();
// into the table. We need to recompute our index.
index = _ci_metadata.find_sorted<Metadata*, ciObjectFactory::metadata_compare>(key, found);
}
assert(!found, "no double insert");
_ci_metadata.insert_before(index, new_object);
! notice_new_object(new_object);
return new_object;
}
! return _ci_metadata.at(index)->as_metadata();
}
// ------------------------------------------------------------------
// ciObjectFactory::create_new_object
//
// into the table. We need to recompute our index.
index = _ci_metadata.find_sorted<Metadata*, ciObjectFactory::metadata_compare>(key, found);
}
assert(!found, "no double insert");
_ci_metadata.insert_before(index, new_object);
! notice_object_access(new_object);
return new_object;
}
! ciMetadata* metadata = _ci_metadata.at(index)->as_metadata();
+ notice_object_access(metadata);
+ return metadata;
}
// ------------------------------------------------------------------
// ciObjectFactory::create_new_object
//
< prev index next >