Top


定義場所(file name)

hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp

説明(description)

  // This is a fast test on whether a reference points into the
  // collection set or not. It does not assume that the reference
  // points into the heap; if it doesn't, it will return false.

名前(function name)

  bool in_cset_fast_test(oop obj) {

本体部(body)

  {- -------------------------------------------
  (1) (assert)
      ---------------------------------------- -}

        assert(_in_cset_fast_test != NULL, "sanity");

  {- -------------------------------------------
  (1) 指定されたポインタが collection set 内を指しているかどうかをリターンする.
      内部的には _in_cset_fast_test という配列を持っており, 
      配列中のポインタの指示先に対応する箇所を見るだけ.
      ---------------------------------------- -}

        if (_g1_committed.contains((HeapWord*) obj)) {
          // no need to subtract the bottom of the heap from obj,
          // _in_cset_fast_test is biased
          size_t index = ((size_t) obj) >> HeapRegion::LogOfHRGrainBytes;
          bool ret = _in_cset_fast_test[index];
          // let's make sure the result is consistent with what the slower
          // test returns
          assert( ret || !obj_in_cs(obj), "sanity");
          assert(!ret ||  obj_in_cs(obj), "sanity");
          return ret;
        } else {
          return false;
        }
      }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.