Browse Source

Extract direct use of `self instructions`. Part 1.

Assignments, sends, closures.
Returns await.
Herbert Vojčík 7 years ago
parent
commit
712d429765
4 changed files with 236 additions and 175 deletions
  1. 106 26
      src/Compiler-IR.js
  2. 24 6
      src/Compiler-IR.st
  3. 90 127
      src/Compiler-Inlining.js
  4. 16 16
      src/Compiler-Inlining.st

+ 106 - 26
src/Compiler-IR.js

@@ -1617,6 +1617,52 @@ messageSends: ["visitIRAssignment:"]
 }),
 $globals.IRAssignment);
 
+$core.addMethod(
+$core.method({
+selector: "left",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+return $recv(self._instructions())._first();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "left\x0a\x09^ self instructions first",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["first", "instructions"]
+}),
+$globals.IRAssignment);
+
+$core.addMethod(
+$core.method({
+selector: "right",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+return $recv(self._instructions())._last();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "right\x0a\x09^ self instructions last",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["last", "instructions"]
+}),
+$globals.IRAssignment);
+
 
 
 $core.addClass('IRDynamicArray', $globals.IRInstruction, [], 'Compiler-IR');
@@ -2632,6 +2678,29 @@ messageSends: ["visitIRSend:"]
 }),
 $globals.IRSend);
 
+$core.addMethod(
+$core.method({
+selector: "arguments",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+return $recv(self._instructions())._allButFirst();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "arguments\x0a\x09^ self instructions allButFirst",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["allButFirst", "instructions"]
+}),
+$globals.IRSend);
+
 $core.addMethod(
 $core.method({
 selector: "index",
@@ -2697,7 +2766,7 @@ var receiver;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-receiver=$recv(self._instructions())._first();
+receiver=self._receiver();
 return $recv($recv(receiver)._isVariable())._and_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
@@ -2713,10 +2782,33 @@ return $recv($recv($recv(receiver)._variable())._name()).__eq("super");
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "isSuperSend\x0a\x09| receiver |\x0a\x09receiver := self instructions first.\x0a\x09^ receiver isVariable and: [ receiver variable name = 'super' ]",
+source: "isSuperSend\x0a\x09| receiver |\x0a\x09receiver := self receiver.\x0a\x09^ receiver isVariable and: [ receiver variable name = 'super' ]",
+referencedClasses: [],
+//>>excludeEnd("ide");
+messageSends: ["receiver", "and:", "isVariable", "=", "name", "variable"]
+}),
+$globals.IRSend);
+
+$core.addMethod(
+$core.method({
+selector: "receiver",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+return $core.withContext(function($ctx1) {
+//>>excludeEnd("ctx");
+return $recv(self._instructions())._first();
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
+}, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
+//>>excludeEnd("ctx");
+},
+//>>excludeStart("ide", pragmas.excludeIdeData);
+args: [],
+source: "receiver\x0a\x09^ self instructions first",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["first", "instructions", "and:", "isVariable", "=", "name", "variable"]
+messageSends: ["first", "instructions"]
 }),
 $globals.IRSend);
 
@@ -3694,17 +3786,11 @@ var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $2,$1;
 $recv(self._stream())._nextPutAssignLhs_rhs_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-$2=$recv(anIRAssignment)._instructions();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx2.sendIdx["instructions"]=1;
-//>>excludeEnd("ctx");
-$1=$recv($2)._first();
-return self._visit_($1);
+return self._visit_($recv(anIRAssignment)._left());
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx2.sendIdx["visit:"]=1;
 //>>excludeEnd("ctx");
@@ -3715,7 +3801,7 @@ $ctx2.sendIdx["visit:"]=1;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-return self._visit_($recv($recv(anIRAssignment)._instructions())._last());
+return self._visit_($recv(anIRAssignment)._right());
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
 //>>excludeEnd("ctx");
@@ -3727,10 +3813,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRAssignment"],
-source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment instructions first]\x0a\x09\x09rhs: [self visit: anIRAssignment instructions last].",
+source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "first", "instructions", "last"]
+messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
 }),
 $globals.IRJSTranslator);
 
