< prev index next >

src/share/vm/code/codeCache.cpp

Print this page
rev 10619 : [backport] Move ParallelCodeIterator to ShenandoahCodeRoots

@@ -973,56 +973,5 @@
   st->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'"
             " adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'",
             nof_blobs(), nof_nmethods(), nof_adapters(),
             unallocated_capacity());
 }
-
-ParallelCodeCacheIterator::ParallelCodeCacheIterator() :
-        _claimed_idx(0), _finished(false) {
-};
-
-
-void ParallelCodeCacheIterator::parallel_blobs_do(CodeBlobClosure* f) {
-  assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint");
-
-  /*
-   * Parallel code heap walk.
-   *
-   * This code makes all threads scan all code heaps, but only one thread would execute the
-   * closure on given blob. This is achieved by recording the "claimed" blocks: if a thread
-   * had claimed the block, it can process all blobs in it. Others have to fast-forward to
-   * next attempt without processing.
-   *
-   * Late threads would return immediately if iterator is finished.
-   */
-
-  if (_finished) {
-    return;
-  }
-
-  int stride = 256; // educated guess
-  int stride_mask = stride - 1;
-  assert (is_power_of_2(stride), "sanity");
-
-  int count = 0;
-  bool process_block = true;
-
-  for (CodeBlob *cb = CodeCache::first(); cb != NULL; cb = CodeCache::next(cb)) {
-    int current = count++;
-    if ((current & stride_mask) == 0) {
-      process_block = (current >= _claimed_idx) &&
-                      (Atomic::cmpxchg(current + stride, &_claimed_idx, current) == current);
-    }
-    if (process_block) {
-      if (cb->is_alive()) {
-        f->do_code_blob(cb);
-#ifdef ASSERT
-        if (cb->is_nmethod())
-          ((nmethod*)cb)->verify_scavenge_root_oops();
-#endif
-      }
-    }
-  }
-
-  _finished = true;
-}
-
< prev index next >