2424
2525package som .vmobjects ;
2626
27+ import som .interpreter .nodes .literals .BlockNode .BlockNodeWithContext ;
2728import som .primitives .BlockPrimsFactory .ValueMorePrimFactory ;
2829import som .primitives .BlockPrimsFactory .ValueNonePrimFactory ;
2930import som .primitives .BlockPrimsFactory .ValueOnePrimFactory ;
3233import som .vm .Universe ;
3334
3435import com .oracle .truffle .api .CompilerDirectives ;
35- import com .oracle .truffle .api .frame .FrameSlot ;
36- import com .oracle .truffle .api .frame .FrameUtil ;
3736import com .oracle .truffle .api .frame .MaterializedFrame ;
3837
3938public abstract class SBlock extends SAbstractObject {
4039
4140 public static SBlock create (final SInvokable blockMethod ,
42- final MaterializedFrame context , final FrameSlot outerSelfSlot ) {
41+ final MaterializedFrame context , final BlockNodeWithContext originNode ) {
4342 switch (blockMethod .getNumberOfArguments ()) {
44- case 1 : return new SBlock1 (blockMethod , context , outerSelfSlot );
45- case 2 : return new SBlock2 (blockMethod , context , outerSelfSlot );
46- case 3 : return new SBlock3 (blockMethod , context , outerSelfSlot );
43+ case 1 : return new SBlock1 (blockMethod , context , originNode );
44+ case 2 : return new SBlock2 (blockMethod , context , originNode );
45+ case 3 : return new SBlock3 (blockMethod , context , originNode );
4746 }
4847 throw new RuntimeException ("We do currently not have support for more than 3 arguments to a block." );
4948 }
5049
5150 public static final class SBlock1 extends SBlock {
5251 public SBlock1 (final SInvokable blockMethod , final MaterializedFrame context ,
53- final FrameSlot outerSelfSlot ) {
54- super (blockMethod , context , outerSelfSlot );
52+ final BlockNodeWithContext originNode ) {
53+ super (blockMethod , context , originNode );
5554 }
5655
5756 @ Override
@@ -62,8 +61,8 @@ public SClass getSOMClass(final Universe universe) {
6261
6362 public static final class SBlock2 extends SBlock {
6463 public SBlock2 (final SInvokable blockMethod , final MaterializedFrame context ,
65- final FrameSlot outerSelfSlot ) {
66- super (blockMethod , context , outerSelfSlot );
64+ final BlockNodeWithContext originNode ) {
65+ super (blockMethod , context , originNode );
6766 }
6867
6968 @ Override
@@ -74,8 +73,8 @@ public SClass getSOMClass(final Universe universe) {
7473
7574 public static final class SBlock3 extends SBlock {
7675 public SBlock3 (final SInvokable blockMethod , final MaterializedFrame context ,
77- final FrameSlot outerSelfSlot ) {
78- super (blockMethod , context , outerSelfSlot );
76+ final BlockNodeWithContext originNode ) {
77+ super (blockMethod , context , originNode );
7978 }
8079
8180 @ Override
@@ -85,10 +84,10 @@ public SClass getSOMClass(final Universe universe) {
8584 }
8685
8786 public SBlock (final SInvokable blockMethod , final MaterializedFrame context ,
88- final FrameSlot outerSelfSlot ) {
87+ final BlockNodeWithContext originNode ) {
8988 this .method = blockMethod ;
9089 this .context = context ;
91- this .outerSelfSlot = outerSelfSlot ;
90+ this .originNode = originNode ;
9291 }
9392
9493 public final SInvokable getMethod () {
@@ -101,7 +100,7 @@ public final MaterializedFrame getContext() {
101100 }
102101
103102 public final Object getOuterSelf () {
104- return FrameUtil . getObjectSafe ( getContext (), outerSelfSlot );
103+ return originNode . getOuterSelf ( context );
105104 }
106105
107106 public static SInvokable getEvaluationPrimitive (final int numberOfArguments ,
@@ -137,5 +136,5 @@ private static String computeSignatureString(final int numberOfArguments) {
137136
138137 private final SInvokable method ;
139138 private final MaterializedFrame context ;
140- private final FrameSlot outerSelfSlot ;
139+ private final BlockNodeWithContext originNode ;
141140}
0 commit comments