@@ -4371,15 +4457,9 @@ var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $2,$1;
-$2=$recv(anIRSend)._instructions();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["instructions"]=1;
-//>>excludeEnd("ctx");
-$1=$recv($2)._first();
-self._visitReceiver_($1);
+self._visitReceiver_($recv(anIRSend)._receiver());
 $recv(self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
-self._visitInstructionList_enclosedBetween_and_($recv($recv(anIRSend)._instructions())._allButFirst(),"(",")");
+self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
@@ -4387,10 +4467,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRSend"],
-source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend instructions first.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend instructions allButFirst\x0a\x09\x09enclosedBetween: '(' and: ')'",
+source: "visitSend: anIRSend\x0a\x09self visitReceiver: anIRSend receiver.\x0a\x09self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '(' and: ')'",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["visitReceiver:", "first", "instructions", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "allButFirst"]
+messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
 }),
 $globals.IRJSTranslator);
 
@@ -4476,7 +4556,7 @@ $7=$recv($1)._nextPutAll_("$recv(self), ");
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["nextPutAll:"]=8;
 //>>excludeEnd("ctx");
-self._visitInstructionList_enclosedBetween_and_($recv($recv(anIRSend)._instructions())._allButFirst(),"[","]");
+self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
 $8=self._stream();
 $recv($8)._nextPutAll_("));");
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -4507,10 +4587,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRSend"],
-source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true,'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: '(', self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass||$boot.nilAsClass).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$recv(self), '.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend instructions allButFirst\x0a\x09\x09enclosedBetween: '[' and: ']'.\x0a\x09self stream \x0a\x09\x09nextPutAll: '));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
+source: "visitSuperSend: anIRSend\x0a\x09self stream\x0a\x09\x09nextPutAll: '('; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = true,'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'; lf;\x0a\x09\x09nextPutAll: '(', self currentClass asJavascript;\x0a\x09\x09nextPutAll: '.superclass||$boot.nilAsClass).fn.prototype.';\x0a\x09\x09nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';\x0a\x09\x09nextPutAll: '$recv(self), '.\x0a\x09self\x0a\x09\x09visitInstructionList: anIRSend arguments\x0a\x09\x09enclosedBetween: '[' and: ']'.\x0a\x09self stream \x0a\x09\x09nextPutAll: '));'; lf;\x0a\x09\x09nextPutAll: '//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);'; lf;\x0a\x09\x09nextPutAll: anIRSend scope alias, '.supercall = false;'; lf;\x0a\x09\x09nextPutAll: '//>>excludeEnd(\x22ctx\x22);'",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "allButFirst", "instructions"]
+messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavascript", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
 }),
 $globals.IRJSTranslator);
 

+ 24 - 6
src/Compiler-IR.st

@@ -375,6 +375,16 @@ IRInstruction subclass: #IRAssignment
 	instanceVariableNames: ''
 	package: 'Compiler-IR'!
 
+!IRAssignment methodsFor: 'accessing'!
+
+left
+	^ self instructions first
+!
+
+right
+	^ self instructions last
+! !
+
 !IRAssignment methodsFor: 'visiting'!
 
 accept: aVisitor
@@ -660,6 +670,10 @@ I am a message send instruction.!
 
 !IRSend methodsFor: 'accessing'!
 
+arguments
+	^ self instructions allButFirst
+!
+
 index
 	^ index
 !
@@ -668,6 +682,10 @@ index: anInteger
 	index := anInteger
 !
 
+receiver
+	^ self instructions first
+!
+
 selector
 	^ selector
 !
@@ -684,7 +702,7 @@ isSend
 
 isSuperSend
 	| receiver |
-	receiver := self instructions first.
+	receiver := self receiver.
 	^ receiver isVariable and: [ receiver variable name = 'super' ]
 ! !
 
@@ -924,8 +942,8 @@ initialize
 
 visitIRAssignment: anIRAssignment
 	self stream
-		nextPutAssignLhs: [self visit: anIRAssignment instructions first]
-		rhs: [self visit: anIRAssignment instructions last].
+		nextPutAssignLhs: [self visit: anIRAssignment left]
+		rhs: [self visit: anIRAssignment right].
 !
 
 visitIRClosure: anIRClosure
@@ -1037,10 +1055,10 @@ visitReceiver: anIRInstruction
 !
 
 visitSend: anIRSend
-	self visitReceiver: anIRSend instructions first.
+	self visitReceiver: anIRSend receiver.
 	self stream nextPutAll: '.', anIRSend selector asJavaScriptMethodName.
 	self
-		visitInstructionList: anIRSend instructions allButFirst
+		visitInstructionList: anIRSend arguments
 		enclosedBetween: '(' and: ')'
 !
 
@@ -1055,7 +1073,7 @@ visitSuperSend: anIRSend
 		nextPutAll: anIRSend selector asJavaScriptMethodName, '.apply(';
 		nextPutAll: '$recv(self), '.
 	self
