6767import com .oracle .truffle .api .dsl .ImportStatic ;
6868import com .oracle .truffle .api .dsl .Specialization ;
6969import com .oracle .truffle .api .frame .FrameDescriptor ;
70- import com .oracle .truffle .api .frame .FrameSlot ;
7170import com .oracle .truffle .api .frame .MaterializedFrame ;
7271import com .oracle .truffle .api .frame .VirtualFrame ;
7372import com .oracle .truffle .api .library .CachedLibrary ;
7776import com .oracle .truffle .api .profiles .ConditionProfile ;
7877
7978@ ExportLibrary (HashingStorageLibrary .class )
79+ @ SuppressWarnings ("deprecation" ) // new Frame API
8080public final class LocalsStorage extends HashingStorage {
8181 /* This won't be the real (materialized) frame but a clone of it. */
8282 protected final MaterializedFrame frame ;
@@ -94,11 +94,11 @@ public MaterializedFrame getFrame() {
9494 return this .frame ;
9595 }
9696
97- private Object getValue (FrameSlot slot ) {
97+ private Object getValue (com . oracle . truffle . api . frame . FrameSlot slot ) {
9898 return getValue (this .frame , slot );
9999 }
100100
101- private static Object getValue (MaterializedFrame frame , FrameSlot slot ) {
101+ private static Object getValue (MaterializedFrame frame , com . oracle . truffle . api . frame . FrameSlot slot ) {
102102 if (slot != null ) {
103103 Object value = frame .getValue (slot );
104104 if (value instanceof PCell ) {
@@ -122,32 +122,34 @@ public int length() {
122122 @ TruffleBoundary
123123 private void calculateLength () {
124124 this .len = this .frame .getFrameDescriptor ().getSize ();
125- for (FrameSlot slot : this .frame .getFrameDescriptor ().getSlots ()) {
125+ for (com . oracle . truffle . api . frame . FrameSlot slot : this .frame .getFrameDescriptor ().getSlots ()) {
126126 Object identifier = slot .getIdentifier ();
127127 if (!isUserFrameSlot (identifier ) || getValue (frame , slot ) == null ) {
128128 this .len --;
129129 }
130130 }
131131 }
132132
133- @ SuppressWarnings ("unused" )
133+ @ SuppressWarnings ({ "unused" , "deprecation" }) // new frame API
134134 @ ExportMessage
135135 @ ImportStatic (PGuards .class )
136136 static class GetItemWithState {
137137 @ Specialization (guards = {"key == cachedKey" , "desc == self.frame.getFrameDescriptor()" }, limit = "3" , assumptions = "desc.getVersion()" )
138+ @ SuppressWarnings ("deprecation" ) // new Frame API
138139 static Object getItemCached (LocalsStorage self , String key , ThreadState state ,
139140 @ Cached ("key" ) String cachedKey ,
140141 @ Cached ("self.frame.getFrameDescriptor()" ) FrameDescriptor desc ,
141- @ Cached ("desc.findFrameSlot(key)" ) FrameSlot slot ) {
142+ @ Cached ("desc.findFrameSlot(key)" ) com . oracle . truffle . api . frame . FrameSlot slot ) {
142143 return self .getValue (slot );
143144 }
144145
145146 @ Specialization (replaces = "getItemCached" )
147+ @ SuppressWarnings ("deprecation" ) // new Frame API
146148 static Object string (LocalsStorage self , String key , ThreadState state ) {
147149 if (!isUserFrameSlot (key )) {
148150 return null ;
149151 }
150- FrameSlot slot = findSlot (self , key );
152+ com . oracle . truffle . api . frame . FrameSlot slot = findSlot (self , key );
151153 return self .getValue (slot );
152154 }
153155
@@ -158,6 +160,7 @@ static Object pstring(LocalsStorage self, PString key, ThreadState state,
158160 }
159161
160162 @ Specialization (guards = "!isBuiltinString(key, profile)" , limit = "1" )
163+ @ SuppressWarnings ("deprecation" ) // new Frame API
161164 static Object notString (LocalsStorage self , Object key , ThreadState state ,
162165 @ Shared ("builtinProfile" ) @ Cached IsBuiltinClassProfile profile ,
163166 @ Cached PyObjectRichCompareBool .EqNode eqNode ,
@@ -166,7 +169,7 @@ static Object notString(LocalsStorage self, Object key, ThreadState state,
166169 CompilerDirectives .bailout ("accessing locals storage with non-string keys is slow" );
167170 VirtualFrame frame = gotState .profile (state == null ) ? null : PArguments .frameForCall (state );
168171 long hash = hashNode .execute (frame , key );
169- for (FrameSlot slot : self .frame .getFrameDescriptor ().getSlots ()) {
172+ for (com . oracle . truffle . api . frame . FrameSlot slot : self .frame .getFrameDescriptor ().getSlots ()) {
170173 Object currentKey = slot .getIdentifier ();
171174 if (currentKey instanceof String ) {
172175 long keyHash = hashNode .execute (frame , currentKey );
@@ -179,7 +182,8 @@ static Object notString(LocalsStorage self, Object key, ThreadState state,
179182 }
180183
181184 @ TruffleBoundary
182- private static FrameSlot findSlot (LocalsStorage self , Object key ) {
185+ @ SuppressWarnings ("deprecation" ) // new Frame API
186+ private static com .oracle .truffle .api .frame .FrameSlot findSlot (LocalsStorage self , Object key ) {
183187 return self .frame .getFrameDescriptor ().findFrameSlot (key );
184188 }
185189 }
@@ -217,9 +221,10 @@ private HashingStorage generalize(HashingStorageLibrary lib, boolean isStringKey
217221 @ ExportMessage
218222 @ TruffleBoundary
219223 @ Override
224+ @ SuppressWarnings ("deprecation" ) // new Frame API
220225 public Object forEachUntyped (ForEachNode <Object > node , Object arg ) {
221226 Object result = arg ;
222- for (FrameSlot slot : this .frame .getFrameDescriptor ().getSlots ()) {
227+ for (com . oracle . truffle . api . frame . FrameSlot slot : this .frame .getFrameDescriptor ().getSlots ()) {
223228 Object identifier = slot .getIdentifier ();
224229 if (identifier instanceof String ) {
225230 if (isUserFrameSlot (identifier )) {
@@ -235,19 +240,21 @@ public Object forEachUntyped(ForEachNode<Object> node, Object arg) {
235240
236241 @ ExportMessage
237242 static class AddAllToOther {
238- protected static FrameSlot [] getSlots (FrameDescriptor desc ) {
239- return desc .getSlots ().toArray (new FrameSlot [0 ]);
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 ]);
240246 }
241247
242248 @ Specialization (guards = {"desc == self.frame.getFrameDescriptor()" }, limit = "1" , assumptions = "desc.getVersion()" )
243249 @ ExplodeLoop
250+ @ SuppressWarnings ("deprecation" ) // new Frame API
244251 static HashingStorage cached (LocalsStorage self , HashingStorage other ,
245252 @ CachedLibrary (limit = "2" ) HashingStorageLibrary lib ,
246253 @ Exclusive @ SuppressWarnings ("unused" ) @ Cached ("self.frame.getFrameDescriptor()" ) FrameDescriptor desc ,
247- @ Exclusive @ Cached (value = "getSlots(desc)" , dimensions = 1 ) FrameSlot [] slots ) {
254+ @ Exclusive @ Cached (value = "getSlots(desc)" , dimensions = 1 ) com . oracle . truffle . api . frame . FrameSlot [] slots ) {
248255 HashingStorage result = other ;
249256 for (int i = 0 ; i < slots .length ; i ++) {
250- FrameSlot slot = slots [i ];
257+ com . oracle . truffle . api . frame . FrameSlot slot = slots [i ];
251258 Object value = self .getValue (slot );
252259 if (value != null ) {
253260 result = lib .setItem (result , slot .getIdentifier (), value );
@@ -258,12 +265,13 @@ static HashingStorage cached(LocalsStorage self, HashingStorage other,
258265
259266 @ Specialization (replaces = "cached" )
260267 @ TruffleBoundary
268+ @ SuppressWarnings ("deprecation" ) // new Frame API
261269 static HashingStorage generic (LocalsStorage self , HashingStorage other ,
262270 @ CachedLibrary (limit = "2" ) HashingStorageLibrary lib ) {
263271 HashingStorage result = other ;
264- FrameSlot [] slots = getSlots (self .frame .getFrameDescriptor ());
272+ com . oracle . truffle . api . frame . FrameSlot [] slots = getSlots (self .frame .getFrameDescriptor ());
265273 for (int i = 0 ; i < slots .length ; i ++) {
266- FrameSlot slot = slots [i ];
274+ com . oracle . truffle . api . frame . FrameSlot slot = slots [i ];
267275 Object value = self .getValue (slot );
268276 if (value != null ) {
269277 result = lib .setItem (result , slot .getIdentifier (), value );
@@ -296,12 +304,13 @@ public HashingStorageIterable<Object> reverseKeys() {
296304 return new HashingStorageIterable <>(new ReverseLocalsIterator (this .frame ));
297305 }
298306
307+ @ SuppressWarnings ("deprecation" ) // new Frame API
299308 protected abstract static class AbstractLocalsIterator implements Iterator <Object > {
300- protected List <? extends FrameSlot > slots ;
309+ protected List <? extends com . oracle . truffle . api . frame . FrameSlot > slots ;
301310 protected final int size ;
302311 protected int index ;
303312 protected final MaterializedFrame frame ;
304- protected FrameSlot nextFrameSlot = null ;
313+ protected com . oracle . truffle . api . frame . FrameSlot nextFrameSlot = null ;
305314
306315 AbstractLocalsIterator (MaterializedFrame frame ) {
307316 this .frame = frame ;
@@ -311,7 +320,7 @@ protected abstract static class AbstractLocalsIterator implements Iterator<Objec
311320 }
312321
313322 @ TruffleBoundary
314- private static List <? extends FrameSlot > getSlots (MaterializedFrame frame ) {
323+ private static List <? extends com . oracle . truffle . api . frame . FrameSlot > getSlots (MaterializedFrame frame ) {
315324 return frame .getFrameDescriptor ().getSlots ();
316325 }
317326
@@ -348,10 +357,10 @@ public Object next() {
348357 }
349358
350359 @ TruffleBoundary
351- public FrameSlot nextSlot () {
360+ public com . oracle . truffle . api . frame . FrameSlot nextSlot () {
352361 if (hasNext ()) {
353362 assert this .nextFrameSlot != null ;
354- FrameSlot value = this .nextFrameSlot ;
363+ com . oracle . truffle . api . frame . FrameSlot value = this .nextFrameSlot ;
355364 this .nextFrameSlot = null ;
356365 return value ;
357366 }
@@ -368,9 +377,10 @@ private static final class LocalsIterator extends AbstractLocalsIterator {
368377
369378 @ TruffleBoundary
370379 @ Override
380+ @ SuppressWarnings ("deprecation" ) // new Frame API
371381 protected boolean loadNext () {
372382 while (this .index < this .size ) {
373- FrameSlot nextCandidate = this .slots .get (this .index ++);
383+ com . oracle . truffle . api . frame . FrameSlot nextCandidate = this .slots .get (this .index ++);
374384 Object identifier = nextCandidate .getIdentifier ();
375385 if (identifier instanceof String ) {
376386 if (isUserFrameSlot (identifier )) {
@@ -395,9 +405,10 @@ private static final class ReverseLocalsIterator extends AbstractLocalsIterator
395405
396406 @ TruffleBoundary
397407 @ Override
408+ @ SuppressWarnings ("deprecation" ) // new Frame API
398409 protected boolean loadNext () {
399410 while (this .index >= 0 ) {
400- FrameSlot nextCandidate = this .slots .get (this .index --);
411+ com . oracle . truffle . api . frame . FrameSlot nextCandidate = this .slots .get (this .index --);
401412 Object identifier = nextCandidate .getIdentifier ();
402413 if (identifier instanceof String ) {
403414 if (isUserFrameSlot (identifier )) {
0 commit comments