{"id":8757,"date":"2024-05-27T20:01:03","date_gmt":"2024-05-27T12:01:03","guid":{"rendered":""},"modified":"2024-05-27T20:01:03","modified_gmt":"2024-05-27T12:01:03","slug":"openjdk javac_openjdk platform binary","status":"publish","type":"post","link":"https:\/\/mushiming.com\/8757.html","title":{"rendered":"openjdk javac_openjdk platform binary"},"content":{"rendered":"

JNI\u6709\u4e24\u79cd\u57fa\u672c\u6570\u636e\u7c7b\u578b\u57fa\u672c\u6570\u636e\u7c7b\u578b\u548c\u5f15\u7528\u6570\u636e\u7c7b\u578b<\/strong><\/p>\n<\/p>\n

\u57fa\u672c\u6570\u636e\u7c7b\u578b<\/h3>\n

\"openjdk<\/p>\n<\/p>\n

\u5728jnt.h\u4e2d\u53ef\u4ee5\u627e\u5230<\/p>\n

\/\/\u5982\u679c\u6ca1\u5728jni_md.\u4e2d\u5b9a\u4e49\u597d\u7684\u8bdd\n#ifndef JNI_TYPES_ALREADY_DEFINED_IN_JNI_MD_H\n\/\/\u5c31\u4f7f\u7528\u4e0b\u9762\u7684\u5b9a\u4e49\ntypedef unsigned char   jboolean;\ntypedef unsigned short  jchar;\ntypedef short           jshort;\ntypedef float           jfloat;\ntypedef double          jdouble;\n\ntypedef jint            jsize;<\/code><\/pre>\n

\u627e\u5230jnt_md.h\u4e2d\u7684\u6570\u636e\u5b9a\u4e49<\/p>\n

\"openjdk<\/p>\n

 \u5728jnt_md.h\u4e2d\u627e\u5230\u5982\u4e0a\u5b9a\u4e49\uff0c\u6839\u636e\u73af\u5883\u9009\u62e9\u6570\u636e\u7c7b\u578b\uff0c\u6839\u636eX86\u67b6\u6784\u627e\u5230jni_x86.h\u6587\u4ef6<\/p>\n

#ifndef _JAVASOFT_JNI_MD_H_\n#define _JAVASOFT_JNI_MD_H_\n\n#if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE)\n\n\n\/\/ Note: please do not change these without also changing jni_md.h in the JDK\n\/\/ repository\n#ifndef __has_attribute\n  #define __has_attribute(x) 0\n#endif\n#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility)\n  #define JNIEXPORT     __attribute__((visibility(\"default\")))\n  #define JNIIMPORT     __attribute__((visibility(\"default\")))\n#else\n  #define JNIEXPORT\n  #define JNIIMPORT\n#endif\n\n  #define JNICALL\n  typedef int jint;   \n#if defined(_LP64)\n  typedef long jlong;\n#else\n  typedef long long jlong;\n#endif\n\n#else\n  #define JNIEXPORT __declspec(dllexport)\n  #define JNIIMPORT __declspec(dllimport)\n  #define JNICALL __stdcall\n\n  typedef int jint;\n  typedef __int64 jlong;\n#endif\n\ntypedef signed char jbyte;\n\n#endif \/* !_JAVASOFT_JNI_MD_H_ *\/<\/code><\/pre>\n<\/p>\n

\u5f15\u7528\u6570\u636e\u7c7b\u578b<\/h3>\n

\"openjdk<\/p>\n<\/p>\n

\u65b9\u6cd5\u7b7e\u540d\u65f6\u7528\u5230\u7684\u516c\u5171\u4f53\u7c7b\u578b<\/h3>\n
typedef union jvalue {\n    jboolean z;\n    jbyte    b;\n    jchar    c;\n    jshort   s;\n    jint     i;\n    jlong    j;\n    jfloat   f;\n    jdouble  d;\n    jobject  l;\n} jvalue;<\/code><\/pre>\n<\/p>\n

\u5c5e\u6027ID\u548c\u65b9\u6cd5ID\u7684\u5b9a\u4e49<\/h3>\n
struct _jfieldID;\ntypedef struct _jfieldID *jfieldID;\n\nstruct _jmethodID;\ntypedef struct _jmethodID *jmethodID;<\/code><\/pre>\n<\/p>\n

\u56db\u79cd\u4e0d\u540c\u5f15\u7528\u7c7b\u578b\u7684\u5b9a\u4e49<\/h3>\n
\/* Return values from jobjectRefType *\/\ntypedef enum _jobjectType {\n     JNIInvalidRefType    = 0,\n     JNILocalRefType      = 1,\n     JNIGlobalRefType     = 2,\n     JNIWeakGlobalRefType = 3\n} jobjectRefType;<\/code><\/pre>\n

\u5206\u522b\u4e3aJNIInvalidRefType(\u65e0\u6548\u5f15\u7528)\u3001JNILocalRefType(\u672c\u5730\u5f15\u7528)\u3001JNIWeakGlobalRefType(\u5f31\u5168\u5c40\u5f15\u7528)\u548cJNIGlobalRefType(\u5168\u5c40\u5f15\u7528)\u7684\u679a\u4e3e\u7c7b\u578b<\/p>\n<\/p>\n

JNI\u9519\u8bef\u7c7b\u578b\u7684\u5b9a\u4e49<\/h3>\n
\/*\n * jboolean constants\n *\/\n\n#define JNI_FALSE 0\n#define JNI_TRUE 1\n\n\/*\n * possible return values for JNI functions.\n *\/\n\n#define JNI_OK           0                 \/* success *\/\n#define JNI_ERR          (-1)              \/* unknown error *\/\n#define JNI_EDETACHED    (-2)              \/* thread detached from the VM *\/\n#define JNI_EVERSION     (-3)              \/* JNI version error *\/\n#define JNI_ENOMEM       (-4)              \/* not enough memory *\/\n#define JNI_EEXIST       (-5)              \/* VM already created *\/\n#define JNI_EINVAL       (-6)              \/* invalid arguments *\/\n\n\/*\n * used in ReleaseScalarArrayElements\n *\/\n\n#define JNI_COMMIT 1\n#define JNI_ABORT 2<\/code><\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"openjdk javac_openjdk platform binaryJava\u4e2d\u7684JNI\u6570\u636e\u7c7b\u578b\u672c\u8d28\u662f\u5728Hotspot\u4e2d\u7684\u5177\u4f53\u8868\u793a\u6216\u8005\u5bf9\u5e94\u7684C\/C++\u7c7b\u578b\u5728jnt.h\u4e2d\u53ef\u4ee5\u627e...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8757"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=8757"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8757\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=8757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=8757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=8757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}