-		visitInstructionList: anIRSend instructions allButFirst
+		visitInstructionList: anIRSend arguments
 		enclosedBetween: '[' and: ']'.
 	self stream 
 		nextPutAll: '));'; lf;

+ 90 - 127
src/Compiler-Inlining.js

@@ -543,25 +543,21 @@ var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $4,$3,$2,$1;
+var $3,$2,$1;
 $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-$4=$recv(anIRAssignment)._instructions();
+$3=$recv(anIRAssignment)._right();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx2.sendIdx["instructions"]=1;
-//>>excludeEnd("ctx");
-$3=$recv($4)._last();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx2.sendIdx["last"]=1;
+$ctx2.sendIdx["right"]=1;
 //>>excludeEnd("ctx");
 $2=$recv($3)._isSend();
 return $recv($2)._and_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx3) {
 //>>excludeEnd("ctx");
-return self._shouldInlineSend_($recv($recv(anIRAssignment)._instructions())._last());
+return self._shouldInlineSend_($recv(anIRAssignment)._right());
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
 //>>excludeEnd("ctx");
@@ -580,10 +576,10 @@ return $1;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRAssignment"],
-source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment instructions last isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRAssignment instructions last) ]]",
+source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"]
+messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
 }),
 $globals.IRInliner);
 
@@ -882,7 +878,7 @@ var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-self._visit_($recv($recv(anIRInlinedAssignment)._instructions())._last());
+self._visit_($recv(anIRInlinedAssignment)._right());
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)});
@@ -890,10 +886,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRInlinedAssignment"],
-source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
+source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment right",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["visit:", "last", "instructions"]
+messageSends: ["visit:", "right"]
 }),
 $globals.IRInliningJSTranslator);
 
@@ -1410,7 +1406,7 @@ $ctx1.sendIdx["new"]=2;
 //>>excludeEnd("ctx");
 $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
 $5=$recv($globals.IRBlockSequence)._new();
-$recv($5)._add_($recv($recv(self._send())._instructions())._first());
+$recv($5)._add_($recv(self._send())._receiver());
 $6=$recv($5)._yourself();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["yourself"]=1;
@@ -1428,10 +1424,10 @@ return self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRInstruction"],
-source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: anIRInstruction\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
+source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: anIRInstruction\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send receiver;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)",
 referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
 //>>excludeEnd("ide");
-messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
+messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
 }),
 $globals.IRSendInliner);
 
@@ -1478,7 +1474,7 @@ $ctx1.sendIdx["new"]=2;
 //>>excludeEnd("ctx");
 $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
 $5=$recv($globals.IRBlockSequence)._new();
-$recv($5)._add_($recv($recv(self._send())._instructions())._first());
+$recv($5)._add_($recv(self._send())._receiver());
 $6=$recv($5)._yourself();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["yourself"]=1;
@@ -1496,10 +1492,10 @@ return self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRInstruction"],
-source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send instructions first;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09withBlock: anIRInstruction",
+source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09withBlock: (IRClosure new\x0a\x09\x09\x09scope: anIRInstruction scope copy;\x0a\x09\x09\x09add: (IRBlockSequence new\x0a\x09\x09\x09\x09add: self send receiver;\x0a\x09\x09\x09\x09yourself);\x0a\x09\x09\x09yourself)\x0a\x09\x09withBlock: anIRInstruction",
 referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
 //>>excludeEnd("ide");
-messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"]
+messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
 }),
 $globals.IRSendInliner);
 
@@ -1582,7 +1578,7 @@ var inlinedClosure,sequence,statements;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8,$22,$21,$25,$24,$26,$23,$27,$30,$29,$28;
+var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8,$23,$22,$24,$21,$25,$28,$27,$26;
 inlinedClosure=self._inlinedClosure();
 $1=inlinedClosure;
 $2=$recv(anIRClosure)._scope();
@@ -1703,15 +1699,7 @@ $recv(inlinedClosure)._add_(sequence);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["add:"]=6;
 //>>excludeEnd("ctx");
-$22=$recv(anIRClosure)._instructions();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["instructions"]=2;
-//>>excludeEnd("ctx");
-$21=$recv($22)._last();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["last"]=1;
-//>>excludeEnd("ctx");
-statements=$recv($21)._instructions();
+statements=$recv($recv(anIRClosure)._sequence())._instructions();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["instructions"]=1;
 //>>excludeEnd("ctx");
