Skip to content

Commit 3f694b3

Browse files
committed
hotspot: Fix WhiteBox JNI method names mismatch with classlib 8
This patch should fix a number of UnsatisfiedLinkErrors in jdk8 hotspot test
1 parent c52078f commit 3f694b3

1 file changed

Lines changed: 45 additions & 2 deletions

File tree

src/hotspot/share/prims/whitebox.cpp

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2374,8 +2374,12 @@ WB_END
23742374
static JNINativeMethod methods[] = {
23752375
#if HOTSPOT_TARGET_CLASSLIB == 8
23762376
{CC"getObjectAddress", CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress },
2377+
{CC"getObjectSize", CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize },
2378+
{CC"isObjectInOldGen", CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen },
23772379
#elif HOTSPOT_TARGET_CLASSLIB == 17
23782380
{CC"getObjectAddress0", CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectAddress },
2381+
{CC"getObjectSize0", CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize },
2382+
{CC"isObjectInOldGen0", CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen },
23792383
#else
23802384
#error "Only classlib 8 and 17 are supported."
23812385
#endif
@@ -2443,6 +2447,16 @@ static JNINativeMethod methods[] = {
24432447
{CC"deoptimizeFrames", CC"(Z)I", (void*)&WB_DeoptimizeFrames },
24442448
{CC"isFrameDeoptimized", CC"(I)Z", (void*)&WB_IsFrameDeoptimized},
24452449
{CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll },
2450+
#if HOTSPOT_TARGET_CLASSLIB == 8
2451+
{CC"deoptimizeMethod", CC"(Ljava/lang/reflect/Executable;Z)I",
2452+
(void*)&WB_DeoptimizeMethod },
2453+
{CC"isMethodCompiled", CC"(Ljava/lang/reflect/Executable;Z)Z",
2454+
(void*)&WB_IsMethodCompiled },
2455+
{CC"isMethodCompilable", CC"(Ljava/lang/reflect/Executable;IZ)Z",
2456+
(void*)&WB_IsMethodCompilable},
2457+
{CC"isMethodQueuedForCompilation",
2458+
CC"(Ljava/lang/reflect/Executable;)Z", (void*)&WB_IsMethodQueuedForCompilation},
2459+
#elif HOTSPOT_TARGET_CLASSLIB == 17
24462460
{CC"deoptimizeMethod0", CC"(Ljava/lang/reflect/Executable;Z)I",
24472461
(void*)&WB_DeoptimizeMethod },
24482462
{CC"isMethodCompiled0", CC"(Ljava/lang/reflect/Executable;Z)Z",
@@ -2451,29 +2465,52 @@ static JNINativeMethod methods[] = {
24512465
(void*)&WB_IsMethodCompilable},
24522466
{CC"isMethodQueuedForCompilation0",
24532467
CC"(Ljava/lang/reflect/Executable;)Z", (void*)&WB_IsMethodQueuedForCompilation},
2468+
#else
2469+
#error "Only classlib 8 and 17 are supported."
2470+
#endif
24542471
{CC"isIntrinsicAvailable0",
24552472
CC"(Ljava/lang/reflect/Executable;Ljava/lang/reflect/Executable;I)Z",
24562473
(void*)&WB_IsIntrinsicAvailable},
24572474
{CC"makeMethodNotCompilable0",
24582475
CC"(Ljava/lang/reflect/Executable;IZ)V", (void*)&WB_MakeMethodNotCompilable},
2476+
#if HOTSPOT_TARGET_CLASSLIB == 8
2477+
{CC"testSetDontInlineMethod",
2478+
CC"(Ljava/lang/reflect/Executable;Z)Z", (void*)&WB_TestSetDontInlineMethod},
2479+
{CC"getMethodCompilationLevel",
2480+
CC"(Ljava/lang/reflect/Executable;Z)I", (void*)&WB_GetMethodCompilationLevel},
2481+
{CC"getMethodEntryBci",
2482+
CC"(Ljava/lang/reflect/Executable;)I", (void*)&WB_GetMethodEntryBci},
2483+
{CC"testSetForceInlineMethod",
2484+
CC"(Ljava/lang/reflect/Executable;Z)Z", (void*)&WB_TestSetForceInlineMethod},
2485+
#elif HOTSPOT_TARGET_CLASSLIB == 17
24592486
{CC"testSetDontInlineMethod0",
24602487
CC"(Ljava/lang/reflect/Executable;Z)Z", (void*)&WB_TestSetDontInlineMethod},
24612488
{CC"getMethodCompilationLevel0",
24622489
CC"(Ljava/lang/reflect/Executable;Z)I", (void*)&WB_GetMethodCompilationLevel},
24632490
{CC"getMethodEntryBci0",
24642491
CC"(Ljava/lang/reflect/Executable;)I", (void*)&WB_GetMethodEntryBci},
2465-
{CC"getCompileQueueSize",
2466-
CC"(I)I", (void*)&WB_GetCompileQueueSize},
24672492
{CC"testSetForceInlineMethod0",
24682493
CC"(Ljava/lang/reflect/Executable;Z)Z", (void*)&WB_TestSetForceInlineMethod},
2494+
#else
2495+
#error "Only classlib 8 and 17 are supported."
2496+
#endif
2497+
{CC"getCompileQueueSize",
2498+
CC"(I)I", (void*)&WB_GetCompileQueueSize},
24692499
{CC"enqueueMethodForCompilation0",
24702500
CC"(Ljava/lang/reflect/Executable;II)Z", (void*)&WB_EnqueueMethodForCompilation},
24712501
{CC"enqueueInitializerForCompilation0",
24722502
CC"(Ljava/lang/Class;I)Z", (void*)&WB_EnqueueInitializerForCompilation},
24732503
{CC"markMethodProfiled",
24742504
CC"(Ljava/lang/reflect/Executable;)V", (void*)&WB_MarkMethodProfiled},
2505+
#if HOTSPOT_TARGET_CLASSLIB == 8
2506+
{CC"clearMethodState",
2507+
CC"(Ljava/lang/reflect/Executable;)V", (void*)&WB_ClearMethodState},
2508+
#elif HOTSPOT_TARGET_CLASSLIB == 17
24752509
{CC"clearMethodState0",
24762510
CC"(Ljava/lang/reflect/Executable;)V", (void*)&WB_ClearMethodState},
2511+
#else
2512+
#error "Only classlib 8 and 17 are supported."
2513+
#endif
24772514
{CC"lockCompilation", CC"()V", (void*)&WB_LockCompilation},
24782515
{CC"unlockCompilation", CC"()V", (void*)&WB_UnlockCompilation},
24792516
{CC"matchesMethod",
@@ -2526,7 +2563,13 @@ static JNINativeMethod methods[] = {
25262563
{CC"metaspaceCapacityUntilGC", CC"()J", (void*)&WB_MetaspaceCapacityUntilGC },
25272564
{CC"metaspaceSharedRegionAlignment", CC"()J", (void*)&WB_MetaspaceSharedRegionAlignment },
25282565
{CC"getCPUFeatures", CC"()Ljava/lang/String;", (void*)&WB_GetCPUFeatures },
2566+
#if HOTSPOT_TARGET_CLASSLIB == 8
2567+
{CC"getNMethod", CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
2568+
#elif HOTSPOT_TARGET_CLASSLIB == 17
25292569
{CC"getNMethod0", CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
2570+
#else
2571+
#error "Only classlib 8 and 17 are supported."
2572+
#endif
25302573
(void*)&WB_GetNMethod },
25312574
{CC"forceNMethodSweep", CC"()V", (void*)&WB_ForceNMethodSweep },
25322575
{CC"allocateCodeBlob", CC"(II)J", (void*)&WB_AllocateCodeBlob },

0 commit comments

Comments
 (0)