Skip to content

Commit bcaab54

Browse files
committed
opt GIL: PyCFunctionDecorator
1 parent 252889a commit bcaab54

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

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

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@
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;
44-
import com.oracle.truffle.api.dsl.Cached;
45-
import com.oracle.truffle.api.dsl.Cached.Exclusive;
4644
import com.oracle.truffle.api.interop.ArityException;
4745
import com.oracle.truffle.api.interop.InteropLibrary;
4846
import com.oracle.truffle.api.interop.TruffleObject;
@@ -72,15 +70,10 @@ boolean isExecutable() {
7270
@ExportMessage
7371
Object execute(Object[] arguments,
7472
@CachedLibrary("this.nativeFunction") InteropLibrary nativeFunctionLib,
75-
@CachedLibrary("this.resultConverter") InteropLibrary resultConverterLib, @Exclusive @Cached GilNode gil)
73+
@CachedLibrary("this.resultConverter") InteropLibrary resultConverterLib)
7674
throws ArityException, UnsupportedTypeException, UnsupportedMessageException {
77-
boolean mustRelease = gil.acquire();
78-
try {
79-
Object res = nativeFunctionLib.execute(nativeFunction, arguments);
80-
return resultConverterLib.execute(resultConverter, res);
81-
} finally {
82-
gil.release(mustRelease);
83-
}
75+
Object res = nativeFunctionLib.execute(nativeFunction, arguments);
76+
return resultConverterLib.execute(resultConverter, res);
8477
}
8578

8679
public Object getNativeFunction() {

0 commit comments

Comments
 (0)