@@ -1731,33 +1719,33 @@ $ctx3.sendIdx["add:"]=7;
 }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
 //>>excludeEnd("ctx");
 }));
-$25=$recv(statements)._last();
+$23=$recv(statements)._last();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx2.sendIdx["last"]=2;
+$ctx2.sendIdx["last"]=1;
 //>>excludeEnd("ctx");
-$24=$recv($25)._isReturn();
-$23=$recv($24)._and_((function(){
+$22=$recv($23)._isReturn();
+$21=$recv($22)._and_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx3) {
 //>>excludeEnd("ctx");
-$26=$recv(statements)._last();
+$24=$recv(statements)._last();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx3.sendIdx["last"]=3;
+$ctx3.sendIdx["last"]=2;
 //>>excludeEnd("ctx");
-return $recv($26)._isBlockReturn();
+return $recv($24)._isBlockReturn();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
 //>>excludeEnd("ctx");
 }));
-if($core.assert($23)){
-$27=sequence;
-$30=$recv(statements)._last();
+if($core.assert($21)){
+$25=sequence;
+$28=$recv(statements)._last();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx2.sendIdx["last"]=4;
+$ctx2.sendIdx["last"]=3;
 //>>excludeEnd("ctx");
-$29=$recv($30)._instructions();
-$28=$recv($29)._first();
-return $recv($27)._add_($28);
+$27=$recv($28)._instructions();
+$26=$recv($27)._first();
+return $recv($25)._add_($26);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx2.sendIdx["add:"]=8;
 //>>excludeEnd("ctx");
@@ -1775,10 +1763,10 @@ return inlinedClosure;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRClosure"],
-source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure tempDeclarations do: [ :each |\x0a\x09\x09\x09inlinedClosure add: each ].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x0a\x09\x22Map the closure arguments to the receiver of the message send\x22\x0a\x09anIRClosure arguments do: [ :each |\x0a\x09\x09inlinedClosure add: (IRTempDeclaration new name: each; yourself).\x0a\x09\x09sequence add: (IRAssignment new\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));\x0a\x09\x09\x09yourself) ].\x0a\x09\x09\x09\x0a\x09\x22To ensure the correct order of the closure instructions: first the temps then the sequence\x22\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09(statements last isReturn and: [ statements last isBlockReturn ])\x0a\x09\x09\x09ifTrue: [ sequence add: statements last instructions first ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure",
+source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure \x0a\x09\x09scope: anIRClosure scope;\x0a\x09\x09parent: anIRClosure parent.\x0a\x0a\x09\x22Add the possible temp declarations\x22\x0a\x09anIRClosure tempDeclarations do: [ :each |\x0a\x09\x09\x09inlinedClosure add: each ].\x0a\x0a\x09\x22Add a block sequence\x22\x0a\x09sequence := self inlinedSequence.\x0a\x0a\x09\x22Map the closure arguments to the receiver of the message send\x22\x0a\x09anIRClosure arguments do: [ :each |\x0a\x09\x09inlinedClosure add: (IRTempDeclaration new name: each; yourself).\x0a\x09\x09sequence add: (IRAssignment new\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: each; yourself));\x0a\x09\x09\x09add: (IRVariable new variable: (AliasVar new scope: inlinedClosure scope; name: '$receiver'; yourself));\x0a\x09\x09\x09yourself) ].\x0a\x09\x09\x09\x0a\x09\x22To ensure the correct order of the closure instructions: first the temps then the sequence\x22\x0a\x09inlinedClosure add: sequence.\x0a\x0a\x09\x22Get all the statements\x22\x0a\x09statements := anIRClosure sequence instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements allButLast do: [ :each | sequence add: each ].\x0a\x0a\x09\x09\x22Inlined closures don't have implicit local returns\x22\x0a\x09\x09(statements last isReturn and: [ statements last isBlockReturn ])\x0a\x09\x09\x09ifTrue: [ sequence add: statements last instructions first ]\x0a\x09\x09\x09ifFalse: [ sequence add: statements last ] ].\x0a\x0a\x09^ inlinedClosure",
 referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
 //>>excludeEnd("ide");
-messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "isBlockReturn", "first"]
+messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "sequence", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "last", "isBlockReturn", "first"]
 }),
 $globals.IRSendInliner);
 
@@ -1798,17 +1786,17 @@ $2=self._send();
 $ctx1.sendIdx["send"]=1;
 //>>excludeEnd("ctx");
 $1=$recv($2)._selector();
