Skip to content

Commit a5feae9

Browse files
committed
opt GIL: PythonNativeVoidPtr
1 parent 51dd4ae commit a5feae9

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

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

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,16 @@
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;
4243

4344
import com.oracle.graal.python.builtins.PythonBuiltinClassType;
4445
import com.oracle.graal.python.builtins.objects.PythonAbstractObject;
4546
import com.oracle.graal.python.builtins.objects.function.PArguments.ThreadState;
4647
import com.oracle.graal.python.builtins.objects.object.PythonObjectLibrary;
47-
import com.oracle.graal.python.runtime.GilNode;
4848
import com.oracle.truffle.api.CompilerAsserts;
4949
import com.oracle.truffle.api.CompilerDirectives;
5050
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
51-
import com.oracle.truffle.api.dsl.Cached;
52-
import com.oracle.truffle.api.dsl.Cached.Exclusive;
5351
import com.oracle.truffle.api.interop.InteropLibrary;
5452
import com.oracle.truffle.api.interop.TruffleObject;
5553
import com.oracle.truffle.api.interop.UnsupportedMessageException;
@@ -121,20 +119,15 @@ public String toString() {
121119

122120
@ExportMessage(limit = "2")
123121
long hashWithState(@SuppressWarnings("unused") ThreadState state,
124-
@CachedLibrary("this.getPointerObject()") InteropLibrary lib, @Exclusive @Cached GilNode gil) {
125-
boolean mustRelease = gil.acquire();
126-
try {
127-
if (lib.hasIdentity(object)) {
128-
try {
129-
return lib.identityHashCode(object);
130-
} catch (UnsupportedMessageException e) {
131-
CompilerDirectives.shouldNotReachHere(e);
132-
}
122+
@CachedLibrary("this.getPointerObject()") InteropLibrary lib) {
123+
if (lib.hasIdentity(object)) {
124+
try {
125+
return lib.identityHashCode(object);
126+
} catch (UnsupportedMessageException e) {
127+
CompilerDirectives.shouldNotReachHere(e);
133128
}
134-
return hashCodeBoundary(object);
135-
} finally {
136-
gil.release(mustRelease);
137129
}
130+
return hashCodeBoundary(object);
138131
}
139132

140133
@TruffleBoundary

0 commit comments

Comments
 (0)