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

来源:互联网 发布:qq加速升级软件 编辑:程序博客网 时间:2024/05/17 00:18

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;

0 0
原创粉丝点击