-return self._perform_withArguments_($1,$recv($recv(self._send())._instructions())._allButFirst());
+return self._perform_withArguments_($1,$recv(self._send())._arguments());
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
 //>>excludeEnd("ctx");
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRSend"],
-source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send instructions allButFirst",
+source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"]
+messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
 }),
 $globals.IRSendInliner);
 
@@ -1845,7 +1833,7 @@ var inlinedClosure;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1,$2,$5,$4,$3,$6;
+var $1,$2,$4,$3,$5;
 $1=$recv(anIRInstruction)._isClosure();
 if(!$core.assert($1)){
 self._inliningError_("Message argument should be a block");
@@ -1858,23 +1846,22 @@ if(!$core.assert($2)){
 self._inliningError_("Inlined block should have zero argument");
 };
 inlinedClosure=$recv(self._translator())._visit_(self._inlineClosure_(anIRInstruction));
-$5=self._send();
+$4=self._send();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["send"]=1;
 //>>excludeEnd("ctx");
-$4=$recv($5)._instructions();
-$3=$recv($4)._first();
+$3=$recv($4)._receiver();
 $recv(inlinedSend)._add_($3);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["add:"]=1;
 //>>excludeEnd("ctx");
 $recv(inlinedSend)._add_(inlinedClosure);
 $recv(self._send())._replaceWith_(inlinedSend);
-$6=$recv($recv(inlinedSend)._method())._internalVariables();
+$5=$recv($recv(inlinedSend)._method())._internalVariables();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["internalVariables"]=1;
 //>>excludeEnd("ctx");
-$recv($6)._addAll_($recv(inlinedSend)._internalVariables());
+$recv($5)._addAll_($recv(inlinedSend)._internalVariables());
 return inlinedSend;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
@@ -1882,10 +1869,10 @@ return inlinedSend;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["inlinedSend", "anIRInstruction"],
-source: "inlinedSend: inlinedSend withBlock: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
+source: "inlinedSend: inlinedSend withBlock: anIRInstruction\x0a\x09| inlinedClosure |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anIRInstruction arguments size = 0 ifFalse: [ self inliningError: 'Inlined block should have zero argument' ].\x0a\x0a\x09inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send receiver;\x0a\x09\x09add: inlinedClosure.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x0a\x09^ inlinedSend",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
+messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
 }),
 $globals.IRSendInliner);
 
@@ -1899,7 +1886,7 @@ var inlinedClosure1,inlinedClosure2;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1,$2,$3,$4,$7,$6,$5,$8;
+var $1,$2,$3,$4,$6,$5,$7;
 $1=$recv(anIRInstruction)._isClosure();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["isClosure"]=1;
@@ -1927,12 +1914,11 @@ inlinedClosure1=$recv($3)._visit_($4);
 $ctx1.sendIdx["visit:"]=1;
 //>>excludeEnd("ctx");
 inlinedClosure2=$recv(self._translator())._visit_(self._inlineClosure_(anotherIRInstruction));
-$7=self._send();
+$6=self._send();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["send"]=1;
 //>>excludeEnd("ctx");
-$6=$recv($7)._instructions();
-$5=$recv($6)._first();
+$5=$recv($6)._receiver();
 $recv(inlinedSend)._add_($5);
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["add:"]=1;
@@ -1943,11 +1929,11 @@ $ctx1.sendIdx["add:"]=2;
 //>>excludeEnd("ctx");
 $recv(inlinedSend)._add_(inlinedClosure2);
 $recv(self._send())._replaceWith_(inlinedSend);
-$8=$recv($recv(inlinedSend)._method())._internalVariables();
+$7=$recv($recv(inlinedSend)._method())._internalVariables();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["internalVariables"]=1;
 //>>excludeEnd("ctx");
-$recv($8)._addAll_($recv(inlinedSend)._internalVariables());
+$recv($7)._addAll_($recv(inlinedSend)._internalVariables());
 return inlinedSend;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
