3030
3131import org .graalvm .compiler .api .replacements .Snippet ;
3232import org .graalvm .compiler .api .replacements .Snippet .ConstantParameter ;
33- import org .graalvm .compiler .core .common .spi .ForeignCallDescriptor ;
3433import org .graalvm .compiler .graph .Node ;
3534import org .graalvm .compiler .nodes .FixedNode ;
3635import org .graalvm .compiler .nodes .FixedWithNextNode ;
3736import org .graalvm .compiler .nodes .Invoke ;
3837import org .graalvm .compiler .nodes .InvokeNode ;
3938import org .graalvm .compiler .nodes .InvokeWithExceptionNode ;
40- import org .graalvm .compiler .nodes .ValueNode ;
41- import org .graalvm .compiler .nodes .extended .ForeignCallNode ;
4239import org .graalvm .compiler .nodes .extended .MembarNode ;
4340import org .graalvm .compiler .nodes .spi .LoweringTool ;
4441import org .graalvm .compiler .options .OptionValues ;
5047import org .graalvm .compiler .replacements .Snippets ;
5148import org .graalvm .nativeimage .Platforms ;
5249import org .graalvm .nativeimage .c .struct .SizeOf ;
53- import org .graalvm .nativeimage .c .type .CIntPointer ;
5450import org .graalvm .nativeimage .impl .InternalPlatform ;
5551import org .graalvm .word .LocationIdentity ;
5652
6258import com .oracle .svm .core .graal .nodes .VerificationMarkerNode ;
6359import com .oracle .svm .core .graal .stackvalue .LoweredStackValueNode ;
6460import com .oracle .svm .core .graal .stackvalue .StackValueNode .StackSlotIdentity ;
65- import com .oracle .svm .core .nodes .CFunctionCaptureNode ;
6661import com .oracle .svm .core .nodes .CFunctionEpilogueNode ;
6762import com .oracle .svm .core .nodes .CFunctionPrologueDataNode ;
6863import com .oracle .svm .core .nodes .CFunctionPrologueNode ;
9893public final class CFunctionSnippets extends SubstrateTemplates implements Snippets {
9994
10095 private final SnippetInfo prologue ;
101- private final SnippetInfo capture ;
10296 private final SnippetInfo epilogue ;
10397
10498 /**
@@ -123,14 +117,6 @@ private static CPrologueData prologueSnippet(@ConstantParameter int newThreadSta
123117 return CFunctionPrologueDataNode .cFunctionPrologueData (anchor , newThreadStatus );
124118 }
125119
126- @ Node .NodeIntrinsic (value = ForeignCallNode .class )
127- public static native void callCaptureFunction (@ Node .ConstantNodeParameter ForeignCallDescriptor descriptor , int states , CIntPointer captureBuffer );
128-
129- @ Snippet
130- private static void captureSnippet (@ ConstantParameter ForeignCallDescriptor captureFunction , int statesToCapture , CIntPointer captureBuffer ) {
131- callCaptureFunction (captureFunction , statesToCapture , captureBuffer );
132- }
133-
134120 @ Snippet
135121 private static void epilogueSnippet (@ ConstantParameter int oldThreadStatus ) {
136122 if (SubstrateOptions .MultiThreaded .getValue ()) {
@@ -157,11 +143,9 @@ private static void epilogueSnippet(@ConstantParameter int oldThreadStatus) {
157143 super (options , providers );
158144
159145 this .prologue = snippet (providers , CFunctionSnippets .class , "prologueSnippet" );
160- this .capture = snippet (providers , CFunctionSnippets .class , "captureSnippet" );
161146 this .epilogue = snippet (providers , CFunctionSnippets .class , "epilogueSnippet" );
162147
163148 lowerings .put (CFunctionPrologueNode .class , new CFunctionPrologueLowering ());
164- lowerings .put (CFunctionCaptureNode .class , new CFunctionCaptureLowering ());
165149 lowerings .put (CFunctionEpilogueNode .class , new CFunctionEpilogueLowering ());
166150 }
167151
@@ -193,27 +177,6 @@ public void lower(CFunctionPrologueNode node, LoweringTool tool) {
193177 }
194178 }
195179
196- class CFunctionCaptureLowering implements NodeLoweringProvider <CFunctionCaptureNode > {
197- @ Override
198- public void lower (CFunctionCaptureNode node , LoweringTool tool ) {
199- if (tool .getLoweringStage () != LoweringTool .StandardLoweringStage .LOW_TIER ) {
200- return ;
201- }
202-
203- ValueNode statesToCapture = node .getStatesToCapture ();
204- ForeignCallDescriptor captureFunction = node .getCaptureFunction ();
205- ValueNode buffer = node .getCaptureBuffer ();
206- Arguments args = new Arguments (capture , node .graph ().getGuardsStage (), tool .getLoweringStage ());
207- args .addConst ("captureFunction" , captureFunction );
208- args .add ("statesToCapture" , statesToCapture );
209- args .add ("captureBuffer" , buffer );
210-
211- SnippetTemplate template = template (tool , node , args );
212- template .setMayRemoveLocation (true );
213- template .instantiate (tool .getMetaAccess (), node , SnippetTemplate .DEFAULT_REPLACER , args );
214- }
215- }
216-
217180 class CFunctionEpilogueLowering implements NodeLoweringProvider <CFunctionEpilogueNode > {
218181 @ Override
219182 public void lower (CFunctionEpilogueNode node , LoweringTool tool ) {
0 commit comments