コード例 #1
0
ファイル: pcDesc.cpp プロジェクト: 4T-Shirt/OpenJDK-Research
void PcDesc::print(nmethod* code) {
#ifndef PRODUCT
  ResourceMark rm;
  tty->print_cr("PcDesc(pc=0x%lx offset=%x bits=%x):", real_pc(code), pc_offset(), _flags);

  if (scope_decode_offset() == DebugInformationRecorder::serialized_null) {
    return;
  }

  for (ScopeDesc* sd = code->scope_desc_at(real_pc(code));
       sd != NULL;
       sd = sd->sender()) {
    tty->print("  ");
    sd->method()->print_short_name(tty);
    tty->print("  @%d", sd->bci());
    if (sd->should_reexecute())
      tty->print("  reexecute=true");
    tty->cr();
  }
#endif
}
コード例 #2
0
// create a C-heap allocated address location map for an nmethod
void JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nmethod *nm,
        jvmtiAddrLocationMap** map_ptr,
        jint *map_length_ptr)
{
    ResourceMark rm;
    jvmtiAddrLocationMap* map = NULL;
    jint map_length = 0;


    // Generate line numbers using PcDesc and ScopeDesc info
    methodHandle mh(nm->method());

    if (!mh->is_native()) {
        PcDesc *pcd;
        int pcds_in_method;

        pcds_in_method = (nm->scopes_pcs_end() - nm->scopes_pcs_begin());
        map = NEW_C_HEAP_ARRAY(jvmtiAddrLocationMap, pcds_in_method, mtInternal);

        address scopes_data = nm->scopes_data_begin();
        for( pcd = nm->scopes_pcs_begin(); pcd < nm->scopes_pcs_end(); ++pcd ) {
            ScopeDesc sc0(nm, pcd->scope_decode_offset(), pcd->should_reexecute(), pcd->return_oop());
            ScopeDesc *sd  = &sc0;
            while( !sd->is_top() ) {
                sd = sd->sender();
            }
            int bci = sd->bci();
            if (bci != InvocationEntryBci) {
                assert(map_length < pcds_in_method, "checking");
                map[map_length].start_address = (const void*)pcd->real_pc(nm);
                map[map_length].location = bci;
                ++map_length;
            }
        }
    }

    *map_ptr = map;
    *map_length_ptr = map_length;
}