52
52
import com .oracle .graal .python .runtime .PythonOptions ;
53
53
import com .oracle .truffle .api .Assumption ;
54
54
import com .oracle .truffle .api .CompilerAsserts ;
55
- import com .oracle .truffle .api .dsl .Bind ;
56
55
import com .oracle .truffle .api .dsl .Cached ;
57
56
import com .oracle .truffle .api .dsl .Cached .Exclusive ;
58
57
import com .oracle .truffle .api .dsl .Cached .Shared ;
@@ -220,29 +219,19 @@ public void toNative(
220
219
221
220
@ ExportMessage
222
221
public boolean isPointer (
223
- @ Cached IsPointerNode pIsPointerNode , @ Exclusive @ Cached GilNode gil ) {
224
- boolean mustRelease = gil .acquire ();
225
- try {
226
- return pIsPointerNode .execute (this );
227
- } finally {
228
- gil .release (mustRelease );
229
- }
222
+ @ Cached IsPointerNode pIsPointerNode ) {
223
+ return pIsPointerNode .execute (this );
230
224
}
231
225
232
226
@ ExportMessage
233
227
public long asPointer (
234
228
@ CachedLibrary (limit = "1" ) InteropLibrary interopLibrary ,
235
- @ CachedLibrary ("this" ) PythonNativeWrapperLibrary lib , @ Exclusive @ Cached GilNode gil ) throws UnsupportedMessageException {
236
- boolean mustRelease = gil .acquire ();
237
- try {
238
- Object nativePointer = lib .getNativePointer (this );
239
- if (nativePointer instanceof Long ) {
240
- return (long ) nativePointer ;
241
- }
242
- return interopLibrary .asPointer (nativePointer );
243
- } finally {
244
- gil .release (mustRelease );
229
+ @ CachedLibrary ("this" ) PythonNativeWrapperLibrary lib ) throws UnsupportedMessageException {
230
+ Object nativePointer = lib .getNativePointer (this );
231
+ if (nativePointer instanceof Long ) {
232
+ return (long ) nativePointer ;
245
233
}
234
+ return interopLibrary .asPointer (nativePointer );
246
235
}
247
236
248
237
@ ExportMessage
@@ -260,25 +249,14 @@ static Object callGetUInt32ArrayTypeIDUncached(@SuppressWarnings("unused") PyLon
260
249
261
250
@ Specialization (assumptions = "singleContextAssumption()" )
262
251
static Object doByteArray (@ SuppressWarnings ("unused" ) PyLongDigitsWrapper object ,
263
- @ Exclusive @ Cached GilNode gil ,
264
- @ Bind ("gil.acquire()" ) boolean mustRelease ,
265
252
@ Exclusive @ Cached ("callGetUInt32ArrayTypeIDUncached(object)" ) Object nativeType ) {
266
- try {
267
- return nativeType ;
268
- } finally {
269
- gil .release (mustRelease );
270
- }
253
+ return nativeType ;
271
254
}
272
255
273
256
@ Specialization (replaces = "doByteArray" )
274
257
static Object doByteArrayMultiCtx (@ SuppressWarnings ("unused" ) PyLongDigitsWrapper object ,
275
- @ Cached PCallCapiFunction callGetTypeIDNode , @ Exclusive @ Cached GilNode gil ) {
276
- boolean mustRelease = gil .acquire ();
277
- try {
278
- return callGetTypeIDNode .call (FUN_GET_UINT32_ARRAY_TYPE_ID , 0 );
279
- } finally {
280
- gil .release (mustRelease );
281
- }
258
+ @ Cached PCallCapiFunction callGetTypeIDNode ) {
259
+ return callGetTypeIDNode .call (FUN_GET_UINT32_ARRAY_TYPE_ID , 0 );
282
260
}
283
261
284
262
protected static Assumption singleContextAssumption () {
0 commit comments