@@ -1955,10 +1941,10 @@ return inlinedSend;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
-source: "inlinedSend: inlinedSend withBlock: anIRInstruction withBlock: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send instructions first;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
+source: "inlinedSend: inlinedSend withBlock: anIRInstruction withBlock: anotherIRInstruction\x0a\x09| inlinedClosure1 inlinedClosure2 |\x0a\x0a\x09anIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x09anotherIRInstruction isClosure ifFalse: [ self inliningError: 'Message argument should be a block' ].\x0a\x0a\x09inlinedClosure1 := self translator visit: (self inlineClosure: anIRInstruction).\x0a\x09inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).\x0a\x0a\x09inlinedSend\x0a\x09\x09add: self send receiver;\x0a\x09\x09add: inlinedClosure1;\x0a\x09\x09add: inlinedClosure2.\x0a\x0a\x09self send replaceWith: inlinedSend.\x0a\x09inlinedSend method internalVariables \x0a\x09\x09addAll: inlinedSend internalVariables.\x0a\x09\x09\x0a\x09^ inlinedSend",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
+messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
 }),
 $globals.IRSendInliner);
 
@@ -2106,17 +2092,17 @@ $core.addMethod(
 $core.method({
 selector: "shouldInline:",
 protocol: 'accessing',
-fn: function (anIRInstruction){
+fn: function (anIRSend){
 var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
 var $1;
-$1=$recv(self._inlinedSelectors())._includes_($recv(anIRInstruction)._selector());
+$1=$recv(self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
 if(!$core.assert($1)){
 return false;
 };
-return $recv($recv($recv(anIRInstruction)._instructions())._allButFirst())._allSatisfy_((function(each){
+return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
@@ -2126,15 +2112,15 @@ return $recv(each)._isClosure();
 //>>excludeEnd("ctx");
 }));
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner.klass)});
+}, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.klass)});
 //>>excludeEnd("ctx");
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
-args: ["anIRInstruction"],
-source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09^ anIRInstruction instructions allButFirst allSatisfy: [ :each | each isClosure]",
+args: ["anIRSend"],
+source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "allButFirst", "instructions", "isClosure"]
+messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
 }),
 $globals.IRSendInliner.klass);
 
@@ -2190,14 +2176,9 @@ var inlinedAssignment;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1;
 self._assignment_(anIRAssignment);
 inlinedAssignment=$recv($globals.IRInlinedAssignment)._new();
-$1=$recv(anIRAssignment)._instructions();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["instructions"]=1;
-//>>excludeEnd("ctx");
-$recv($1)._do_((function(each){
+$recv($recv(anIRAssignment)._instructions())._do_((function(each){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
@@ -2207,7 +2188,7 @@ return $recv(inlinedAssignment)._add_(each);
 //>>excludeEnd("ctx");
 }));
 $recv(anIRAssignment)._replaceWith_(inlinedAssignment);
-self._inlineSend_($recv($recv(inlinedAssignment)._instructions())._last());
+self._inlineSend_($recv(inlinedAssignment)._right());
 return inlinedAssignment;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)});
@@ -2215,10 +2196,10 @@ return inlinedAssignment;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRAssignment"],
-source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment instructions do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment instructions last.\x0a\x09^ inlinedAssignment",
+source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment instructions do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment right.\x0a\x09^ inlinedAssignment",
 referencedClasses: ["IRInlinedAssignment"],
 //>>excludeEnd("ide");
-messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"]
+messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "right"]
 }),
 $globals.IRAssignmentInliner);
 
