示例#1
0
int rSet::get_size(memOop obj) {
  unsigned char* p = (unsigned char*) byte_for(obj->addr());
  unsigned char h = *p++;
  if (h <= lim_0 + 1) return h + lim_0;
  if (h == lim_0 + 2) return (*(unsigned char*)  p) + lim_1;
  if (h == lim_0 + 3) return (*(unsigned short*) p) + lim_2;
  if (h == lim_0 + 4) return (*(unsigned int*)   p) + lim_3;
  ShouldNotReachHere();
  return 0;
}
示例#2
0
bool rSet::is_object_dirty(memOop obj) {
  assert(!obj->is_new(), "just checking");
  char* current_byte = byte_for(obj->addr());
  char* end_byte     = byte_for(obj->addr() + obj->size());
  while (current_byte <= end_byte) {
    if (*current_byte == 0) return true;
    current_byte++;
  }
  return false;
}
示例#3
0
void rSet::set_size(memOop obj, int size) {
  unsigned char* p = (unsigned char*) byte_for(obj->addr());
  assert(size >= lim_0, "size must be >= max_age");
  if (size < lim_1) { 		// use 1 byte
    *p = (unsigned char) (size - lim_0);
  } else if (size < lim_2) { 	// use 1 + 1 bytes
    *p++ = lim_0 + 2;
    *p   = (unsigned char) (size - lim_1);
  } else if (size < lim_3) { 	// use 1 + 2 bytes
    *p++ = lim_0 + 3;
    *(unsigned short*)p = (unsigned short) (size - lim_2);
  } else { 			// use 1 + 4 bytes
    *p++ = lim_0 + 4;
    *(unsigned int*)p = (unsigned int) (size - lim_3);
  }
}
示例#4
0
void rSet::print_set_for_object(memOop obj) {
  std->print("Remember set for 0x%lx ", obj);
  obj->print_value();
  std->cr();
  if (obj->is_new()) {
    std->print_cr(" object is in new space!");
  } else {
    std->sp();
    char* current_byte = byte_for(obj->addr());
    char* end_byte     = byte_for(obj->addr() + obj->size());
    while (current_byte <= end_byte) {
      if (*current_byte) {
        std->print("_");
      } else {
        std->print("*");
      }
      current_byte++;
    }
    std->cr();
  }
}