67
67
import com .oracle .truffle .api .dsl .ImportStatic ;
68
68
import com .oracle .truffle .api .dsl .Specialization ;
69
69
import com .oracle .truffle .api .frame .FrameDescriptor ;
70
+ import com .oracle .truffle .api .frame .FrameSlot ;
70
71
import com .oracle .truffle .api .frame .MaterializedFrame ;
71
72
import com .oracle .truffle .api .frame .VirtualFrame ;
72
73
import com .oracle .truffle .api .library .CachedLibrary ;
76
77
import com .oracle .truffle .api .profiles .ConditionProfile ;
77
78
78
79
@ ExportLibrary (HashingStorageLibrary .class )
79
- @ SuppressWarnings ("deprecation" ) // new Frame API
80
80
public final class LocalsStorage extends HashingStorage {
81
81
/* This won't be the real (materialized) frame but a clone of it. */
82
82
protected final MaterializedFrame frame ;
@@ -94,11 +94,11 @@ public MaterializedFrame getFrame() {
94
94
return this .frame ;
95
95
}
96
96
97
- private Object getValue (com . oracle . truffle . api . frame . FrameSlot slot ) {
97
+ private Object getValue (FrameSlot slot ) {
98
98
return getValue (this .frame , slot );
99
99
}
100
100
101
- private static Object getValue (MaterializedFrame frame , com . oracle . truffle . api . frame . FrameSlot slot ) {
101
+ private static Object getValue (MaterializedFrame frame , FrameSlot slot ) {
102
102
if (slot != null ) {
103
103
Object value = frame .getValue (slot );
104
104
if (value instanceof PCell ) {
@@ -122,34 +122,32 @@ public int length() {
122
122
@ TruffleBoundary
123
123
private void calculateLength () {
124
124
this .len = this .frame .getFrameDescriptor ().getSize ();
125
- for (com . oracle . truffle . api . frame . FrameSlot slot : this .frame .getFrameDescriptor ().getSlots ()) {
125
+ for (FrameSlot slot : this .frame .getFrameDescriptor ().getSlots ()) {
126
126
Object identifier = slot .getIdentifier ();
127
127
if (!isUserFrameSlot (identifier ) || getValue (frame , slot ) == null ) {
128
128
this .len --;
129
129
}
130
130
}
131
131
}
132
132
133
- @ SuppressWarnings ({ "unused" , "deprecation" }) // new frame API
133
+ @ SuppressWarnings ("unused" )
134
134
@ ExportMessage
135
135
@ ImportStatic (PGuards .class )
136
136
static class GetItemWithState {
137
137
@ Specialization (guards = {"key == cachedKey" , "desc == self.frame.getFrameDescriptor()" }, limit = "3" , assumptions = "desc.getVersion()" )
138
- @ SuppressWarnings ("deprecation" ) // new Frame API
139
138
static Object getItemCached (LocalsStorage self , String key , ThreadState state ,
140
139
@ Cached ("key" ) String cachedKey ,
141
140
@ Cached ("self.frame.getFrameDescriptor()" ) FrameDescriptor desc ,
142
- @ Cached ("desc.findFrameSlot(key)" ) com . oracle . truffle . api . frame . FrameSlot slot ) {
141
+ @ Cached ("desc.findFrameSlot(key)" ) FrameSlot slot ) {
143
142
return self .getValue (slot );
144
143
}
145
144
146
145
@ Specialization (replaces = "getItemCached" )
147
- @ SuppressWarnings ("deprecation" ) // new Frame API
148
146
static Object string (LocalsStorage self , String key , ThreadState state ) {
149
147
if (!isUserFrameSlot (key )) {
150
148
return null ;
151
149
}
152
- com . oracle . truffle . api . frame . FrameSlot slot = findSlot (self , key );
150
+ FrameSlot slot = findSlot (self , key );
153
151
return self .getValue (slot );
154
152
}
155
153
@@ -160,7 +158,6 @@ static Object pstring(LocalsStorage self, PString key, ThreadState state,
160
158
}
161
159
162
160
@ Specialization (guards = "!isBuiltinString(key, profile)" , limit = "1" )
163
- @ SuppressWarnings ("deprecation" ) // new Frame API
164
161
static Object notString (LocalsStorage self , Object key , ThreadState state ,
165
162
@ Shared ("builtinProfile" ) @ Cached IsBuiltinClassProfile profile ,
166
163
@ Cached PyObjectRichCompareBool .EqNode eqNode ,
@@ -169,7 +166,7 @@ static Object notString(LocalsStorage self, Object key, ThreadState state,
169
166
CompilerDirectives .bailout ("accessing locals storage with non-string keys is slow" );
170
167
VirtualFrame frame = gotState .profile (state == null ) ? null : PArguments .frameForCall (state );
171
168
long hash = hashNode .execute (frame , key );
172
- for (com . oracle . truffle . api . frame . FrameSlot slot : self .frame .getFrameDescriptor ().getSlots ()) {
169
+ for (FrameSlot slot : self .frame .getFrameDescriptor ().getSlots ()) {
173
170
Object currentKey = slot .getIdentifier ();
174
171
if (currentKey instanceof String ) {
175
172
long keyHash = hashNode .execute (frame , currentKey );
@@ -182,8 +179,7 @@ static Object notString(LocalsStorage self, Object key, ThreadState state,
182
179
}
183
180
184
181
@ TruffleBoundary
185
- @ SuppressWarnings ("deprecation" ) // new Frame API
186
- private static com .oracle .truffle .api .frame .FrameSlot findSlot (LocalsStorage self , Object key ) {
182
+ private static FrameSlot findSlot (LocalsStorage self , Object key ) {
187
183
return self .frame .getFrameDescriptor ().findFrameSlot (key );
188
184
}
189
185
}
@@ -221,10 +217,9 @@ private HashingStorage generalize(HashingStorageLibrary lib, boolean isStringKey
221
217
@ ExportMessage
222
218
@ TruffleBoundary
223
219
@ Override
224
- @ SuppressWarnings ("deprecation" ) // new Frame API
225
220
public Object forEachUntyped (ForEachNode <Object > node , Object arg ) {
226
221
Object result = arg ;
227
- for (com . oracle . truffle . api . frame . FrameSlot slot : this .frame .getFrameDescriptor ().getSlots ()) {
222
+ for (FrameSlot slot : this .frame .getFrameDescriptor ().getSlots ()) {
228
223
Object identifier = slot .getIdentifier ();
229
224
if (identifier instanceof String ) {
230
225
if (isUserFrameSlot (identifier )) {
@@ -240,21 +235,19 @@ public Object forEachUntyped(ForEachNode<Object> node, Object arg) {
240
235
241
236
@ ExportMessage
242
237
static class AddAllToOther {
243
- @ SuppressWarnings ("deprecation" ) // new Frame API
244
- protected static com .oracle .truffle .api .frame .FrameSlot [] getSlots (FrameDescriptor desc ) {
245
- return desc .getSlots ().toArray (new com .oracle .truffle .api .frame .FrameSlot [0 ]);
238
+ protected static FrameSlot [] getSlots (FrameDescriptor desc ) {
239
+ return desc .getSlots ().toArray (new FrameSlot [0 ]);
246
240
}
247
241
248
242
@ Specialization (guards = {"desc == self.frame.getFrameDescriptor()" }, limit = "1" , assumptions = "desc.getVersion()" )
249
243
@ ExplodeLoop
250
- @ SuppressWarnings ("deprecation" ) // new Frame API
251
244
static HashingStorage cached (LocalsStorage self , HashingStorage other ,
252
245
@ CachedLibrary (limit = "2" ) HashingStorageLibrary lib ,
253
246
@ Exclusive @ SuppressWarnings ("unused" ) @ Cached ("self.frame.getFrameDescriptor()" ) FrameDescriptor desc ,
254
- @ Exclusive @ Cached (value = "getSlots(desc)" , dimensions = 1 ) com . oracle . truffle . api . frame . FrameSlot [] slots ) {
247
+ @ Exclusive @ Cached (value = "getSlots(desc)" , dimensions = 1 ) FrameSlot [] slots ) {
255
248
HashingStorage result = other ;
256
249
for (int i = 0 ; i < slots .length ; i ++) {
257
- com . oracle . truffle . api . frame . FrameSlot slot = slots [i ];
250
+ FrameSlot slot = slots [i ];
258
251
Object value = self .getValue (slot );
259
252
if (value != null ) {
260
253
result = lib .setItem (result , slot .getIdentifier (), value );
@@ -265,13 +258,12 @@ static HashingStorage cached(LocalsStorage self, HashingStorage other,
265
258
266
259
@ Specialization (replaces = "cached" )
267
260
@ TruffleBoundary
268
- @ SuppressWarnings ("deprecation" ) // new Frame API
269
261
static HashingStorage generic (LocalsStorage self , HashingStorage other ,
270
262
@ CachedLibrary (limit = "2" ) HashingStorageLibrary lib ) {
271
263
HashingStorage result = other ;
272
- com . oracle . truffle . api . frame . FrameSlot [] slots = getSlots (self .frame .getFrameDescriptor ());
264
+ FrameSlot [] slots = getSlots (self .frame .getFrameDescriptor ());
273
265
for (int i = 0 ; i < slots .length ; i ++) {
274
- com . oracle . truffle . api . frame . FrameSlot slot = slots [i ];
266
+ FrameSlot slot = slots [i ];
275
267
Object value = self .getValue (slot );
276
268
if (value != null ) {
277
269
result = lib .setItem (result , slot .getIdentifier (), value );
@@ -304,13 +296,12 @@ public HashingStorageIterable<Object> reverseKeys() {
304
296
return new HashingStorageIterable <>(new ReverseLocalsIterator (this .frame ));
305
297
}
306
298
307
- @ SuppressWarnings ("deprecation" ) // new Frame API
308
299
protected abstract static class AbstractLocalsIterator implements Iterator <Object > {
309
- protected List <? extends com . oracle . truffle . api . frame . FrameSlot > slots ;
300
+ protected List <? extends FrameSlot > slots ;
310
301
protected final int size ;
311
302
protected int index ;
312
303
protected final MaterializedFrame frame ;
313
- protected com . oracle . truffle . api . frame . FrameSlot nextFrameSlot = null ;
304
+ protected FrameSlot nextFrameSlot = null ;
314
305
315
306
AbstractLocalsIterator (MaterializedFrame frame ) {
316
307
this .frame = frame ;
@@ -320,7 +311,7 @@ protected abstract static class AbstractLocalsIterator implements Iterator<Objec
320
311
}
321
312
322
313
@ TruffleBoundary
323
- private static List <? extends com . oracle . truffle . api . frame . FrameSlot > getSlots (MaterializedFrame frame ) {
314
+ private static List <? extends FrameSlot > getSlots (MaterializedFrame frame ) {
324
315
return frame .getFrameDescriptor ().getSlots ();
325
316
}
326
317
@@ -357,10 +348,10 @@ public Object next() {
357
348
}
358
349
359
350
@ TruffleBoundary
360
- public com . oracle . truffle . api . frame . FrameSlot nextSlot () {
351
+ public FrameSlot nextSlot () {
361
352
if (hasNext ()) {
362
353
assert this .nextFrameSlot != null ;
363
- com . oracle . truffle . api . frame . FrameSlot value = this .nextFrameSlot ;
354
+ FrameSlot value = this .nextFrameSlot ;
364
355
this .nextFrameSlot = null ;
365
356
return value ;
366
357
}
@@ -377,10 +368,9 @@ private static final class LocalsIterator extends AbstractLocalsIterator {
377
368
378
369
@ TruffleBoundary
379
370
@ Override
380
- @ SuppressWarnings ("deprecation" ) // new Frame API
381
371
protected boolean loadNext () {
382
372
while (this .index < this .size ) {
383
- com . oracle . truffle . api . frame . FrameSlot nextCandidate = this .slots .get (this .index ++);
373
+ FrameSlot nextCandidate = this .slots .get (this .index ++);
384
374
Object identifier = nextCandidate .getIdentifier ();
385
375
if (identifier instanceof String ) {
386
376
if (isUserFrameSlot (identifier )) {
@@ -405,10 +395,9 @@ private static final class ReverseLocalsIterator extends AbstractLocalsIterator
405
395
406
396
@ TruffleBoundary
407
397
@ Override
408
- @ SuppressWarnings ("deprecation" ) // new Frame API
409
398
protected boolean loadNext () {
410
399
while (this .index >= 0 ) {
411
- com . oracle . truffle . api . frame . FrameSlot nextCandidate = this .slots .get (this .index --);
400
+ FrameSlot nextCandidate = this .slots .get (this .index --);
412
401
Object identifier = nextCandidate .getIdentifier ();
413
402
if (identifier instanceof String ) {
414
403
if (isUserFrameSlot (identifier )) {
0 commit comments