@@ -240,18 +240,7 @@ protected SpecialVariableStorage getFromKnownFrameDescriptor(Frame frame,
240
240
241
241
if (storageFrame == null ) {
242
242
CompilerDirectives .transferToInterpreterAndInvalidate ();
243
- int depth = 0 ;
244
- MaterializedFrame currentFrame = RubyArguments .getDeclarationFrame (frame );
245
- while (currentFrame != null ) {
246
- depth += 1 ;
247
- currentFrame = RubyArguments .getDeclarationFrame (currentFrame );
248
- }
249
-
250
- String message = String .format (
251
- "Expected %d declaration frames but only found %d frames." ,
252
- declarationFrameDepth ,
253
- depth );
254
- throw CompilerDirectives .shouldNotReachHere (message );
243
+ noStorageFrameError (frame , declarationFrameDepth );
255
244
}
256
245
257
246
variables = SpecialVariableStorage .get (storageFrame );
@@ -282,6 +271,21 @@ public static SpecialVariableStorage getSlow(MaterializedFrame aFrame) {
282
271
return (SpecialVariableStorage ) variables ;
283
272
}
284
273
274
+ private static void noStorageFrameError (Frame frame , int declarationFrameDepth ) {
275
+ int depth = 0 ;
276
+ MaterializedFrame currentFrame = RubyArguments .getDeclarationFrame (frame );
277
+ while (currentFrame != null ) {
278
+ depth += 1 ;
279
+ currentFrame = RubyArguments .getDeclarationFrame (currentFrame );
280
+ }
281
+
282
+ String message = String .format (
283
+ "Expected %d declaration frames but only found %d frames." ,
284
+ declarationFrameDepth ,
285
+ depth );
286
+ throw CompilerDirectives .shouldNotReachHere (message );
287
+ }
288
+
285
289
}
286
290
287
291
@ Primitive (name = "caller_special_variables" )
0 commit comments