Esempio n. 1
0
void ContiguousSpace::verify(bool allow_dirty) const {
  HeapWord* p = bottom();
  HeapWord* t = top();
  HeapWord* prev_p = NULL;
  while (p < t) {
    oop(p)->verify();
    prev_p = p;
    p += oop(p)->size();
  }
  guarantee(p == top(), "end of last object must match end of space");
  if (top() != end()) {
    guarantee(top() == block_start_const(end()-1) &&
              top() == block_start_const(top()),
              "top should be start of unallocated block, if it exists");
  }
}
Esempio n. 2
0
File: space.cpp Progetto: dain/graal
void OffsetTableContigSpace::verify() const {
  HeapWord* p = bottom();
  HeapWord* prev_p = NULL;
  int objs = 0;
  int blocks = 0;

  if (VerifyObjectStartArray) {
    _offsets.verify();
  }

  while (p < top()) {
    size_t size = oop(p)->size();
    // For a sampling of objects in the space, find it using the
    // block offset table.
    if (blocks == BLOCK_SAMPLE_INTERVAL) {
      guarantee(p == block_start_const(p + (size/2)),
                "check offset computation");
      blocks = 0;
    } else {
      blocks++;
    }

    if (objs == OBJ_SAMPLE_INTERVAL) {
      oop(p)->verify();
      objs = 0;
    } else {
      objs++;
    }
    prev_p = p;
    p += size;
  }
  guarantee(p == top(), "end of last object must match end of space");
}
Esempio n. 3
0
void OffsetTableContigSpace::verify(bool allow_dirty) const {
  HeapWord* p = bottom();
  HeapWord* prev_p = NULL;
  VerifyOldOopClosure blk;      // Does this do anything?
  blk._allow_dirty = allow_dirty;
  int objs = 0;
  int blocks = 0;

  if (VerifyObjectStartArray) {
    _offsets.verify();
  }

  while (p < top()) {
    size_t size = oop(p)->size();
    // For a sampling of objects in the space, find it using the
    // block offset table.
    if (blocks == BLOCK_SAMPLE_INTERVAL) {
      guarantee(p == block_start_const(p + (size/2)),
                "check offset computation");
      blocks = 0;
    } else {
      blocks++;
    }

    if (objs == OBJ_SAMPLE_INTERVAL) {
      oop(p)->verify();
      blk._the_obj = oop(p);
      oop(p)->oop_iterate(&blk);
      objs = 0;
    } else {
      objs++;
    }
    prev_p = p;
    p += size;
  }
  guarantee(p == top(), "end of last object must match end of space");
}
Esempio n. 4
0
inline HeapWord* Space::block_start(const void* p) {
  return block_start_const(p);
}
Esempio n. 5
0
void HeapRegion::verify(bool allow_dirty,
                        bool use_prev_marking,
                        bool* failures) const {
  G1CollectedHeap* g1 = G1CollectedHeap::heap();
  *failures = false;
  HeapWord* p = bottom();
  HeapWord* prev_p = NULL;
  int objs = 0;
  int blocks = 0;
  VerifyLiveClosure vl_cl(g1, use_prev_marking);
  bool is_humongous = isHumongous();
  size_t object_num = 0;
  while (p < top()) {
    size_t size = oop(p)->size();
    if (is_humongous != g1->isHumongous(size)) {
      gclog_or_tty->print_cr("obj "PTR_FORMAT" is of %shumongous size ("
                             SIZE_FORMAT" words) in a %shumongous region",
                             p, g1->isHumongous(size) ? "" : "non-",
                             size, is_humongous ? "" : "non-");
       *failures = true;
    }
    object_num += 1;
    if (blocks == BLOCK_SAMPLE_INTERVAL) {
      HeapWord* res = block_start_const(p + (size/2));
      if (p != res) {
        gclog_or_tty->print_cr("offset computation 1 for "PTR_FORMAT" and "
                               SIZE_FORMAT" returned "PTR_FORMAT,
                               p, size, res);
        *failures = true;
        return;
      }
      blocks = 0;
    } else {
      blocks++;
    }
    if (objs == OBJ_SAMPLE_INTERVAL) {
      oop obj = oop(p);
      if (!g1->is_obj_dead_cond(obj, this, use_prev_marking)) {
        if (obj->is_oop()) {
          klassOop klass = obj->klass();
          if (!klass->is_perm()) {
            gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" "
                                   "not in perm", klass, obj);
            *failures = true;
            return;
          } else if (!klass->is_klass()) {
            gclog_or_tty->print_cr("klass "PTR_FORMAT" of object "PTR_FORMAT" "
                                   "not a klass", klass, obj);
            *failures = true;
            return;
          } else {
            vl_cl.set_containing_obj(obj);
            obj->oop_iterate(&vl_cl);
            if (vl_cl.failures()) {
              *failures = true;
            }
            if (G1MaxVerifyFailures >= 0 &&
                vl_cl.n_failures() >= G1MaxVerifyFailures) {
              return;
            }
          }
        } else {
          gclog_or_tty->print_cr(PTR_FORMAT" no an oop", obj);
          *failures = true;
          return;
        }
      }
      objs = 0;
    } else {
      objs++;
    }
    prev_p = p;
    p += size;
  }
  HeapWord* rend = end();
  HeapWord* rtop = top();
  if (rtop < rend) {
    HeapWord* res = block_start_const(rtop + (rend - rtop) / 2);
    if (res != rtop) {
        gclog_or_tty->print_cr("offset computation 2 for "PTR_FORMAT" and "
                               PTR_FORMAT" returned "PTR_FORMAT,
                               rtop, rend, res);
        *failures = true;
        return;
    }
  }

  if (is_humongous && object_num > 1) {
    gclog_or_tty->print_cr("region ["PTR_FORMAT","PTR_FORMAT"] is humongous "
                           "but has "SIZE_FORMAT", objects",
                           bottom(), end(), object_num);
    *failures = true;
  }

  if (p != top()) {
    gclog_or_tty->print_cr("end of last object "PTR_FORMAT" "
                           "does not match top "PTR_FORMAT, p, top());
    *failures = true;
    return;
  }
}
Esempio n. 6
0
bool Space::is_in(const void* p) const {
  HeapWord* b = block_start_const(p);
  return b != NULL && block_is_obj(b);
}