@@ -234,35 +234,35 @@ void ciObjectFactory::remove_symbols() {
234
234
ciObject* ciObjectFactory::get (oop key) {
235
235
ASSERT_IN_VM;
236
236
237
- assert (Universe::heap ()->is_in (key), " must be" );
237
+ Handle keyHandle (Thread::current (), key);
238
+ assert (Universe::heap ()->is_in (keyHandle ()), " must be" );
238
239
239
- NonPermObject* &bucket = find_non_perm (key );
240
+ NonPermObject* &bucket = find_non_perm (keyHandle );
240
241
if (bucket != nullptr ) {
241
242
return bucket->object ();
242
243
}
243
244
244
245
// The ciObject does not yet exist. Create it and insert it
245
246
// into the cache.
246
- Handle keyHandle (Thread::current (), key);
247
247
ciObject* new_object = create_new_object (keyHandle ());
248
248
assert (keyHandle () == new_object->get_oop (), " must be properly recorded" );
249
249
init_ident_of (new_object);
250
250
assert (Universe::heap ()->is_in (new_object->get_oop ()), " must be" );
251
251
252
252
// Not a perm-space object.
253
- insert_non_perm (bucket, keyHandle () , new_object);
253
+ insert_non_perm (bucket, keyHandle, new_object);
254
254
notice_new_object (new_object);
255
255
return new_object;
256
256
}
257
257
258
258
void ciObjectFactory::notice_new_object (ciBaseObject* new_object) {
259
- if (RecordTraining ) {
259
+ if (TrainingData::need_data () ) {
260
260
ciEnv* env = ciEnv::current ();
261
261
if (env->task () != nullptr ) {
262
262
// Note: task will be null during init_compiler_runtime.
263
- CompileTrainingData* tdata = env->task ()->training_data ();
264
- if (tdata != nullptr ) {
265
- tdata ->notice_jit_observation (env, new_object);
263
+ CompileTrainingData* td = env->task ()->training_data ();
264
+ if (td != nullptr ) {
265
+ td ->notice_jit_observation (env, new_object);
266
266
}
267
267
}
268
268
}
@@ -653,12 +653,12 @@ static ciObjectFactory::NonPermObject* emptyBucket = nullptr;
653
653
// Use a small hash table, hashed on the klass of the key.
654
654
// If there is no entry in the cache corresponding to this oop, return
655
655
// the null tail of the bucket into which the oop should be inserted.
656
- ciObjectFactory::NonPermObject* &ciObjectFactory::find_non_perm (oop key ) {
657
- assert (Universe::heap ()->is_in (key ), " must be" );
658
- ciMetadata* klass = get_metadata (key ->klass ());
656
+ ciObjectFactory::NonPermObject* &ciObjectFactory::find_non_perm (Handle keyHandle ) {
657
+ assert (Universe::heap ()->is_in (keyHandle () ), " must be" );
658
+ ciMetadata* klass = get_metadata (keyHandle ->klass ()); // This may safepoint!
659
659
NonPermObject* *bp = &_non_perm_bucket[(unsigned ) klass->hash () % NON_PERM_BUCKETS];
660
660
for (NonPermObject* p; (p = (*bp)) != nullptr ; bp = &p->next ()) {
661
- if (is_equal (p, key )) break ;
661
+ if (is_equal (p, keyHandle () )) break ;
662
662
}
663
663
return (*bp);
664
664
}
@@ -681,12 +681,12 @@ inline ciObjectFactory::NonPermObject::NonPermObject(ciObjectFactory::NonPermObj
681
681
// ciObjectFactory::insert_non_perm
682
682
//
683
683
// Insert a ciObject into the non-perm table.
684
- void ciObjectFactory::insert_non_perm (ciObjectFactory::NonPermObject* &where, oop key , ciObject* obj) {
685
- assert (Universe::heap ()->is_in_or_null (key ), " must be" );
684
+ void ciObjectFactory::insert_non_perm (ciObjectFactory::NonPermObject* &where, Handle keyHandle , ciObject* obj) {
685
+ assert (Universe::heap ()->is_in_or_null (keyHandle () ), " must be" );
686
686
assert (&where != &emptyBucket, " must not try to fill empty bucket" );
687
- NonPermObject* p = new (arena ()) NonPermObject (where, key , obj);
688
- assert (where == p && is_equal (p, key ) && p->object () == obj, " entry must match" );
689
- assert (find_non_perm (key ) == p, " must find the same spot" );
687
+ NonPermObject* p = new (arena ()) NonPermObject (where, keyHandle () , obj);
688
+ assert (where == p && is_equal (p, keyHandle () ) && p->object () == obj, " entry must match" );
689
+ assert (find_non_perm (keyHandle ) == p, " must find the same spot" );
690
690
++_non_perm_count;
691
691
}
692
692
0 commit comments