Skip to content

Commit 9d8910f

Browse files
committed
opt GIL: PythonNativeNull
1 parent 69188b9 commit 9d8910f

File tree

1 file changed

+4
-18
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi

1 file changed

+4
-18
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/PythonNativeNull.java

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,10 @@
3838
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3939
* SOFTWARE.
4040
*/
41+
// skip GIL
4142
package com.oracle.graal.python.builtins.objects.cext.capi;
4243

43-
import com.oracle.graal.python.runtime.GilNode;
4444
import com.oracle.truffle.api.CompilerDirectives;
45-
import com.oracle.truffle.api.dsl.Bind;
46-
import com.oracle.truffle.api.dsl.Cached;
47-
import com.oracle.truffle.api.dsl.Cached.Exclusive;
4845
import com.oracle.truffle.api.interop.InteropLibrary;
4946
import com.oracle.truffle.api.interop.TruffleObject;
5047
import com.oracle.truffle.api.interop.UnsupportedMessageException;
@@ -77,13 +74,8 @@ boolean isPointer() {
7774

7875
@ExportMessage(limit = "1")
7976
long asPointer(
80-
@CachedLibrary("this.getPtr()") InteropLibrary ptrInteropLib, @Exclusive @Cached GilNode gil) throws UnsupportedMessageException {
81-
boolean mustRelease = gil.acquire();
82-
try {
83-
return ptrInteropLib.asPointer(getPtr());
84-
} finally {
85-
gil.release(mustRelease);
86-
}
77+
@CachedLibrary("this.getPtr()") InteropLibrary ptrInteropLib) throws UnsupportedMessageException {
78+
return ptrInteropLib.asPointer(getPtr());
8779
}
8880

8981
@ExportMessage
@@ -111,14 +103,8 @@ int identityHashCode(@CachedLibrary("this.getPtr()") InteropLibrary lib) throws
111103

112104
@ExportMessage(limit = "1")
113105
boolean isIdentical(Object other, InteropLibrary otherLib,
114-
@Exclusive @Cached GilNode gil,
115-
@Bind("gil.acquire()") boolean mustRelease,
116106
@CachedLibrary("this.getPtr()") InteropLibrary lib) {
117-
try {
118-
return lib.isIdentical(ptr, other, otherLib);
119-
} finally {
120-
gil.release(mustRelease);
121-
}
107+
return lib.isIdentical(ptr, other, otherLib);
122108
}
123109

124110
@SuppressWarnings({"unused", "static-method"})

0 commit comments

Comments
 (0)