Exemple #1
0
CFStringRef AoEProperties::get_targets_config_string(int nTargetNumber)
{
	int n, nNum;
	
	// Iterate over the list of targets, checking which one is the target number we are looking for
	nNum = number_of_targets();
	for(n=0; n<nNum; n++)
		if ( nTargetNumber==get_target_number(n) )
			return get_config_string(n);

	return NULL;
}
void IC::print() {
  char* s;
  switch (shape()) {
    case anamorphic : s = "Anamorphic";  break;
    case monomorphic: s = "Monomorphic"; break;
    case polymorphic: s = "Polymorphic"; break;
    case megamorphic: s = "Megamorphic"; break;
    default         : ShouldNotReachHere();
  }
  std->print("%s IC: %d entries\n", s, number_of_targets());

  IC_Iterator* it = iterator();
  it->init_iteration();
  while (!it->at_end()) {
    lprintf("\t- klass: ");
    it->klass()->print_value();
    if (it->is_interpreted()) {
      lprintf(";\tmethod  %#x\n", it->interpreted_method());
    } else {
      lprintf(";\tnmethod %#x\n", it->compiled_method());
    }
    it->advance();
  }
}
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");
}