void CodeBlobCollector::collect() {   
  assert_locked_or_safepoint(CodeCache_lock);
  assert(_global_code_blobs == NULL, "checking");

  // create the global list
  _global_code_blobs = new (ResourceObj::C_HEAP) GrowableArray<JvmtiCodeBlobDesc*>(50,true);

  // iterate over the stub code descriptors and put them in the list first.
  int index = 0;
  StubCodeDesc* desc;
  while ((desc = StubCodeDesc::desc_for_index(++index)) != NULL) {   
    _global_code_blobs->append(new JvmtiCodeBlobDesc(desc->name(), desc->begin(), desc->end()));
  }

  // next iterate over all the non-nmethod code blobs and add them to
  // the list - as noted above this will filter out duplicates and
  // enclosing blobs.
  Unimplemented();
  //CodeCache::blobs_do(do_blob);

  // make the global list the instance list so that it can be used
  // for other iterations.
  _code_blobs = _global_code_blobs;
  _global_code_blobs = NULL;
}  
예제 #2
0
void CodeBlobCollector::collect() {
  assert_locked_or_safepoint(CodeCache_lock);
  assert(_global_code_blobs == NULL, "checking");

  // create the global list
  _global_code_blobs = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<JvmtiCodeBlobDesc*>(50,true);

  // iterate over the stub code descriptors and put them in the list first.
  for (StubCodeDesc* desc = StubCodeDesc::first(); desc != NULL; desc = StubCodeDesc::next(desc)) {
    _global_code_blobs->append(new JvmtiCodeBlobDesc(desc->name(), desc->begin(), desc->end()));
  }

  // Vtable stubs are not described with StubCodeDesc,
  // process them separately
  VtableStubs::vtable_stub_do(do_vtable_stub);

  // next iterate over all the non-nmethod code blobs and add them to
  // the list - as noted above this will filter out duplicates and
  // enclosing blobs.
  CodeCache::blobs_do(do_blob);

  // make the global list the instance list so that it can be used
  // for other iterations.
  _code_blobs = _global_code_blobs;
  _global_code_blobs = NULL;
}
void i486_env::print_label(intptr_t value) {
  address adr = (address) value;
  if (StubRoutines::contains(adr)) {
    StubCodeDesc* desc = StubCodeDesc::desc_for(adr);
    const char * desc_name = "unknown stub";
    if (desc != NULL) {
      desc_name = desc->name();
    }
    output->print("Stub::%s", desc_name);
    if (WizardMode) output->print(" " INTPTR_FORMAT, value);
  } else {
    output->print(INTPTR_FORMAT, value); 
  }
}
void sparc_env::print_address(address adr, outputStream* st) {
  if (StubRoutines::contains(adr)) {
    StubCodeDesc *desc = StubCodeDesc::desc_for(adr);
    if (desc == NULL)
      desc = StubCodeDesc::desc_for(adr + frame::pc_return_offset);
    if (desc == NULL)
      st->print("Unknown stub at " INTPTR_FORMAT, adr);
    else {
      st->print("Stub::%s", desc->name());
      if (desc->begin() != adr)
	st->print("%+d 0x%p",adr - desc->begin(), adr);
      else if (WizardMode) st->print(" " INTPTR_FORMAT, adr);
    }
  } else {
    BarrierSet* bs = Universe::heap()->barrier_set();
    if (bs->kind() == BarrierSet::CardTableModRef &&
	adr == (address)((CardTableModRefBS*)(bs))->byte_map_base) {
      st->print("word_map_base");
      if (WizardMode) st->print(" " INTPTR_FORMAT, (intptr_t)adr);
    } else {
      st->print(INTPTR_FORMAT, (intptr_t)adr); 
    }
  }
}
// --- oops_arguments_do -----------------------------------------------------
// oops-do just for arguments when args are passed but the caller is
// not yet claiming responsibility for them (e.g., mid-call resolution).
void CodeBlob::oops_arguments_do(frame fr, OopClosure* f) const {

  // Native calls have all their args handlized.
  if( _type == native ) return;

  // C1 and C2 can call directly into the C++ runtime without a stub but these
  // calls all do not need their arguments GC'd (i.e., by the time a GC point
  // is reached all arguments get handlized).
  if( _type == c1 || _type == c2 ) return;

  guarantee( _type == runtime_stubs, "we only get here for runtime stubs" );

  StubCodeDesc *stub = StubCodeDesc::desc_for(fr.pc());
  Runtime1::StubID id = Runtime1::contains(fr.pc());
  // In a resolve_and_patch_call stub, we have to parse the outgoing signature
  // to find any argument oops.  The call site itself doesn't cover the
  // outgoing oops, and there is no target method yet.
  if( fr.pc() == CodeCache::_caller_must_gc_args_0 ||
      fr.pc() == CodeCache::_caller_must_gc_args_1 ) {
    assert0( (stub && !strcmp(stub->name(), "resolve_and_patch_handler")) ||
             id == Runtime1::frequency_counter_overflow_wrapper_id);
    oops_arguments_do_impl(fr,f);
    return;
  }

  // Assert sanity for stub-generator stubs
  if( stub ) {
    if( !strcmp(stub->name(), "sba_escape_handler") ) return; // no unhandled args from a failed STA/SVB
    if( !strcmp(stub->name(), "new_handler") ) return; // no unhandled args from a new allocation request
    // If we are at an inline-cache we need to construct an official j.l.NPE
    // object.  However, no oops are in callee-save registers and the caller's
    // args are dead because the call isn't happening.  (If we are not at an
    // inline-cache then we just reset the PC to the proper handler and do not
    // do any object construction).
    if( !strcmp(stub->name(), "handler_for_null_ptr_exception") ) return;
    // If we are throwing, then the callers args are long long gone.
    if( !strcmp(stub->name(), "forward_exception") ) return;
    // For safepoints, we generously allow any register to hold oops.
    if( !strcmp(stub->name(), "safepoint_handler") ) return;
    // The args for a blocking lock will be handlerized in the VM
    if( !strcmp(stub->name(), "blocking_lock_stub") ) return;
    // The args for registering a finalized object will be handlerized in the VM
    if( !strcmp(stub->name(), "register_finalizer") ) return;
    // The args for a blocking lock will be handlerized in the VM
    // There are no args saved in registers across an uncommon trap
    if( !strcmp(stub->name(), "deoptimize") ) return;
    if( !strcmp(stub->name(), "uncommon_trap") ) return;
    ShouldNotReachHere();
  }

  // Not a StubGenerator stub; check for sane C1 stubs
  if (id != -1) {
    switch(id) {
    case Runtime1::access_field_patching_id:        return;
    case Runtime1::load_klass_patching_id:          return;
    case Runtime1::monitorenter_id:                 return;
    case Runtime1::new_array_id:                    return;
    case Runtime1::new_instance_id:                 return;
    case Runtime1::new_multi_array_id:              return;
    case Runtime1::register_finalizer_id:           return;
    case Runtime1::throw_array_store_exception_id:  return;
    case Runtime1::throw_class_cast_exception_id:   return;
    case Runtime1::throw_div0_exception_id:         return;
    case Runtime1::throw_index_exception_id:        return;
    case Runtime1::throw_null_pointer_exception_id: return;
    case Runtime1::throw_range_check_failed_id:     return;
    default: tty->print_cr("Unimplemented Runtime1 stub ID %s (%d)", Runtime1::name_for(id), id); Unimplemented();
    }
  }

  // Probably most other stubs are simple returns, but a few need special handling.
  ShouldNotReachHere();
}
예제 #6
0
const char* StubCodeDesc::name_for(address pc) {
  StubCodeDesc* p = desc_for(pc);
  return p == NULL ? NULL : p->name();
}