5
5
6
6
import com .oracle .graal .python .PythonLanguage ;
7
7
import com .oracle .graal .python .builtins .objects .common .SequenceNodes ;
8
- import com .oracle .graal .python .builtins .objects .memoryview .IntrinsifiedPMemoryView ;
8
+ import com .oracle .graal .python .builtins .objects .memoryview .PMemoryView ;
9
9
import com .oracle .graal .python .builtins .objects .object .PythonObject ;
10
10
import com .oracle .graal .python .nodes .SpecialMethodNames ;
11
11
import com .oracle .graal .python .runtime .PythonContext ;
@@ -88,7 +88,7 @@ protected Object getMembers(@SuppressWarnings("unused") boolean includeInternal)
88
88
protected Object readMember (String member ,
89
89
@ CachedLibrary ("this" ) PythonNativeWrapperLibrary lib ,
90
90
@ Exclusive @ Cached ReadFieldNode readFieldNode ) throws UnknownIdentifierException {
91
- return readFieldNode .execute ((IntrinsifiedPMemoryView ) lib .getDelegate (this ), member );
91
+ return readFieldNode .execute ((PMemoryView ) lib .getDelegate (this ), member );
92
92
}
93
93
94
94
@ GenerateUncached
@@ -112,14 +112,14 @@ static Object getShape(int[] intArray,
112
112
@ GenerateUncached
113
113
abstract static class ReadFieldNode extends Node {
114
114
115
- public abstract Object execute (IntrinsifiedPMemoryView delegate , String key ) throws UnknownIdentifierException ;
115
+ public abstract Object execute (PMemoryView delegate , String key ) throws UnknownIdentifierException ;
116
116
117
117
protected static boolean eq (String expected , String actual ) {
118
118
return expected .equals (actual );
119
119
}
120
120
121
121
@ Specialization (guards = {"eq(BUF, key)" , "object.getBufferPointer() == null" })
122
- static Object getBufManaged (IntrinsifiedPMemoryView object , @ SuppressWarnings ("unused" ) String key ,
122
+ static Object getBufManaged (PMemoryView object , @ SuppressWarnings ("unused" ) String key ,
123
123
@ Cached SequenceNodes .GetSequenceStorageNode getStorage ,
124
124
@ Cached SequenceNodes .SetSequenceStorageNode setStorage ,
125
125
@ Shared ("pointerAdd" ) @ Cached CExtNodes .PointerAddNode pointerAddNode ,
@@ -139,7 +139,7 @@ static Object getBufManaged(IntrinsifiedPMemoryView object, @SuppressWarnings("u
139
139
}
140
140
141
141
@ Specialization (guards = {"eq(BUF, key)" , "object.getBufferPointer() != null" })
142
- static Object getBufNative (IntrinsifiedPMemoryView object , @ SuppressWarnings ("unused" ) String key ,
142
+ static Object getBufNative (PMemoryView object , @ SuppressWarnings ("unused" ) String key ,
143
143
@ Shared ("pointerAdd" ) @ Cached CExtNodes .PointerAddNode pointerAddNode ) {
144
144
if (object .getOffset () == 0 ) {
145
145
return object .getBufferPointer ();
@@ -149,7 +149,7 @@ static Object getBufNative(IntrinsifiedPMemoryView object, @SuppressWarnings("un
149
149
}
150
150
151
151
@ Specialization (guards = {"eq(OBJ, key)" })
152
- static Object getObj (IntrinsifiedPMemoryView object , @ SuppressWarnings ("unused" ) String key ,
152
+ static Object getObj (PMemoryView object , @ SuppressWarnings ("unused" ) String key ,
153
153
@ Shared ("toSulong" ) @ Cached CExtNodes .ToSulongNode toSulongNode ,
154
154
@ Shared ("getNativeNull" ) @ Cached CExtNodes .GetNativeNullNode getNativeNullNode ) {
155
155
if (object .getOwner () != null ) {
@@ -160,27 +160,27 @@ static Object getObj(IntrinsifiedPMemoryView object, @SuppressWarnings("unused")
160
160
}
161
161
162
162
@ Specialization (guards = {"eq(LEN, key)" })
163
- static Object getLen (IntrinsifiedPMemoryView object , @ SuppressWarnings ("unused" ) String key ) {
163
+ static Object getLen (PMemoryView object , @ SuppressWarnings ("unused" ) String key ) {
164
164
return (long ) object .getLength ();
165
165
}
166
166
167
167
@ Specialization (guards = {"eq(ITEMSIZE, key)" })
168
- static Object getItemsize (IntrinsifiedPMemoryView object , @ SuppressWarnings ("unused" ) String key ) {
168
+ static Object getItemsize (PMemoryView object , @ SuppressWarnings ("unused" ) String key ) {
169
169
return (long ) object .getItemSize ();
170
170
}
171
171
172
172
@ Specialization (guards = {"eq(NDIM, key)" })
173
- static Object getINDim (IntrinsifiedPMemoryView object , @ SuppressWarnings ("unused" ) String key ) {
173
+ static Object getINDim (PMemoryView object , @ SuppressWarnings ("unused" ) String key ) {
174
174
return object .getDimensions ();
175
175
}
176
176
177
177
@ Specialization (guards = {"eq(READONLY, key)" })
178
- static Object getReadonly (IntrinsifiedPMemoryView object , @ SuppressWarnings ("unused" ) String key ) {
178
+ static Object getReadonly (PMemoryView object , @ SuppressWarnings ("unused" ) String key ) {
179
179
return object .isReadOnly () ? 1 : 0 ;
180
180
}
181
181
182
182
@ Specialization (guards = {"eq(FORMAT, key)" })
183
- static Object getFormat (IntrinsifiedPMemoryView object , @ SuppressWarnings ("unused" ) String key ,
183
+ static Object getFormat (PMemoryView object , @ SuppressWarnings ("unused" ) String key ,
184
184
@ Cached CExtNodes .AsCharPointerNode asCharPointerNode ,
185
185
@ Shared ("toSulong" ) @ Cached CExtNodes .ToSulongNode toSulongNode ,
186
186
@ Shared ("getNativeNull" ) @ Cached CExtNodes .GetNativeNullNode getNativeNullNode ) {
@@ -192,19 +192,19 @@ static Object getFormat(IntrinsifiedPMemoryView object, @SuppressWarnings("unuse
192
192
}
193
193
194
194
@ Specialization (guards = {"eq(SHAPE, key)" })
195
- static Object getShape (IntrinsifiedPMemoryView object , @ SuppressWarnings ("unused" ) String key ,
195
+ static Object getShape (PMemoryView object , @ SuppressWarnings ("unused" ) String key ,
196
196
@ Shared ("toArray" ) @ Cached IntArrayToNativePySSizeArray intArrayToNativePySSizeArray ) {
197
197
return intArrayToNativePySSizeArray .execute (object .getBufferShape ());
198
198
}
199
199
200
200
@ Specialization (guards = {"eq(STRIDES, key)" })
201
- static Object getStrides (IntrinsifiedPMemoryView object , @ SuppressWarnings ("unused" ) String key ,
201
+ static Object getStrides (PMemoryView object , @ SuppressWarnings ("unused" ) String key ,
202
202
@ Shared ("toArray" ) @ Cached IntArrayToNativePySSizeArray intArrayToNativePySSizeArray ) {
203
203
return intArrayToNativePySSizeArray .execute (object .getBufferStrides ());
204
204
}
205
205
206
206
@ Specialization (guards = {"eq(SUBOFFSETS, key)" })
207
- static Object getSuboffsets (IntrinsifiedPMemoryView object , @ SuppressWarnings ("unused" ) String key ,
207
+ static Object getSuboffsets (PMemoryView object , @ SuppressWarnings ("unused" ) String key ,
208
208
@ Shared ("toSulong" ) @ Cached CExtNodes .ToSulongNode toSulongNode ,
209
209
@ Shared ("getNativeNull" ) @ Cached CExtNodes .GetNativeNullNode getNativeNullNode ,
210
210
@ Shared ("toArray" ) @ Cached IntArrayToNativePySSizeArray intArrayToNativePySSizeArray ) {
@@ -216,28 +216,28 @@ static Object getSuboffsets(IntrinsifiedPMemoryView object, @SuppressWarnings("u
216
216
}
217
217
218
218
@ Specialization (guards = {"eq(INTERNAL, key)" })
219
- static Object getInternal (@ SuppressWarnings ("unused" ) IntrinsifiedPMemoryView object , @ SuppressWarnings ("unused" ) String key ,
219
+ static Object getInternal (@ SuppressWarnings ("unused" ) PMemoryView object , @ SuppressWarnings ("unused" ) String key ,
220
220
@ Shared ("toSulong" ) @ Cached CExtNodes .ToSulongNode toSulongNode ,
221
221
@ Shared ("getNativeNull" ) @ Cached CExtNodes .GetNativeNullNode getNativeNullNode ) {
222
222
return toSulongNode .execute (getNativeNullNode .execute ());
223
223
}
224
224
225
225
@ Fallback
226
- static Object error (@ SuppressWarnings ("unused" ) IntrinsifiedPMemoryView object , String key ) throws UnknownIdentifierException {
226
+ static Object error (@ SuppressWarnings ("unused" ) PMemoryView object , String key ) throws UnknownIdentifierException {
227
227
throw UnknownIdentifierException .create (key );
228
228
}
229
229
}
230
230
231
231
@ ExportMessage
232
232
protected boolean isPointer (
233
- @ Exclusive @ Cached CExtNodes .IsPointerNode pIsPointerNode ) {
233
+ @ Exclusive @ Cached CExtNodes .IsPointerNode pIsPointerNode ) {
234
234
return pIsPointerNode .execute (this );
235
235
}
236
236
237
237
@ ExportMessage
238
238
public long asPointer (
239
- @ CachedLibrary ("this" ) PythonNativeWrapperLibrary lib ,
240
- @ CachedLibrary (limit = "1" ) InteropLibrary interopLibrary ) throws UnsupportedMessageException {
239
+ @ CachedLibrary ("this" ) PythonNativeWrapperLibrary lib ,
240
+ @ CachedLibrary (limit = "1" ) InteropLibrary interopLibrary ) throws UnsupportedMessageException {
241
241
Object nativePointer = lib .getNativePointer (this );
242
242
if (nativePointer instanceof Long ) {
243
243
return (long ) nativePointer ;
@@ -247,9 +247,9 @@ public long asPointer(
247
247
248
248
@ ExportMessage
249
249
protected void toNative (
250
- @ CachedLibrary ("this" ) PythonNativeWrapperLibrary lib ,
251
- @ Exclusive @ Cached DynamicObjectNativeWrapper .ToPyObjectNode toPyObjectNode ,
252
- @ Exclusive @ Cached InvalidateNativeObjectsAllManagedNode invalidateNode ) {
250
+ @ CachedLibrary ("this" ) PythonNativeWrapperLibrary lib ,
251
+ @ Exclusive @ Cached DynamicObjectNativeWrapper .ToPyObjectNode toPyObjectNode ,
252
+ @ Exclusive @ Cached InvalidateNativeObjectsAllManagedNode invalidateNode ) {
253
253
invalidateNode .execute ();
254
254
if (!lib .isNative (this )) {
255
255
setNativePointer (toPyObjectNode .execute (this ));
0 commit comments