Example #1
0
int32 MethodLookupKey::hash() {
    int32 i;

    // Coded for speed - called for every codeTable lookup

    // XOR the identity-hash values of the fields.  For efficiency, just
    // xor the marks and extract hash bits at the end instead of doing
    // this for every field.
    // Also, don't need to check for no_hash: real keys are guaranteed
    // to have an id hash value because init_hash is called before a
    // key is added to the table.  If a lookup key contains oops with
    // no_hash, we'll have a bogus hash value, but we won't find anything
    // anyway.
    i  = (int32)receiverMapOop()->mark();
    if (selector->is_mem())
        i ^= (int32)memOop(selector)->mark();

    // Can't do the optimization for the methodHolder - it might be
    // e.g. a smiOop in the lookupError glue method.

    // Not non-zero often enough to hash on
    // (an optimization for speed; Bay's idea)
    //  i ^= (int32)delegatee             ->mark();

    return   (lookupType & ~ImplicitSelfBit)
             ^ markOop(i)->hash()
             ^ methodHolder_or_map()->identity_hash();
}
Example #2
0
void markMap::print(oop obj) {
  if (obj->is_map()) {
    lprintf("mark ");
    Map::print(obj);
  } else {
    markOop(obj)->print();
  }
}
Example #3
0
void markOopDesc::print_on(outputStream* st) const {
  if (is_locked()) {
    st->print("locked(0x%lx)->", value());
    markOop(*(markOop*)value())->print_on(st);
  } else {
    assert(is_unlocked(), "just checking");
    st->print("mark(");
    st->print("hash %#lx,", hash());
    st->print("age %d)", age());
  }
}
Example #4
0
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC

void markOopDesc::print_on(outputStream* st) const {
  if (is_locked()) {
    st->print("locked(" INTPTR_FORMAT ")->", value());
    markOop(*(markOop*)value())->print_on(st);
  } else {
    assert(is_unlocked() || has_bias_pattern(), "just checking");
    st->print("mark(");
    if (has_bias_pattern())  st->print("biased,");
    st->print("hash %#lx,", hash());
    st->print("age %d)", age());
  }
}
Example #5
0
void space::prepare_for_compaction(OldWaterMark* mark) {
  // compute the new addresses for the live objects and update all
  // pointers to these objects.
  // Used by universe::mark_sweep_phase2()
  // %profiling note:
  //    the garbage collectior spends 55% of its time in this function
  oop* q          = bottom();
  oop* t          = top();
  oop* new_top    = mark->_point;
  memOop first_free = NULL;
  while (q < t) {
    memOop m = as_memOop(q);
    if (m->is_gc_marked()) {
      if (first_free) { 
	first_free->set_mark(q);
	// lprintf("[%#lx] = %#lx, %#lx\n", first_free, first_free->mark(), q);
        first_free = NULL;
      }

      // Reverse the list with the mark at the end
      oop* root_or_mark = (oop*) m->mark();
      while (is_oop_root(root_or_mark)) {
        oop* next = (oop*) *root_or_mark;
        *root_or_mark = (oop) as_memOop(new_top);
        root_or_mark = next;
      }
      m->set_mark(markOop(root_or_mark));

      int size = m->gc_retrieve_size(); // The mark has to be restored before 
                                        // the size is retrieved
      new_top += size;
      q       += size;
    } else {
      if (!first_free) {
	first_free = m;
	// lprintf("First free %#lx\n", q);
      }
      q += m->size();
    }
  }
  if (first_free) { 
    first_free->set_mark(q);
    // lprintf("[%#lx] = %#lx, %#lx\n", first_free, first_free->mark(), q);
  }
  mark->_point = new_top;
}
void BasicLock::move_to(oop obj, BasicLock* dest) {
  // Check to see if we need to inflate the lock. This is only needed
  // if an object is locked using "this" lightweight monitor. In that
  // case, the displaced_header() is unlocked, because the 
  // displaced_header() contains the header for the originally unlocked
  // object. However the object could has already been inflated. But it 
  // does not matter, the inflation will just a no-op. For other cases,
  // the displaced header will be either 0x0 or 0x3, which are location
  // independent, therefore the BasicLock is free to move.
  

  if (displaced_header()->is_unlocked()) {
    ObjectSynchronizer::inflate_helper(obj);
    // WARNING: We can not put check here, because the inflation
    // will not update the displaced header. Once BasicLock is inflated, 
    // no one should ever look at its content.
  } else {
    assert(displaced_header() == NULL || displaced_header() == markOop(markOopDesc::marked_value), "must be unlocked or a placeholder");
  }
// [RGV] The next line appears to do nothing!
  intptr_t dh = (intptr_t) displaced_header();
  dest->set_displaced_header(displaced_header());
}
Example #7
0
 operator markOop () const volatile  { return markOop(obj()); }