2121 */
2222package som .interpreter .nodes ;
2323
24+ import som .vm .Universe ;
25+
2426import com .oracle .truffle .api .CompilerDirectives .CompilationFinal ;
2527import com .oracle .truffle .api .frame .FrameSlot ;
2628import com .oracle .truffle .api .frame .FrameSlotTypeException ;
@@ -35,17 +37,23 @@ public class Method extends RootNode {
3537 @ Child private final SequenceNode expressions ;
3638
3739 private final FrameSlot selfSlot ;
38- @ CompilationFinal private final FrameSlot [] argumentSlots ;
40+ @ CompilationFinal private final FrameSlot [] argumentSlots ;
41+ @ CompilationFinal private final FrameSlot [] temporarySlots ;
3942 private final FrameSlot nonLocalReturnMarker ;
43+ private final Universe universe ;
4044
4145 public Method (final SequenceNode expressions ,
4246 final FrameSlot selfSlot ,
4347 final FrameSlot [] argumentSlots ,
44- final FrameSlot nonLocalReturnMarker ) {
48+ final FrameSlot [] temporarySlots ,
49+ final FrameSlot nonLocalReturnMarker ,
50+ final Universe universe ) {
4551 this .expressions = expressions ;
4652 this .selfSlot = selfSlot ;
4753 this .argumentSlots = argumentSlots ;
54+ this .temporarySlots = temporarySlots ;
4855 this .nonLocalReturnMarker = nonLocalReturnMarker ;
56+ this .universe = universe ;
4957 }
5058
5159 @ Override
@@ -81,6 +89,10 @@ private FrameOnStackMarker initializeFrame(MaterializedFrame frame) {
8189 FrameOnStackMarker marker = new FrameOnStackMarker ();
8290 frame .setObject (nonLocalReturnMarker , marker );
8391
92+ for (int i = 0 ; i < temporarySlots .length ; i ++) {
93+ frame .setObject (temporarySlots [i ], universe .nilObject );
94+ }
95+
8496 return marker ;
8597 } catch (FrameSlotTypeException e ) {
8698 throw new RuntimeException ("Should not happen, since we only have one type currently!" );
0 commit comments