@@ -2232,7 +2213,7 @@ var inlinedClosure,statements;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $2,$1,$4,$3,$5,$7,$6;
+var $2,$1,$3,$5,$4;
 inlinedClosure=(
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.supercall = true,
@@ -2241,40 +2222,29 @@ $ctx1.supercall = true,
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.supercall = false;
 //>>excludeEnd("ctx");;
-$2=$recv(inlinedClosure)._instructions();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["instructions"]=2;
-//>>excludeEnd("ctx");
-$1=$recv($2)._last();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["last"]=1;
-//>>excludeEnd("ctx");
-statements=$recv($1)._instructions();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["instructions"]=1;
-//>>excludeEnd("ctx");
+statements=$recv($recv(inlinedClosure)._sequence())._instructions();
 $recv(statements)._ifNotEmpty_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-$4=$recv(statements)._last();
+$2=$recv(statements)._last();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx2.sendIdx["last"]=2;
+$ctx2.sendIdx["last"]=1;
 //>>excludeEnd("ctx");
-$3=$recv($4)._canBeAssigned();
-if($core.assert($3)){
-$5=$recv(statements)._last();
+$1=$recv($2)._canBeAssigned();
+if($core.assert($1)){
+$3=$recv(statements)._last();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx2.sendIdx["last"]=3;
+$ctx2.sendIdx["last"]=2;
 //>>excludeEnd("ctx");
-$7=$recv($globals.IRAssignment)._new();
-$recv($7)._add_($recv($recv(self._assignment())._instructions())._first());
+$5=$recv($globals.IRAssignment)._new();
+$recv($5)._add_($recv(self._assignment())._left());
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx2.sendIdx["add:"]=1;
 //>>excludeEnd("ctx");
-$recv($7)._add_($recv($recv(statements)._last())._copy());
-$6=$recv($7)._yourself();
-return $recv($5)._replaceWith_($6);
+$recv($5)._add_($recv($recv(statements)._last())._copy());
+$4=$recv($5)._yourself();
+return $recv($3)._replaceWith_($4);
 };
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
@@ -2287,10 +2257,10 @@ return inlinedClosure;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRClosure"],
-source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last canBeAssigned ifTrue: [\x0a\x09\x09\x09statements last replaceWith: (IRAssignment new\x0a\x09\x09\x09\x09add: self assignment instructions first;\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ inlinedClosure",
+source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure statements |\x0a\x0a\x09inlinedClosure := super inlineClosure: anIRClosure.\x0a\x09statements := inlinedClosure sequence instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last canBeAssigned ifTrue: [\x0a\x09\x09\x09statements last replaceWith: (IRAssignment new\x0a\x09\x09\x09\x09add: self assignment left;\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ inlinedClosure",
 referencedClasses: ["IRAssignment"],
 //>>excludeEnd("ide");
-messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"]
+messageSends: ["inlineClosure:", "instructions", "sequence", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "last", "replaceWith:", "add:", "new", "left", "assignment", "copy", "yourself"]
 }),
 $globals.IRAssignmentInliner);
 
@@ -2310,7 +2280,7 @@ var closure,statements;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) {
 //>>excludeEnd("ctx");
-var $1,$3,$2,$4,$6,$5;
+var $2,$1,$3,$5,$4;
 closure=(
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.supercall = true,
@@ -2319,32 +2289,25 @@ $ctx1.supercall = true,
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.supercall = false;
 //>>excludeEnd("ctx");;
-$1=$recv($recv(closure)._instructions())._last();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["last"]=1;
-//>>excludeEnd("ctx");
-statements=$recv($1)._instructions();
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx1.sendIdx["instructions"]=1;
-//>>excludeEnd("ctx");
+statements=$recv($recv(closure)._sequence())._instructions();
 $recv(statements)._ifNotEmpty_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-$3=$recv(statements)._last();
+$2=$recv(statements)._last();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx2.sendIdx["last"]=2;
+$ctx2.sendIdx["last"]=1;
 //>>excludeEnd("ctx");
-$2=$recv($3)._isReturn();
-if(!$core.assert($2)){
-$4=$recv(statements)._last();
+$1=$recv($2)._isReturn();
+if(!$core.assert($1)){
+$3=$recv(statements)._last();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-$ctx2.sendIdx["last"]=3;
+$ctx2.sendIdx["last"]=2;
 //>>excludeEnd("ctx");
-$6=$recv($globals.IRReturn)._new();
-$recv($6)._add_($recv($recv(statements)._last())._copy());
-$5=$recv($6)._yourself();
-return $recv($4)._replaceWith_($5);
+$5=$recv($globals.IRReturn)._new();
+$recv($5)._add_($recv($recv(statements)._last())._copy());
+$4=$recv($5)._yourself();
+return $recv($3)._replaceWith_($4);
 };
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
@@ -2357,10 +2320,10 @@ return closure;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRClosure"],
-source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure instructions last instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last isReturn\x0a\x09\x09\x09ifFalse: [ statements last replaceWith: (IRReturn new\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself)] ].\x0a\x0a\x09^ closure",
+source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure sequence instructions.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last isReturn\x0a\x09\x09\x09ifFalse: [ statements last replaceWith: (IRReturn new\x0a\x09\x09\x09\x09add: statements last copy;\x0a\x09\x09\x09\x09yourself)] ].\x0a\x0a\x09^ closure",
 referencedClasses: ["IRReturn"],
 //>>excludeEnd("ide");
-messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"]
+messageSends: ["inlineClosure:", "instructions", "sequence", "ifNotEmpty:", "ifFalse:", "isReturn", "last", "replaceWith:", "add:", "new", "copy", "yourself"]
 }),
 $globals.IRReturnInliner);
 

+ 16 - 16
src/Compiler-Inlining.st

