Skip to content

Commit 7c0544d

Browse files
timfelfangerer
authored andcommitted
fix performance warning
1 parent c86c0aa commit 7c0544d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,9 @@ long doFast(PythonNativeWrapper obj) {
943943
}
944944

945945
private long ensureLong(Object nativePointer) {
946-
if (nativePointer instanceof TruffleObject) {
946+
if (nativePointer instanceof Long) {
947+
return (long) nativePointer;
948+
} else {
947949
if (asPointerNode == null) {
948950
CompilerDirectives.transferToInterpreterAndInvalidate();
949951
asPointerNode = insert(Message.AS_POINTER.createNode());
@@ -955,7 +957,6 @@ private long ensureLong(Object nativePointer) {
955957
throw e.raise();
956958
}
957959
}
958-
return (long) nativePointer;
959960
}
960961

961962
protected static boolean isBoolNativeWrapper(Object obj) {

0 commit comments

Comments
 (0)