6363import com .oracle .graal .python .builtins .objects .cext .NativeWrappers .PythonNativeWrapper ;
6464import com .oracle .graal .python .builtins .objects .cext .NativeWrappers .PythonObjectNativeWrapper ;
6565import com .oracle .graal .python .builtins .objects .cext .PythonObjectNativeWrapperMRFactory .PAsPointerNodeGen ;
66- import com .oracle .graal .python .builtins .objects .cext .PythonObjectNativeWrapperMRFactory .PIsPointerNodeGen ;
6766import com .oracle .graal .python .builtins .objects .cext .PythonObjectNativeWrapperMRFactory .ReadNativeMemberNodeGen ;
6867import com .oracle .graal .python .builtins .objects .cext .PythonObjectNativeWrapperMRFactory .ToPyObjectNodeGen ;
6968import com .oracle .graal .python .builtins .objects .cext .PythonObjectNativeWrapperMRFactory .WriteNativeMemberNodeGen ;
@@ -850,18 +849,17 @@ public Object access(Object object) {
850849 @ Resolve (message = "TO_NATIVE" )
851850 abstract static class ToNativeNode extends Node {
852851 @ Child private ToPyObjectNode toPyObjectNode ;
853- @ Child private PIsPointerNode pIsPointerNode = PIsPointerNode .create ();
854852
855853 Object access (PythonClassInitNativeWrapper obj ) {
856- if (!pIsPointerNode . execute ( obj )) {
854+ if (!obj . isNative ( )) {
857855 obj .setNativePointer (getToPyObjectNode ().execute (obj ));
858856 }
859857 return obj ;
860858 }
861859
862860 Object access (PythonNativeWrapper obj ) {
863861 assert !(obj instanceof PythonClassInitNativeWrapper );
864- if (!pIsPointerNode . execute ( obj )) {
862+ if (!obj . isNative ( )) {
865863 obj .setNativePointer (getToPyObjectNode ().execute (obj ));
866864 }
867865 return obj ;
@@ -878,10 +876,8 @@ private ToPyObjectNode getToPyObjectNode() {
878876
879877 @ Resolve (message = "IS_POINTER" )
880878 abstract static class IsPointerNode extends Node {
881- @ Child private PIsPointerNode pIsPointerNode = PIsPointerNode .create ();
882-
883879 boolean access (PythonNativeWrapper obj ) {
884- return pIsPointerNode . execute ( obj );
880+ return obj . isNative ( );
885881 }
886882 }
887883
@@ -894,29 +890,6 @@ long access(PythonNativeWrapper obj) {
894890 }
895891 }
896892
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-
920893 abstract static class PAsPointerNode extends PNodeWithContext {
921894 @ Child private Node asPointerNode ;
922895
0 commit comments