Skip to content

Commit a8e0a76

Browse files
committed
opt GIL: PyProcsWrapper
1 parent e2ec354 commit a8e0a76

File tree

1 file changed

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

1 file changed

+7
-22
lines changed

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

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -104,37 +104,22 @@ public Object getNativeType() {
104104

105105
@ExportMessage
106106
protected boolean isPointer(
107-
@Cached IsPointerNode isPointerNode, @Exclusive @Cached GilNode gil) {
108-
boolean mustRelease = gil.acquire();
109-
try {
110-
return isPointerNode.execute(this);
111-
} finally {
112-
gil.release(mustRelease);
113-
}
107+
@Cached IsPointerNode isPointerNode) {
108+
return isPointerNode.execute(this);
114109
}
115110

116111
@ExportMessage
117112
protected long asPointer(
118-
@Exclusive @Cached PAsPointerNode pAsPointerNode, @Exclusive @Cached GilNode gil) {
119-
boolean mustRelease = gil.acquire();
120-
try {
121-
return pAsPointerNode.execute(this);
122-
} finally {
123-
gil.release(mustRelease);
124-
}
113+
@Exclusive @Cached PAsPointerNode pAsPointerNode) {
114+
return pAsPointerNode.execute(this);
125115
}
126116

127117
@ExportMessage
128118
protected void toNative(
129119
@Exclusive @Cached ToPyObjectNode toPyObjectNode,
130-
@Exclusive @Cached InvalidateNativeObjectsAllManagedNode invalidateNode, @Exclusive @Cached GilNode gil) {
131-
boolean mustRelease = gil.acquire();
132-
try {
133-
invalidateNode.execute();
134-
setNativePointer(toPyObjectNode.execute(this));
135-
} finally {
136-
gil.release(mustRelease);
137-
}
120+
@Exclusive @Cached InvalidateNativeObjectsAllManagedNode invalidateNode) {
121+
invalidateNode.execute();
122+
setNativePointer(toPyObjectNode.execute(this));
138123
}
139124

140125
@ExportLibrary(InteropLibrary.class)

0 commit comments

Comments
 (0)