Skip to content

Commit 6662d9a

Browse files
committed
opt GIL: ManagedMethodWrappers
1 parent a8e0a76 commit 6662d9a

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

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

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -81,37 +81,22 @@ public MethodWrapper(Object method, Object typeid) {
8181

8282
@ExportMessage
8383
public boolean isPointer(
84-
@Exclusive @Cached IsPointerNode pIsPointerNode, @Exclusive @Cached GilNode gil) {
85-
boolean mustRelease = gil.acquire();
86-
try {
87-
return pIsPointerNode.execute(this);
88-
} finally {
89-
gil.release(mustRelease);
90-
}
84+
@Exclusive @Cached IsPointerNode pIsPointerNode) {
85+
return pIsPointerNode.execute(this);
9186
}
9287

9388
@ExportMessage
9489
public long asPointer(
95-
@Exclusive @Cached PAsPointerNode pAsPointerNode, @Exclusive @Cached GilNode gil) {
96-
boolean mustRelease = gil.acquire();
97-
try {
98-
return pAsPointerNode.execute(this);
99-
} finally {
100-
gil.release(mustRelease);
101-
}
90+
@Exclusive @Cached PAsPointerNode pAsPointerNode) {
91+
return pAsPointerNode.execute(this);
10292
}
10393

10494
@ExportMessage
10595
public void toNative(
10696
@Exclusive @Cached ToPyObjectNode toPyObjectNode,
107-
@Exclusive @Cached InvalidateNativeObjectsAllManagedNode invalidateNode, @Exclusive @Cached GilNode gil) {
108-
boolean mustRelease = gil.acquire();
109-
try {
110-
invalidateNode.execute();
111-
setNativePointer(toPyObjectNode.execute(this));
112-
} finally {
113-
gil.release(mustRelease);
114-
}
97+
@Exclusive @Cached InvalidateNativeObjectsAllManagedNode invalidateNode) {
98+
invalidateNode.execute();
99+
setNativePointer(toPyObjectNode.execute(this));
115100
}
116101

117102
@ExportMessage

0 commit comments

Comments
 (0)