Beispiel #1
0
void symbolTable::add(symbolOop s) {
  assert(s->is_symbol(),
         "adding something that's not a symbol to the symbol table");
  assert(s->is_old(), "all symbols should be tenured");
  int hashValue = hash((char*) s->bytes(), s->length());
  basic_add(s, hashValue);
}
Beispiel #2
0
symbolOop symbolTable::basic_add(symbolOop s, int hashValue) {
  assert(s->is_symbol(),
         "adding something that's not a symbol to the symbol table");
  assert(s->is_old(), "all symbols should be tenured");

  // Add the indentity hash for the new symbol
  s->hash_value();
  assert(!s->mark()->has_valid_hash(), "should not have a hash yet");
  s->set_mark(s->mark()->set_hash(s->hash_value()));
  assert(s->mark()->has_valid_hash(), "should have a hash now");

  symbolTableEntry* bucket = bucketFor(hashValue);

  if (bucket->is_empty()) {
    bucket->set_symbol(s);
  } else {
    symbolTableLink*  old_link;
    if (bucket->is_symbol()) {
      old_link = Universe::symbol_table->new_link(bucket->get_symbol());
    } else {
      old_link = bucket->get_link();
    }
    bucket->set_link(Universe::symbol_table->new_link(s, old_link));
  }
  return s;
}
Beispiel #3
0
void callBack::initialize(oop receiver, symbolOop selector) {
    assert(selector->is_symbol(), "must be symbol");
    Universe::set_callBack(receiver, selector);
}