7070import com .oracle .graal .python .nodes .function .builtins .PythonClinicBuiltinNode ;
7171import com .oracle .graal .python .nodes .function .builtins .PythonTernaryClinicBuiltinNode ;
7272import com .oracle .graal .python .nodes .function .builtins .PythonUnaryClinicBuiltinNode ;
73- import com .oracle .graal .python .nodes .function .builtins .clinic .ArgumentCastNode .ArgumentCastNodeWithRaiseAndIndirectCall ;
73+ import com .oracle .graal .python .nodes .function .builtins .clinic .ArgumentCastNode .ArgumentCastNodeWithRaise ;
7474import com .oracle .graal .python .nodes .function .builtins .clinic .ArgumentClinicProvider ;
7575import com .oracle .graal .python .nodes .util .CastToTruffleStringNode ;
76+ import com .oracle .graal .python .runtime .IndirectCallData ;
7677import com .oracle .graal .python .runtime .object .PythonObjectFactory ;
7778import com .oracle .graal .python .runtime .sequence .storage .ByteSequenceStorage ;
7879import com .oracle .truffle .api .CompilerDirectives .CompilationFinal ;
@@ -102,11 +103,12 @@ protected List<? extends NodeFactory<? extends PythonBuiltinBaseNode>> getNodeFa
102103 return BinasciiModuleBuiltinsFactory .getFactories ();
103104 }
104105
105- abstract static class AsciiBufferConverter extends ArgumentCastNodeWithRaiseAndIndirectCall {
106+ abstract static class AsciiBufferConverter extends ArgumentCastNodeWithRaise {
106107 @ Specialization (guards = "acquireLib.hasBuffer(value)" , limit = "getCallSiteInlineCacheMaxDepth()" )
107108 Object doObject (VirtualFrame frame , Object value ,
109+ @ Cached ("createFor(this)" ) IndirectCallData indirectCallData ,
108110 @ CachedLibrary ("value" ) PythonBufferAcquireLibrary acquireLib ) {
109- return acquireLib .acquireReadonly (value , frame , getContext (), getLanguage (), this );
111+ return acquireLib .acquireReadonly (value , frame , getContext (), getLanguage (), indirectCallData );
110112 }
111113
112114 @ ExportLibrary (PythonBufferAccessLibrary .class )
@@ -184,13 +186,14 @@ public static AsciiBufferConverter create() {
184186 abstract static class A2bBase64Node extends PythonUnaryClinicBuiltinNode {
185187 @ Specialization (limit = "3" )
186188 PBytes doConvert (VirtualFrame frame , Object buffer ,
189+ @ Cached ("createFor(this)" ) IndirectCallData indirectCallData ,
187190 @ CachedLibrary ("buffer" ) PythonBufferAccessLibrary bufferLib ,
188191 @ Cached PythonObjectFactory factory ) {
189192 try {
190193 ByteSequenceStorage storage = b64decode (bufferLib .getInternalOrCopiedByteArray (buffer ), bufferLib .getBufferLength (buffer ));
191194 return factory .createBytes (storage );
192195 } finally {
193- bufferLib .release (buffer , frame , this );
196+ bufferLib .release (buffer , frame , indirectCallData );
194197 }
195198 }
196199
@@ -259,13 +262,14 @@ protected ArgumentClinicProvider getArgumentClinic() {
259262 abstract static class A2bHexNode extends PythonUnaryClinicBuiltinNode {
260263 @ Specialization (limit = "3" )
261264 PBytes a2b (VirtualFrame frame , Object buffer ,
265+ @ Cached ("createFor(this)" ) IndirectCallData indirectCallData ,
262266 @ CachedLibrary ("buffer" ) PythonBufferAccessLibrary bufferLib ,
263267 @ Cached PythonObjectFactory factory ) {
264268 try {
265269 byte [] bytes = a2b (bufferLib .getInternalOrCopiedByteArray (buffer ), bufferLib .getBufferLength (buffer ));
266270 return factory .createBytes (bytes );
267271 } finally {
268- bufferLib .release (buffer , frame , this );
272+ bufferLib .release (buffer , frame , indirectCallData );
269273 }
270274 }
271275
@@ -322,12 +326,13 @@ private PBytes b2a(byte[] data, int lenght, int newline, PythonObjectFactory fac
322326
323327 @ Specialization (limit = "3" )
324328 PBytes b2aBuffer (VirtualFrame frame , Object buffer , int newline ,
329+ @ Cached ("createFor(this)" ) IndirectCallData indirectCallData ,
325330 @ CachedLibrary ("buffer" ) PythonBufferAccessLibrary bufferLib ,
326331 @ Cached PythonObjectFactory factory ) {
327332 try {
328333 return b2a (bufferLib .getInternalOrCopiedByteArray (buffer ), bufferLib .getBufferLength (buffer ), newline , factory );
329334 } finally {
330- bufferLib .release (buffer , frame , this );
335+ bufferLib .release (buffer , frame , indirectCallData );
331336 }
332337 }
333338
@@ -346,9 +351,9 @@ abstract static class B2aHexNode extends PythonTernaryClinicBuiltinNode {
346351 @ CompilationFinal (dimensions = 1 ) private static final byte [] HEX_DIGITS = {'0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , 'a' , 'b' , 'c' , 'd' , 'e' , 'f' };
347352
348353 @ Specialization (limit = "3" )
349- @ SuppressWarnings ("truffle-static-method" )
350- PBytes b2a (VirtualFrame frame , Object buffer , Object sep , int bytesPerSep ,
354+ static PBytes b2a (VirtualFrame frame , Object buffer , Object sep , int bytesPerSep ,
351355 @ Bind ("this" ) Node inliningTarget ,
356+ @ Cached ("createFor(this)" ) IndirectCallData indirectCallData ,
352357 @ CachedLibrary ("buffer" ) PythonBufferAccessLibrary bufferLib ,
353358 @ Cached PythonObjectFactory factory ,
354359 @ Cached PRaiseNode .Lazy raiseNode ) {
@@ -359,7 +364,7 @@ PBytes b2a(VirtualFrame frame, Object buffer, Object sep, int bytesPerSep,
359364 try {
360365 return b2a (bufferLib .getInternalOrCopiedByteArray (buffer ), bufferLib .getBufferLength (buffer ), factory );
361366 } finally {
362- bufferLib .release (buffer , frame , this );
367+ bufferLib .release (buffer , frame , indirectCallData );
363368 }
364369 }
365370
@@ -387,12 +392,13 @@ protected ArgumentClinicProvider getArgumentClinic() {
387392 abstract static class Crc32Node extends PythonBinaryClinicBuiltinNode {
388393
389394 @ Specialization (limit = "3" )
390- long b2a (VirtualFrame frame , Object buffer , long crc ,
395+ static long b2a (VirtualFrame frame , Object buffer , long crc ,
396+ @ Cached ("createFor(this)" ) IndirectCallData indirectCallData ,
391397 @ CachedLibrary ("buffer" ) PythonBufferAccessLibrary bufferLib ) {
392398 try {
393399 return crc32 ((int ) crc , bufferLib .getInternalOrCopiedByteArray (buffer ), 0 , bufferLib .getBufferLength (buffer ));
394400 } finally {
395- bufferLib .release (buffer , frame , this );
401+ bufferLib .release (buffer , frame , indirectCallData );
396402 }
397403 }
398404
0 commit comments