@@ -231,9 +231,7 @@ protected SpecialVariableStorage getFromKnownFrameDescriptor(Frame frame,
231
231
variables = SpecialVariableStorage .get (frame );
232
232
if (variables == nil ) {
233
233
CompilerDirectives .transferToInterpreterAndInvalidate ();
234
- variables = new SpecialVariableStorage ();
235
- SpecialVariableStorage .set (frame , (SpecialVariableStorage ) variables );
236
- SpecialVariableStorage .getAssumption (frame .getFrameDescriptor ()).invalidate ();
234
+ variables = initializeSpecialVariablesSlot (frame );
237
235
}
238
236
} else {
239
237
Frame storageFrame = RubyArguments .getDeclarationFrame (frame , declarationFrameDepth );
@@ -246,9 +244,7 @@ protected SpecialVariableStorage getFromKnownFrameDescriptor(Frame frame,
246
244
variables = SpecialVariableStorage .get (storageFrame );
247
245
if (variables == nil ) {
248
246
CompilerDirectives .transferToInterpreterAndInvalidate ();
249
- variables = new SpecialVariableStorage ();
250
- SpecialVariableStorage .set (storageFrame , (SpecialVariableStorage ) variables );
251
- SpecialVariableStorage .getAssumption (storageFrame .getFrameDescriptor ()).invalidate ();
247
+ variables = initializeSpecialVariablesSlot (storageFrame );
252
248
}
253
249
}
254
250
return (SpecialVariableStorage ) variables ;
@@ -264,13 +260,18 @@ public static SpecialVariableStorage getSlow(MaterializedFrame aFrame) {
264
260
MaterializedFrame frame = FindDeclarationVariableNodes .getOuterDeclarationFrame (aFrame );
265
261
Object variables = SpecialVariableStorage .get (frame );
266
262
if (variables == Nil .INSTANCE ) {
267
- variables = new SpecialVariableStorage ();
268
- SpecialVariableStorage .set (frame , (SpecialVariableStorage ) variables );
269
- SpecialVariableStorage .getAssumption (frame .getFrameDescriptor ()).invalidate ();
263
+ variables = initializeSpecialVariablesSlot (frame );
270
264
}
271
265
return (SpecialVariableStorage ) variables ;
272
266
}
273
267
268
+ private static Object initializeSpecialVariablesSlot (Frame storageFrame ) {
269
+ var variables = new SpecialVariableStorage ();
270
+ SpecialVariableStorage .set (storageFrame , variables );
271
+ SpecialVariableStorage .getAssumption (storageFrame .getFrameDescriptor ()).invalidate ();
272
+ return variables ;
273
+ }
274
+
274
275
private static void noStorageFrameError (Frame frame , int declarationFrameDepth ) {
275
276
int depth = 0 ;
276
277
MaterializedFrame currentFrame = RubyArguments .getDeclarationFrame (frame );
0 commit comments