< prev index next >

src/java.base/share/native/libjava/Thread.c

Print this page

30 
31 #define THD "Ljava/lang/Thread;"
32 #define OBJ "Ljava/lang/Object;"
33 #define STE "Ljava/lang/StackTraceElement;"
34 #define STR "Ljava/lang/String;"
35 
36 #define ARRAY_LENGTH(a) (sizeof(a)/sizeof(a[0]))
37 
38 static JNINativeMethod methods[] = {
39     {"start0",           "()V",        (void *)&JVM_StartThread},
40     {"setPriority0",     "(I)V",       (void *)&JVM_SetThreadPriority},
41     {"yield0",           "()V",        (void *)&JVM_Yield},
42     {"sleepNanos0",      "(J)V",       (void *)&JVM_SleepNanos},
43     {"currentCarrierThread", "()" THD, (void *)&JVM_CurrentCarrierThread},
44     {"currentThread",    "()" THD,     (void *)&JVM_CurrentThread},
45     {"setCurrentThread", "(" THD ")V", (void *)&JVM_SetCurrentThread},
46     {"interrupt0",       "()V",        (void *)&JVM_Interrupt},
47     {"holdsLock",        "(" OBJ ")Z", (void *)&JVM_HoldsLock},
48     {"getThreads",       "()[" THD,    (void *)&JVM_GetAllThreads},
49     {"dumpThreads",      "([" THD ")[[" STE, (void *)&JVM_DumpThreads},
50     {"getStackTrace0",   "()" OBJ,     (void *)&JVM_GetStackTrace},
51     {"setNativeName",    "(" STR ")V", (void *)&JVM_SetNativeThreadName},
52     {"scopedValueCache", "()[" OBJ,    (void *)&JVM_ScopedValueCache},
53     {"setScopedValueCache", "([" OBJ ")V",(void *)&JVM_SetScopedValueCache},
54     {"getNextThreadIdOffset", "()J",   (void *)&JVM_GetNextThreadIdOffset},
55     {"findScopedValueBindings", "()" OBJ, (void *)&JVM_FindScopedValueBindings},
56     {"ensureMaterializedForStackWalk",
57                          "(" OBJ ")V", (void*)&JVM_EnsureMaterializedForStackWalk_func},
58 };
59 
60 #undef THD
61 #undef OBJ
62 #undef STE
63 #undef STR
64 
65 JNIEXPORT void JNICALL
66 Java_java_lang_Thread_registerNatives(JNIEnv *env, jclass cls)
67 {
68     (*env)->RegisterNatives(env, cls, methods, ARRAY_LENGTH(methods));
69 }
70 

30 
31 #define THD "Ljava/lang/Thread;"
32 #define OBJ "Ljava/lang/Object;"
33 #define STE "Ljava/lang/StackTraceElement;"
34 #define STR "Ljava/lang/String;"
35 
36 #define ARRAY_LENGTH(a) (sizeof(a)/sizeof(a[0]))
37 
38 static JNINativeMethod methods[] = {
39     {"start0",           "()V",        (void *)&JVM_StartThread},
40     {"setPriority0",     "(I)V",       (void *)&JVM_SetThreadPriority},
41     {"yield0",           "()V",        (void *)&JVM_Yield},
42     {"sleepNanos0",      "(J)V",       (void *)&JVM_SleepNanos},
43     {"currentCarrierThread", "()" THD, (void *)&JVM_CurrentCarrierThread},
44     {"currentThread",    "()" THD,     (void *)&JVM_CurrentThread},
45     {"setCurrentThread", "(" THD ")V", (void *)&JVM_SetCurrentThread},
46     {"interrupt0",       "()V",        (void *)&JVM_Interrupt},
47     {"holdsLock",        "(" OBJ ")Z", (void *)&JVM_HoldsLock},
48     {"getThreads",       "()[" THD,    (void *)&JVM_GetAllThreads},
49     {"dumpThreads",      "([" THD ")[[" STE, (void *)&JVM_DumpThreads},

50     {"setNativeName",    "(" STR ")V", (void *)&JVM_SetNativeThreadName},
51     {"scopedValueCache", "()[" OBJ,    (void *)&JVM_ScopedValueCache},
52     {"setScopedValueCache", "([" OBJ ")V",(void *)&JVM_SetScopedValueCache},
53     {"getNextThreadIdOffset", "()J",   (void *)&JVM_GetNextThreadIdOffset},
54     {"findScopedValueBindings", "()" OBJ, (void *)&JVM_FindScopedValueBindings},
55     {"ensureMaterializedForStackWalk",
56                          "(" OBJ ")V", (void*)&JVM_EnsureMaterializedForStackWalk_func},
57 };
58 
59 #undef THD
60 #undef OBJ
61 #undef STE
62 #undef STR
63 
64 JNIEXPORT void JNICALL
65 Java_java_lang_Thread_registerNatives(JNIEnv *env, jclass cls)
66 {
67     (*env)->RegisterNatives(env, cls, methods, ARRAY_LENGTH(methods));
68 }
69 
< prev index next >