4040import static jdk .graal .compiler .hotspot .HotSpotBackend .SHAREDRUNTIME_NOTIFY_JVMTI_VTHREAD_UNMOUNT ;
4141import static jdk .graal .compiler .hotspot .HotSpotBackend .UPDATE_BYTES_CRC32 ;
4242import static jdk .graal .compiler .hotspot .HotSpotBackend .UPDATE_BYTES_CRC32C ;
43+ import static jdk .graal .compiler .hotspot .replacements .HotSpotInvocationPluginHelper .HotSpotVMConfigField .HOTSPOT_CONTINUATION_ENTRY_PIN_COUNT ;
44+ import static jdk .graal .compiler .hotspot .replacements .HotSpotInvocationPluginHelper .HotSpotVMConfigField .HOTSPOT_JAVA_THREAD_CONT_ENTRY ;
4345import static jdk .graal .compiler .hotspot .replacements .HotSpotReplacementsUtil .HOTSPOT_CARRIER_THREAD_OOP_HANDLE_LOCATION ;
44- import static jdk .graal .compiler .hotspot .replacements .HotSpotReplacementsUtil .HOTSPOT_CONTINUATION_ENTRY_PIN_COUNT ;
46+ import static jdk .graal .compiler .hotspot .replacements .HotSpotReplacementsUtil .HOTSPOT_CONTINUATION_ENTRY_PIN_COUNT_LOCATION ;
4547import static jdk .graal .compiler .hotspot .replacements .HotSpotReplacementsUtil .HOTSPOT_CURRENT_THREAD_OOP_HANDLE_LOCATION ;
46- import static jdk .graal .compiler .hotspot .replacements .HotSpotReplacementsUtil .HOTSPOT_JAVA_THREAD_CONT_ENTRY ;
4748import static jdk .graal .compiler .hotspot .replacements .HotSpotReplacementsUtil .HOTSPOT_JAVA_THREAD_SCOPED_VALUE_CACHE_HANDLE_LOCATION ;
4849import static jdk .graal .compiler .hotspot .replacements .HotSpotReplacementsUtil .JAVA_THREAD_MONITOR_OWNER_ID_LOCATION ;
4950import static jdk .graal .compiler .java .BytecodeParserOptions .InlineDuringParsing ;
100101import jdk .graal .compiler .hotspot .word .HotSpotWordTypes ;
101102import jdk .graal .compiler .java .BytecodeParser ;
102103import jdk .graal .compiler .lir .SyncPort ;
104+ import jdk .graal .compiler .nodes .AbstractBeginNode ;
103105import jdk .graal .compiler .nodes .BeginNode ;
104106import jdk .graal .compiler .nodes .ComputeObjectAddressNode ;
105107import jdk .graal .compiler .nodes .ConstantNode ;
134136import jdk .graal .compiler .nodes .extended .MembarNode ;
135137import jdk .graal .compiler .nodes .extended .ObjectIsArrayNode ;
136138import jdk .graal .compiler .nodes .extended .PublishWritesNode ;
139+ import jdk .graal .compiler .nodes .extended .RawStoreNode ;
137140import jdk .graal .compiler .nodes .gc .BarrierSet ;
138141import jdk .graal .compiler .nodes .graphbuilderconf .ForeignCallPlugin ;
139142import jdk .graal .compiler .nodes .graphbuilderconf .GeneratedPluginFactory ;
@@ -748,7 +751,7 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
748751 }
749752 });
750753
751- r .registerConditional (config .threadScopedValueCacheOffset != -1 , new InvocationPlugin ("scopedValueCache" ) {
754+ r .registerConditional (config .javaThreadScopedValueCacheOffset != -1 , new InvocationPlugin ("scopedValueCache" ) {
752755 @ Override
753756 public boolean apply (GraphBuilderContext b , ResolvedJavaMethod targetMethod , Receiver receiver ) {
754757 try (HotSpotInvocationPluginHelper helper = new HotSpotInvocationPluginHelper (b , targetMethod , config )) {
@@ -762,7 +765,7 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
762765 }
763766 });
764767
765- r .registerConditional (config .threadScopedValueCacheOffset != -1 , new InvocationPlugin ("setScopedValueCache" , Object [].class ) {
768+ r .registerConditional (config .javaThreadScopedValueCacheOffset != -1 , new InvocationPlugin ("setScopedValueCache" , Object [].class ) {
766769 @ Override
767770 public boolean apply (GraphBuilderContext b , ResolvedJavaMethod targetMethod , Receiver receiver , ValueNode cache ) {
768771 try (HotSpotInvocationPluginHelper helper = new HotSpotInvocationPluginHelper (b , targetMethod , config )) {
@@ -808,8 +811,8 @@ private static void inlineNativeNotifyJvmtiFunctions(GraalHotSpotVMConfig config
808811
809812 // else set hide value to the VTMS transition bit in current JavaThread and
810813 // VirtualThread object
811- GraalError .guarantee (config .threadIsInVTMSTransitionOffset != -1L , "JavaThread::_is_in_VTMS_transition is not exported" );
812- OffsetAddressNode jtAddress = graph .addOrUniqueWithInputs (new OffsetAddressNode (javaThread , helper .asWord (config .threadIsInVTMSTransitionOffset )));
814+ GraalError .guarantee (config .javaThreadIsInVTMSTransitionOffset != -1L , "JavaThread::_is_in_VTMS_transition is not exported" );
815+ OffsetAddressNode jtAddress = graph .addOrUniqueWithInputs (new OffsetAddressNode (javaThread , helper .asWord (config .javaThreadIsInVTMSTransitionOffset )));
813816 JavaWriteNode jtWrite = b .add (new JavaWriteNode (JavaKind .Boolean , jtAddress , HotSpotReplacementsUtil .HOTSPOT_JAVA_THREAD_IS_IN_VTMS_TRANSITION , hide , BarrierType .NONE , false ));
814817 falseSuccessor .setNext (jtWrite );
815818
@@ -852,21 +855,17 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
852855 StructuredGraph graph = b .getGraph ();
853856 CurrentJavaThreadNode javaThread = graph .addOrUniqueWithInputs (new CurrentJavaThreadNode (helper .getWordKind ()));
854857
855- GraalError .guarantee (config .contEntry != -1 , "JavaThread::_cont_entry is not exported" );
856- OffsetAddressNode lastContinuationAddr = graph .addOrUniqueWithInputs (new OffsetAddressNode (javaThread , helper .asWord (config .contEntry )));
857- ValueNode lastContinuation = b .add (new JavaReadNode (JavaKind .Object , lastContinuationAddr , HOTSPOT_JAVA_THREAD_CONT_ENTRY , BarrierType .NONE , MemoryOrderMode .PLAIN , false ));
858- ValueNode nonNullLastContinuation = helper .emitNullReturnGuard (lastContinuation , null , NOT_FREQUENT_PROBABILITY );
858+ ValueNode lastContinuation = helper .readLocation (javaThread , HOTSPOT_JAVA_THREAD_CONT_ENTRY );
859+ AbstractBeginNode guard = helper .emitReturnIf (IntegerEqualsNode .create (lastContinuation , helper .asWord (0 ), NodeView .DEFAULT ), null , NOT_FREQUENT_PROBABILITY );
859860
860- GraalError .guarantee (config .pinCount != -1 , "ContinuationEntry::_pin_count is not exported" );
861- OffsetAddressNode pinCountAddr = graph .addOrUniqueWithInputs (new OffsetAddressNode (nonNullLastContinuation , helper .asWord (config .pinCount )));
862- ValueNode pinCount = b .add (new JavaReadNode (JavaKind .Int , pinCountAddr , HOTSPOT_CONTINUATION_ENTRY_PIN_COUNT , BarrierType .NONE , MemoryOrderMode .PLAIN , false ));
861+ ValueNode pinCount = helper .readLocation (lastContinuation , HOTSPOT_CONTINUATION_ENTRY_PIN_COUNT , guard );
863862
864863 LogicNode overFlow = IntegerEqualsNode .create (pinCount , pin ? ConstantNode .forInt (-1 ) : ConstantNode .forInt (0 ), NodeView .DEFAULT );
865864 // TypeCheckedInliningViolated (Reason_type_checked_inlining) is aliasing
866865 // Reason_intrinsic
867866 b .append (new FixedGuardNode (overFlow , TypeCheckedInliningViolated , DeoptimizationAction .None , true ));
868867 ValueNode newPinCount = b .add (AddNode .create (pinCount , pin ? ConstantNode .forInt (1 ) : ConstantNode .forInt (-1 ), NodeView .DEFAULT ));
869- b .add (new JavaWriteNode ( JavaKind . Int , pinCountAddr , HOTSPOT_CONTINUATION_ENTRY_PIN_COUNT , newPinCount , BarrierType . NONE , false ));
868+ b .add (new RawStoreNode ( lastContinuation , helper . asWord ( config . pinCountOffset ), newPinCount , JavaKind . Int , HOTSPOT_CONTINUATION_ENTRY_PIN_COUNT_LOCATION ));
870869 helper .emitFinalReturn (JavaKind .Void , null );
871870 }
872871 return true ;
@@ -934,9 +933,9 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
934933 receiver .get (true );
935934 // unconditionally update the temporary VTMS transition bit in current
936935 // JavaThread
937- GraalError .guarantee (config .threadIsInTmpVTMSTransitionOffset != -1 , "JavaThread::_is_in_tmp_VTMS_transition is not exported" );
936+ GraalError .guarantee (config .javaThreadIsInTmpVTMSTransitionOffset != -1 , "JavaThread::_is_in_tmp_VTMS_transition is not exported" );
938937 CurrentJavaThreadNode javaThread = b .add (new CurrentJavaThreadNode (helper .getWordKind ()));
939- OffsetAddressNode address = b .add (new OffsetAddressNode (javaThread , helper .asWord (config .threadIsInTmpVTMSTransitionOffset )));
938+ OffsetAddressNode address = b .add (new OffsetAddressNode (javaThread , helper .asWord (config .javaThreadIsInTmpVTMSTransitionOffset )));
940939 b .add (new JavaWriteNode (JavaKind .Boolean , address , HotSpotReplacementsUtil .HOTSPOT_JAVA_THREAD_IS_IN_TMP_VTMS_TRANSITION , hide , BarrierType .NONE , false ));
941940 }
942941 }
@@ -957,9 +956,9 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
957956 }
958957 // unconditionally update the is_disable_suspend bit in current
959958 // JavaThread
960- GraalError .guarantee (config .threadIsDisableSuspendOffset != -1 , "JavaThread::_is_disable_suspend is not exported" );
959+ GraalError .guarantee (config .javaThreadIsDisableSuspendOffset != -1 , "JavaThread::_is_disable_suspend is not exported" );
961960 CurrentJavaThreadNode javaThread = b .add (new CurrentJavaThreadNode (helper .getWordKind ()));
962- OffsetAddressNode address = b .add (new OffsetAddressNode (javaThread , helper .asWord (config .threadIsDisableSuspendOffset )));
961+ OffsetAddressNode address = b .add (new OffsetAddressNode (javaThread , helper .asWord (config .javaThreadIsDisableSuspendOffset )));
963962 b .add (new JavaWriteNode (JavaKind .Boolean , address , HotSpotReplacementsUtil .HOTSPOT_JAVA_THREAD_IS_DISABLE_SUSPEND , enter , BarrierType .NONE , false ));
964963 }
965964 }
0 commit comments