Top


定義場所(file name)

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

名前(function name)

JNI_ENTRY(jint, jni_UnregisterNatives(JNIEnv *env, jclass clazz))

本体部(body)

  {- -------------------------------------------
  (1) (デバッグ用の処理)
      (See: JNIWrapper)
      ---------------------------------------- -}

      JNIWrapper("UnregisterNatives");

  {- -------------------------------------------
  (1) (DTrace のフック点)
      ---------------------------------------- -}

      DTRACE_PROBE2(hotspot_jni, UnregisterNatives__entry, env, clazz);

  {- -------------------------------------------
  (1) 引数で指定されたクラス内の全ての native method に対して, 
      methodOopDesc::clear_native_function() で登録を削除する.
      ---------------------------------------- -}

      klassOop k   = java_lang_Class::as_klassOop(JNIHandles::resolve_non_null(clazz));
      //%note jni_2
      if (Klass::cast(k)->oop_is_instance()) {
        for (int index = 0; index < instanceKlass::cast(k)->methods()->length(); index++) {
          methodOop m = methodOop(instanceKlass::cast(k)->methods()->obj_at(index));
          if (m->is_native()) {
            m->clear_native_function();
            m->set_signature_handler(NULL);
          }
        }
      }

  {- -------------------------------------------
  (1) (DTrace のフック点)
      ---------------------------------------- -}

      DTRACE_PROBE1(hotspot_jni, UnregisterNatives__return, 0);

  {- -------------------------------------------
  (1) リターン
      ---------------------------------------- -}

      return 0;
    JNI_END

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