Esempio n. 1
0
void InterpretedIC_Iterator::advance() {
  assert(!at_end(), "iterated over the end");
  _index++;
  if (! at_end()) {
    if (_pic != NULL) {
      // polymorphic inline cache
      int index = _index + 1; 	// array is 1-origin
      set_klass (_pic->obj_at(2 * index));
      set_method(_pic->obj_at(2 * index - 1));
    } else {
      // predicted send with non_empty inline cache
      assert(_index < 2, "illegal index");
      set_klass(_ic->second_word());
      set_method(_ic->first_word());
    }
  }
}
Esempio n. 2
0
  bool InlineCache::update_and_validate(STATE, CallFrame* call_frame, Object* recv) {
    if(valid_p(state, recv)) return true;

    set_klass(recv->lookup_begin(state));

    MethodMissingReason reason = fill_public(state, call_frame->self(), name);
    if(reason != eNone) return false;

    update_seen_classes();
    run_wb(state, call_frame->cm);

    return true;
  }
Esempio n. 3
0
  bool InlineCache::update_and_validate_private(STATE, CallFrame* call_frame, Object* recv) {
    if(valid_p(state, recv)) return true;

    set_klass(recv->lookup_begin(state));

    if(!fill_private(state, name, klass())) {
      return false;
    }

    update_seen_classes();
    run_wb(state, call_frame->cm);

    return true;
  }
Esempio n. 4
0
void InterpretedIC_Iterator::init_iteration() {
  _pic = NULL;
  _index = 0;
  // determine initial state
  switch (_ic->send_type()) {
    case Bytecodes::interpreted_send:
      if (_ic->is_empty()) {
        // anamorphic call site (has never been executed => no type information)
        _number_of_targets = 0;
        _info = anamorphic;
      } else {
        // monomorphic call site
        _number_of_targets = 1;
        _info = monomorphic;
        set_klass(_ic->second_word());
        set_method(_ic->first_word());
      }
      break;
    case Bytecodes::compiled_send   :
      _number_of_targets = 1;
      _info = monomorphic;
      set_klass(_ic->second_word());
      assert(_ic->first_word()->is_smi(), "must have jumpTableEntry");
      set_method(_ic->first_word());
      assert(is_compiled(), "bad type");
      break;
    case Bytecodes::accessor_send   : // fall through
    case Bytecodes::primitive_send  :
      _number_of_targets = 1;
      _info = monomorphic;
      set_klass(_ic->second_word());
      set_method(_ic->first_word());
      assert(is_interpreted(), "bad type");
      break;
    case Bytecodes::megamorphic_send:
      // no type information stored
      _number_of_targets = 0;
      _info = megamorphic;
      break;
    case Bytecodes::polymorphic_send:
      // information on many types
      _pic = objArrayOop(_ic->second_word());
      _number_of_targets = _pic->length() / 2;
      _info = polymorphic;
      set_klass(_pic->obj_at(2));
      set_method(_pic->obj_at(1));
      break;
    case Bytecodes::predicted_send:
      if (_ic->is_empty() || _ic->second_word() == smiKlassObj) {
        _number_of_targets = 1;
        _info = monomorphic;
      } else {
        _number_of_targets = 2;
        _info = polymorphic;
      }
      set_klass(smiKlassObj);
      set_method(interpreter_normal_lookup(smiKlassObj, selector()).value());
      assert(_method != NULL && _method->is_mem(), "this method must be there");
      break;
    default: ShouldNotReachHere();
  }
  assert((number_of_targets() > 1) == (_info == polymorphic), "inconsistency");
}