@@ -194,8 +194,8 @@ sendInliner
 
 shouldInlineAssignment: anIRAssignment
 	^ anIRAssignment isInlined not and: [
-		anIRAssignment instructions last isSend and: [
-			self shouldInlineSend: (anIRAssignment instructions last) ]]
+		anIRAssignment right isSend and: [
+			self shouldInlineSend: anIRAssignment right ]]
 !
 
 shouldInlineReturn: anIRReturn
@@ -258,7 +258,7 @@ I am a specialized JavaScript translator able to write inlined IR instructions t
 !IRInliningJSTranslator methodsFor: 'visiting'!
 
 visitIRInlinedAssignment: anIRInlinedAssignment
-	self visit: anIRInlinedAssignment instructions last
+	self visit: anIRInlinedAssignment right
 !
 
 visitIRInlinedClosure: anIRInlinedClosure
@@ -378,7 +378,7 @@ ifNil: anIRInstruction
 		withBlock: (IRClosure new
 			scope: anIRInstruction scope copy;
 			add: (IRBlockSequence new
-				add: self send instructions first;
+				add: self send receiver;
 				yourself);
 			yourself)
 !
@@ -393,7 +393,7 @@ ifNotNil: anIRInstruction
 		withBlock: (IRClosure new
 			scope: anIRInstruction scope copy;
 			add: (IRBlockSequence new
-				add: self send instructions first;
+				add: self send receiver;
 				yourself);
 			yourself)
 		withBlock: anIRInstruction
@@ -438,7 +438,7 @@ inlineClosure: anIRClosure
 	inlinedClosure add: sequence.
 
 	"Get all the statements"
-	statements := anIRClosure instructions last instructions.
+	statements := anIRClosure sequence instructions.
 	
 	statements ifNotEmpty: [
 		statements allButLast do: [ :each | sequence add: each ].
@@ -455,7 +455,7 @@ inlineSend: anIRSend
 	self send: anIRSend.
 	^ self
 		perform: self send selector
-		withArguments: self send instructions allButFirst
+		withArguments: self send arguments
 !
 
 inlinedSend: inlinedSend withBlock: anIRInstruction
@@ -467,7 +467,7 @@ inlinedSend: inlinedSend withBlock: anIRInstruction
 	inlinedClosure := self translator visit: (self inlineClosure: anIRInstruction).
 
 	inlinedSend
-		add: self send instructions first;
+		add: self send receiver;
 		add: inlinedClosure.
 
 	self send replaceWith: inlinedSend.
@@ -487,7 +487,7 @@ inlinedSend: inlinedSend withBlock: anIRInstruction withBlock: anotherIRInstruct
 	inlinedClosure2 := self translator visit: (self inlineClosure: anotherIRInstruction).
 
 	inlinedSend
-		add: self send instructions first;
+		add: self send receiver;
 		add: inlinedClosure1;
 		add: inlinedClosure2.
 
@@ -504,9 +504,9 @@ inlinedSelectors
 	^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')
 !
 
-shouldInline: anIRInstruction
-	(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].
-	^ anIRInstruction instructions allButFirst allSatisfy: [ :each | each isClosure]
+shouldInline: anIRSend
+	(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].
+	^ anIRSend arguments allSatisfy: [ :each | each isClosure ]
 ! !
 
 IRSendInliner subclass: #IRAssignmentInliner
@@ -546,7 +546,7 @@ inlineAssignment: anIRAssignment
 	anIRAssignment instructions do: [ :each |
 		inlinedAssignment add: each ].
 	anIRAssignment replaceWith: inlinedAssignment.
-	self inlineSend: inlinedAssignment instructions last.
+	self inlineSend: inlinedAssignment right.
 	^ inlinedAssignment
 !
 
@@ -554,12 +554,12 @@ inlineClosure: anIRClosure
 	| inlinedClosure statements |
 
 	inlinedClosure := super inlineClosure: anIRClosure.
-	statements := inlinedClosure instructions last instructions.
+	statements := inlinedClosure sequence instructions.
 	
 	statements ifNotEmpty: [
 		statements last canBeAssigned ifTrue: [
 			statements last replaceWith: (IRAssignment new
-				add: self assignment instructions first;
+				add: self assignment left;
 				add: statements last copy;
 				yourself) ] ].
 
@@ -584,7 +584,7 @@ inlineClosure: anIRClosure
 	| closure statements |
 
 	closure := super inlineClosure: anIRClosure.
-	statements := closure instructions last instructions.
+	statements := closure sequence instructions.
 	
 	statements ifNotEmpty: [
 		statements last isReturn