Top


定義場所(file name)

hotspot/src/share/vm/prims/jvmtiCodeBlobEvents.cpp

説明(description)

// create a C-heap allocated address location map for an nmethod

名前(function name)

void JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nmethod *nm,
                                                        jvmtiAddrLocationMap** map_ptr,
                                                        jint *map_length_ptr)
{

本体部(body)

  {- -------------------------------------------
  (1) (変数宣言など)
      (map と map_length が, 結果として返される値を格納する変数)
      ---------------------------------------- -}

      ResourceMark rm;
      jvmtiAddrLocationMap* map = NULL;
      jint map_length = 0;


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

  {- -------------------------------------------
  (1) (処理対象の nmethod がネイティブメソッドの場合は処理は行わない.
       結果(map と map_length)は NULL 及び 0 のままとする.)
      ---------------------------------------- -}

      if (!mh->is_native()) {

  {- -------------------------------------------
  (1) nmethod 中の全ての PcDesc を辿り, ...#TODO
      ---------------------------------------- -}

        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);

        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;
          }
        }
      }

  {- -------------------------------------------
  (1) 結果を map_ptr 引数および map_length_ptr 引数で指定された箇所にセットする.
      ---------------------------------------- -}

      *map_ptr = map;
      *map_length_ptr = map_length;
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.