JVM启动过程的重要数据结构

JVM的数据初始化:

typedef struct {
    CreateJavaVM_t CreateJavaVM;
    GetDefaultJavaVMInitArgs_t GetDefaultJavaVMInitArgs;
} InvocationFunctions;

其数据的初始化是通过直接查找libjvm.so的方法地址


赋值信息

CreateJavaVM ------------>JNI_CreateJavaVm 负责JavaVM和JNIEnv的数据结构的初始化

GetDefaultJavaVMInitArgs--------------->JNI_GetDefaultJavaVMInitArgs


JavaVM:

typedef const struct JNIInvokeInterface_ *JavaVM;
struct JNIInvokeInterface_
{
  void *reserved0;
  void *reserved1;
  void *reserved2;

  jint (JNICALL *DestroyJavaVM)         (JavaVM *);
  jint (JNICALL *AttachCurrentThread)   (JavaVM *, void **, void *);
  jint (JNICALL *DetachCurrentThread)   (JavaVM *);
  jint (JNICALL *GetEnv)                (JavaVM *, void **, jint);
  jint (JNICALL *AttachCurrentThreadAsDaemon) (JavaVM *, void **, void *);
};

赋值信息为:

DestroyJavaVM-------------->jni_DestroyJavaVM

AttachCurrentThread-------->jni_AttachCurrentThread

DetachCurrentThread------->jni_DetachCurrentThread

GetEnv-------------------------->jni_GetEnv

AttachCurrentThreadAsDaemon---->jni_AttachCurrentThreadAsDaemon


JNIEnv:

typedef const struct JNINativeInterface_ *JNIEnv;

你可能感兴趣的:(JVM启动过程的重要数据结构)