Top


定義場所(file name)

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

説明(description)

// k_mirror - may be primitive, this must be checked
// constant_pool_count_ptr - pre-checked for NULL
// constant_pool_byte_count_ptr - pre-checked for NULL
// constant_pool_bytes_ptr - pre-checked for NULL

名前(function name)

jvmtiError
JvmtiEnv::GetConstantPool(oop k_mirror, jint* constant_pool_count_ptr, jint* constant_pool_byte_count_ptr, unsigned char** constant_pool_bytes_ptr) {

本体部(body)

  {- -------------------------------------------
  (1) 
      ---------------------------------------- -}

      if (java_lang_Class::is_primitive(k_mirror)) {
        return JVMTI_ERROR_ABSENT_INFORMATION;
      }

  {- -------------------------------------------
  (1) (変数宣言など)
      ---------------------------------------- -}

      klassOop k_oop = java_lang_Class::as_klassOop(k_mirror);
      Thread *thread = Thread::current();
      HandleMark hm(thread);
      ResourceMark rm(thread);
      KlassHandle klass(thread, k_oop);

  {- -------------------------------------------
  (1) 
      ---------------------------------------- -}

      jint status = klass->jvmti_class_status();
      if (status & (JVMTI_CLASS_STATUS_ERROR)) {
        return JVMTI_ERROR_INVALID_CLASS;
      }
      if (status & (JVMTI_CLASS_STATUS_ARRAY)) {
        return JVMTI_ERROR_ABSENT_INFORMATION;
      }

  {- -------------------------------------------
  (1) (変数宣言など)
      ---------------------------------------- -}

      instanceKlassHandle ikh(thread, k_oop);
      constantPoolHandle  constants(thread, ikh->constants());
      ObjectLocker ol(constants, thread);    // lock constant pool while we query it

  {- -------------------------------------------
  (1) JvmtiConstantPoolReconstituter オブジェクトを生成する.
      (失敗したらエラーでリターン)
      ---------------------------------------- -}

      JvmtiConstantPoolReconstituter reconstituter(ikh);
      if (reconstituter.get_error() != JVMTI_ERROR_NONE) {
        return reconstituter.get_error();
      }

  {- -------------------------------------------
  (1) Constant Pool 領域の大きさを取得し, 領域を allocate する.
      (それぞれ失敗したらエラーをリターンする)
      ---------------------------------------- -}

      unsigned char *cpool_bytes;
      int cpool_size = reconstituter.cpool_size();
      if (reconstituter.get_error() != JVMTI_ERROR_NONE) {
        return reconstituter.get_error();
      }
      jvmtiError res = allocate(cpool_size, &cpool_bytes);
      if (res != JVMTI_ERROR_NONE) {
        return res;
      }

  {- -------------------------------------------
  (1) 確保した領域に Constant Pool の情報を書き込む.
      ---------------------------------------- -}

      reconstituter.copy_cpool_bytes(cpool_bytes);
      if (reconstituter.get_error() != JVMTI_ERROR_NONE) {
        return reconstituter.get_error();
      }

  {- -------------------------------------------
  (1) その他の引数についても値を設定し, リターン.
      ---------------------------------------- -}

      *constant_pool_count_ptr      = constants->length();
      *constant_pool_byte_count_ptr = cpool_size;
      *constant_pool_bytes_ptr      = cpool_bytes;

      return JVMTI_ERROR_NONE;
    } /* end GetConstantPool */

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