< prev index next >

src/hotspot/share/ci/ciObjectFactory.cpp

Print this page
@@ -237,11 +237,13 @@
    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();
+     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());

@@ -249,15 +251,15 @@
    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);
+   notice_object_access(new_object);
    return new_object;
  }
  
- void ciObjectFactory::notice_new_object(ciBaseObject* 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();

@@ -345,14 +347,16 @@
        // 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);
+     notice_object_access(new_object);
      return new_object;
    }
-   return _ci_metadata.at(index)->as_metadata();
+   ciMetadata* metadata = _ci_metadata.at(index)->as_metadata();
+   notice_object_access(metadata);
+   return metadata;
  }
  
  // ------------------------------------------------------------------
  // ciObjectFactory::create_new_object
  //
< prev index next >