63
63
import com .oracle .graal .python .builtins .objects .cext .NativeWrappers .PythonNativeWrapper ;
64
64
import com .oracle .graal .python .builtins .objects .cext .NativeWrappers .PythonObjectNativeWrapper ;
65
65
import com .oracle .graal .python .builtins .objects .cext .PythonObjectNativeWrapperMRFactory .PAsPointerNodeGen ;
66
- import com .oracle .graal .python .builtins .objects .cext .PythonObjectNativeWrapperMRFactory .PIsPointerNodeGen ;
67
66
import com .oracle .graal .python .builtins .objects .cext .PythonObjectNativeWrapperMRFactory .ReadNativeMemberNodeGen ;
68
67
import com .oracle .graal .python .builtins .objects .cext .PythonObjectNativeWrapperMRFactory .ToPyObjectNodeGen ;
69
68
import com .oracle .graal .python .builtins .objects .cext .PythonObjectNativeWrapperMRFactory .WriteNativeMemberNodeGen ;
@@ -850,18 +849,17 @@ public Object access(Object object) {
850
849
@ Resolve (message = "TO_NATIVE" )
851
850
abstract static class ToNativeNode extends Node {
852
851
@ Child private ToPyObjectNode toPyObjectNode ;
853
- @ Child private PIsPointerNode pIsPointerNode = PIsPointerNode .create ();
854
852
855
853
Object access (PythonClassInitNativeWrapper obj ) {
856
- if (!pIsPointerNode . execute ( obj )) {
854
+ if (!obj . isNative ( )) {
857
855
obj .setNativePointer (getToPyObjectNode ().execute (obj ));
858
856
}
859
857
return obj ;
860
858
}
861
859
862
860
Object access (PythonNativeWrapper obj ) {
863
861
assert !(obj instanceof PythonClassInitNativeWrapper );
864
- if (!pIsPointerNode . execute ( obj )) {
862
+ if (!obj . isNative ( )) {
865
863
obj .setNativePointer (getToPyObjectNode ().execute (obj ));
866
864
}
867
865
return obj ;
@@ -878,10 +876,8 @@ private ToPyObjectNode getToPyObjectNode() {
878
876
879
877
@ Resolve (message = "IS_POINTER" )
880
878
abstract static class IsPointerNode extends Node {
881
- @ Child private PIsPointerNode pIsPointerNode = PIsPointerNode .create ();
882
-
883
879
boolean access (PythonNativeWrapper obj ) {
884
- return pIsPointerNode . execute ( obj );
880
+ return obj . isNative ( );
885
881
}
886
882
}
887
883
@@ -894,29 +890,6 @@ long access(PythonNativeWrapper obj) {
894
890
}
895
891
}
896
892
897
- abstract static class PIsPointerNode extends PNodeWithContext {
898
-
899
- public abstract boolean execute (PythonNativeWrapper obj );
900
-
901
- @ Specialization (guards = "!obj.isNative()" )
902
- boolean doBool (BoolNativeWrapper obj ) {
903
- // Special case: Booleans are singletons, so we need to check if the singletons have
904
- // native wrappers associated and if they are already native.
905
- PInt boxed = factory ().createInt (obj .getValue ());
906
- DynamicObjectNativeWrapper nativeWrapper = boxed .getNativeWrapper ();
907
- return nativeWrapper != null && nativeWrapper .isNative ();
908
- }
909
-
910
- @ Fallback
911
- boolean doBool (PythonNativeWrapper obj ) {
912
- return obj .isNative ();
913
- }
914
-
915
- private static PIsPointerNode create () {
916
- return PIsPointerNodeGen .create ();
917
- }
918
- }
919
-
920
893
abstract static class PAsPointerNode extends PNodeWithContext {
921
894
@ Child private Node asPointerNode ;
922
895
0 commit comments