jvmtiError JvmtiCodeBlobEvents::generate_dynamic_code_events(JvmtiEnv* env) {
  CodeBlobCollector collector;

  // first collect all the code blobs
  {
MutexLocker mu(CodeCache_lock);
    collector.collect();
  }

  // iterate over the collected list and post an event for each blob
  JvmtiCodeBlobDesc* blob = collector.first();
  while (blob != NULL) {
    JvmtiExport::post_dynamic_code_generated(env, blob->name(), blob->code_begin(), blob->code_end());
    blob = collector.next();					   
  }
  return JVMTI_ERROR_NONE;
}
jvmtiError JvmtiCodeBlobEvents::generate_dynamic_code_events(JvmtiEnv* env) {
    CodeBlobCollector collector;

    // First collect all the code blobs.  This has to be done in a
    // single pass over the code cache with CodeCache_lock held because
    // there isn't any safe way to iterate over regular CodeBlobs since
    // they can be freed at any point.
    {
        MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
        collector.collect();
    }

    // iterate over the collected list and post an event for each blob
    JvmtiCodeBlobDesc* blob = collector.first();
    while (blob != NULL) {
        JvmtiExport::post_dynamic_code_generated(env, blob->name(), blob->code_begin(), blob->code_end());
        blob = collector.next();
    }
    return JVMTI_ERROR_NONE;
}