Browse Source

Fixes inlining of #ifNil: and #ifNotNil:

The $receiver internal variable was not declared
Nicolas Petton 10 years ago
parent
commit
c06515a6bf
2 changed files with 248 additions and 173 deletions
  1. 214 163
      src/Compiler-Inlining.js
  2. 34 10
      src/Compiler-Inlining.st

+ 214 - 163
src/Compiler-Inlining.js

@@ -17,7 +17,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedAssignment)})},
 args: ["aVisitor"],
 source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
-messageSends: ["visitIRInlinedAssignment:"],
+messageSends: ["visitIRInlinedAssignment:", "accept:"],
 referencedClasses: []
 }),
 globals.IRInlinedAssignment);
@@ -32,7 +32,7 @@ return true;
 },
 args: [],
 source: "isInlined\x0a\x09^ true",
-messageSends: [],
+messageSends: ["isInlined"],
 referencedClasses: []
 }),
 globals.IRInlinedAssignment);
@@ -52,7 +52,7 @@ _st(aVisitor)._visitIRInlinedClosure_(self);
 return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedClosure)})},
 args: ["aVisitor"],
 source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
-messageSends: ["visitIRInlinedClosure:"],
+messageSends: ["visitIRInlinedClosure:", "accept:"],
 referencedClasses: []
 }),
 globals.IRInlinedClosure);
@@ -67,7 +67,7 @@ return true;
 },
 args: [],
 source: "isInlined\x0a\x09^ true",
-messageSends: [],
+messageSends: ["isInlined"],
 referencedClasses: []
 }),
 globals.IRInlinedClosure);
@@ -89,7 +89,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedReturn)})},
 args: ["aVisitor"],
 source: "accept: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
-messageSends: ["visitIRInlinedReturn:"],
+messageSends: ["visitIRInlinedReturn:", "accept:"],
 referencedClasses: []
 }),
 globals.IRInlinedReturn);
@@ -104,7 +104,7 @@ return true;
 },
 args: [],
 source: "isInlined\x0a\x09^ true",
-messageSends: [],
+messageSends: ["isInlined"],
 referencedClasses: []
 }),
 globals.IRInlinedReturn);
@@ -124,7 +124,24 @@ _st(aVisitor)._visitInlinedSend_(self);
 return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedSend)})},
 args: ["aVisitor"],
 source: "accept: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
-messageSends: ["visitInlinedSend:"],
+messageSends: ["visitInlinedSend:", "accept:"],
+referencedClasses: []
+}),
+globals.IRInlinedSend);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "internalVariables",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=[];
+return $1;
+},
+args: [],
+source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
+messageSends: ["internalVariables"],
 referencedClasses: []
 }),
 globals.IRInlinedSend);
@@ -139,7 +156,7 @@ return true;
 },
 args: [],
 source: "isInlined\x0a\x09^ true",
-messageSends: [],
+messageSends: ["isInlined"],
 referencedClasses: []
 }),
 globals.IRInlinedSend);
@@ -159,7 +176,7 @@ _st(aVisitor)._visitIRInlinedIfFalse_(self);
 return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfFalse)})},
 args: ["aVisitor"],
 source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
-messageSends: ["visitIRInlinedIfFalse:"],
+messageSends: ["visitIRInlinedIfFalse:", "accept:"],
 referencedClasses: []
 }),
 globals.IRInlinedIfFalse);
@@ -179,7 +196,65 @@ _st(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
 return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfNilIfNotNil)})},
 args: ["aVisitor"],
 source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
-messageSends: ["visitIRInlinedIfNilIfNotNil:"],
+messageSends: ["visitIRInlinedIfNilIfNotNil:", "accept:"],
+referencedClasses: []
+}),
+globals.IRInlinedIfNilIfNotNil);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "internalVariables",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $Array(){return globals.Array||(typeof Array=="undefined"?nil:Array)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st($Array())._with_(self._receiverInternalVariable());
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"internalVariables",{},globals.IRInlinedIfNilIfNotNil)})},
+args: [],
+source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
+messageSends: ["with:", "receiverInternalVariable", "internalVariables"],
+referencedClasses: ["Array"]
+}),
+globals.IRInlinedIfNilIfNotNil);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiverInternalVariable",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
+function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$3,$1;
+$2=_st($IRVariable())._new();
+$ctx1.sendIdx["new"]=1;
+_st($2)._variable_(_st(_st($AliasVar())._new())._name_(self._receiverInternalVariableName()));
+$3=_st($2)._yourself();
+$1=$3;
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},globals.IRInlinedIfNilIfNotNil)})},
+args: [],
+source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
+messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself", "receiverInternalVariable"],
+referencedClasses: ["IRVariable", "AliasVar"]
+}),
+globals.IRInlinedIfNilIfNotNil);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "receiverInternalVariableName",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return "$receiver";
+},
+args: [],
+source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
+messageSends: ["receiverInternalVariableName"],
 referencedClasses: []
 }),
 globals.IRInlinedIfNilIfNotNil);
@@ -199,7 +274,7 @@ _st(aVisitor)._visitIRInlinedIfTrue_(self);
 return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfTrue)})},
 args: ["aVisitor"],
 source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
-messageSends: ["visitIRInlinedIfTrue:"],
+messageSends: ["visitIRInlinedIfTrue:", "accept:"],
 referencedClasses: []
 }),
 globals.IRInlinedIfTrue);
@@ -219,7 +294,7 @@ _st(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
 return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedIfTrueIfFalse)})},
 args: ["aVisitor"],
 source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
-messageSends: ["visitIRInlinedIfTrueIfFalse:"],
+messageSends: ["visitIRInlinedIfTrueIfFalse:", "accept:"],
 referencedClasses: []
 }),
 globals.IRInlinedIfTrueIfFalse);
@@ -239,7 +314,7 @@ _st(aVisitor)._visitIRInlinedSequence_(self);
 return self}, function($ctx1) {$ctx1.fill(self,"accept:",{aVisitor:aVisitor},globals.IRInlinedSequence)})},
 args: ["aVisitor"],
 source: "accept: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
-messageSends: ["visitIRInlinedSequence:"],
+messageSends: ["visitIRInlinedSequence:", "accept:"],
 referencedClasses: []
 }),
 globals.IRInlinedSequence);
@@ -254,7 +329,7 @@ return true;
 },
 args: [],
 source: "isInlined\x0a\x09^ true",
-messageSends: [],
+messageSends: ["isInlined"],
 referencedClasses: []
 }),
 globals.IRInlinedSequence);
@@ -280,7 +355,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},globals.IRInliner)})},
 args: [],
 source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
-messageSends: ["translator:", "new", "yourself"],
+messageSends: ["translator:", "new", "yourself", "assignmentInliner"],
 referencedClasses: ["IRAssignmentInliner"]
 }),
 globals.IRInliner);
@@ -302,7 +377,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},globals.IRInliner)})},
 args: [],
 source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
-messageSends: ["translator:", "new", "yourself"],
+messageSends: ["translator:", "new", "yourself", "returnInliner"],
 referencedClasses: ["IRReturnInliner"]
 }),
 globals.IRInliner);
@@ -324,7 +399,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},globals.IRInliner)})},
 args: [],
 source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
-messageSends: ["translator:", "new", "yourself"],
+messageSends: ["translator:", "new", "yourself", "sendInliner"],
 referencedClasses: ["IRSendInliner"]
 }),
 globals.IRInliner);
@@ -354,7 +429,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},globals.IRInliner)})},
 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) ]]",
-messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:"],
+messageSends: ["and:", "not", "isInlined", "isSend", "last", "instructions", "shouldInlineSend:", "shouldInlineAssignment:"],
 referencedClasses: []
 }),
 globals.IRInliner);
@@ -384,7 +459,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},globals.IRInliner)})},
 args: ["anIRReturn"],
 source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn instructions first isSend and: [\x0a\x09\x09\x09self shouldInlineSend: (anIRReturn instructions first) ]]",
-messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:"],
+messageSends: ["and:", "not", "isInlined", "isSend", "first", "instructions", "shouldInlineSend:", "shouldInlineReturn:"],
 referencedClasses: []
 }),
 globals.IRInliner);
@@ -406,7 +481,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},globals.IRInliner)})},
 args: ["anIRSend"],
 source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
-messageSends: ["and:", "not", "isInlined", "shouldInline:"],
+messageSends: ["and:", "not", "isInlined", "shouldInline:", "shouldInlineSend:"],
 referencedClasses: ["IRSendInliner"]
 }),
 globals.IRInliner);
@@ -449,7 +524,7 @@ return $9;
 }, function($ctx1) {$ctx1.fill(self,"transformNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},globals.IRInliner)})},
 args: ["anIRNonLocalReturn"],
 source: "transformNonLocalReturn: anIRNonLocalReturn\x0a\x09\x22Replace a non local return into a local return\x22\x0a\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [\x0a\x09\x09anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.\x0a\x09\x09localReturn := IRReturn new\x0a\x09\x09\x09scope: anIRNonLocalReturn scope;\x0a\x09\x09\x09yourself.\x0a\x09\x09anIRNonLocalReturn instructions do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ localReturn ].\x0a\x09^ super visitIRNonLocalReturn: anIRNonLocalReturn",
-messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:"],
+messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "instructions", "add:", "replaceWith:", "visitIRNonLocalReturn:", "transformNonLocalReturn:"],
 referencedClasses: ["IRReturn"]
 }),
 globals.IRInliner);
@@ -472,7 +547,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},globals.IRInliner)})},
 args: ["anIRAssignment"],
 source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
-messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"],
+messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:", "visitIRAssignment:"],
 referencedClasses: []
 }),
 globals.IRInliner);
@@ -490,7 +565,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},globals.IRInliner)})},
 args: ["anIRNonLocalReturn"],
 source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self transformNonLocalReturn: anIRNonLocalReturn",
-messageSends: ["transformNonLocalReturn:"],
+messageSends: ["transformNonLocalReturn:", "visitIRNonLocalReturn:"],
 referencedClasses: []
 }),
 globals.IRInliner);
@@ -513,7 +588,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},globals.IRInliner)})},
 args: ["anIRReturn"],
 source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
-messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"],
+messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:", "visitIRReturn:"],
 referencedClasses: []
 }),
 globals.IRInliner);
@@ -536,7 +611,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},globals.IRInliner)})},
 args: ["anIRSend"],
 source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
-messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"],
+messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:", "visitIRSend:"],
 referencedClasses: []
 }),
 globals.IRInliner);
@@ -556,7 +631,7 @@ self._visit_(_st(_st(anIRInlinedAssignment)._instructions())._last());
 return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},globals.IRInliningJSTranslator)})},
 args: ["anIRInlinedAssignment"],
 source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment instructions last",
-messageSends: ["visit:", "last", "instructions"],
+messageSends: ["visit:", "last", "instructions", "visitIRInlinedAssignment:"],
 referencedClasses: []
 }),
 globals.IRInliningJSTranslator);
@@ -579,7 +654,7 @@ return self._visit_(each);
 return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},globals.IRInliningJSTranslator)})},
 args: ["anIRInlinedClosure"],
 source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09anIRInlinedClosure instructions do: [ :each |\x0a\x09\x09self visit: each ]",
-messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:"],
+messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "do:", "instructions", "visit:", "visitIRInlinedClosure:"],
 referencedClasses: []
 }),
 globals.IRInliningJSTranslator);
@@ -613,41 +688,7 @@ return self._visit_(_st(_st(anIRInlinedIfFalse)._instructions())._last());
 return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},globals.IRInliningJSTranslator)})},
 args: ["anIRInlinedIfFalse"],
 source: "visitIRInlinedIfFalse: anIRInlinedIfFalse\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '! smalltalk.assert('.\x0a\x09\x09self visit: anIRInlinedIfFalse instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfFalse instructions last ]",
-messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
-referencedClasses: []
-}),
-globals.IRInliningJSTranslator);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "visitIRInlinedIfNil:",
-protocol: 'visiting',
-fn: function (anIRInlinedIfNil){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$4,$3;
-$1=self._stream();
-$ctx1.sendIdx["stream"]=1;
-_st($1)._nextPutIf_with_((function(){
-return smalltalk.withContext(function($ctx2) {
-$2=self._stream();
-$ctx2.sendIdx["stream"]=2;
-_st($2)._nextPutAll_("($receiver = ");
-$ctx2.sendIdx["nextPutAll:"]=1;
-$4=_st(anIRInlinedIfNil)._instructions();
-$ctx2.sendIdx["instructions"]=1;
-$3=_st($4)._first();
-self._visit_($3);
-$ctx2.sendIdx["visit:"]=1;
-return _st(self._stream())._nextPutAll_(") == nil || $receiver == null");
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
-return smalltalk.withContext(function($ctx2) {
-return self._visit_(_st(_st(anIRInlinedIfNil)._instructions())._last());
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
-return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNil:",{anIRInlinedIfNil:anIRInlinedIfNil},globals.IRInliningJSTranslator)})},
-args: ["anIRInlinedIfNil"],
-source: "visitIRInlinedIfNil: anIRInlinedIfNil\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: '($receiver = '.\x0a\x09\x09self visit: anIRInlinedIfNil instructions first.\x0a\x09\x09self stream nextPutAll: ') == nil || $receiver == null' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNil instructions last ]",
-messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
+messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last", "visitIRInlinedIfFalse:"],
 referencedClasses: []
 }),
 globals.IRInliningJSTranslator);
@@ -659,27 +700,29 @@ protocol: 'visiting',
 fn: function (anIRInlinedIfNilIfNotNil){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$4,$3,$6,$5;
+var $1,$2,$3,$5,$4,$7,$6;
 $1=self._stream();
 $ctx1.sendIdx["stream"]=1;
 _st($1)._nextPutIfElse_with_with_((function(){
 return smalltalk.withContext(function($ctx2) {
 $2=self._stream();
 $ctx2.sendIdx["stream"]=2;
-_st($2)._nextPutAll_("($receiver = ");
+$3=_st("(".__comma(_st(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName())).__comma(" = ");
+$ctx2.sendIdx[","]=1;
+_st($2)._nextPutAll_($3);
 $ctx2.sendIdx["nextPutAll:"]=1;
-$4=_st(anIRInlinedIfNilIfNotNil)._instructions();
+$5=_st(anIRInlinedIfNilIfNotNil)._instructions();
 $ctx2.sendIdx["instructions"]=1;
-$3=_st($4)._first();
-self._visit_($3);
+$4=_st($5)._first();
+self._visit_($4);
 $ctx2.sendIdx["visit:"]=1;
 return _st(self._stream())._nextPutAll_(") == nil || $receiver == null");
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),(function(){
 return smalltalk.withContext(function($ctx2) {
-$6=_st(anIRInlinedIfNilIfNotNil)._instructions();
+$7=_st(anIRInlinedIfNilIfNotNil)._instructions();
 $ctx2.sendIdx["instructions"]=2;
-$5=_st($6)._second();
-return self._visit_($5);
+$6=_st($7)._second();
+return self._visit_($6);
 $ctx2.sendIdx["visit:"]=2;
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),(function(){
 return smalltalk.withContext(function($ctx2) {
@@ -687,8 +730,8 @@ return self._visit_(_st(_st(anIRInlinedIfNilIfNotNil)._instructions())._third())
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
 return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},globals.IRInliningJSTranslator)})},
 args: ["anIRInlinedIfNilIfNotNil"],
-source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '($receiver = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == nil || $receiver == null' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
-messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"],
+source: "visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: '(', anIRInlinedIfNilIfNotNil receiverInternalVariableName, ' = '.\x0a\x09\x09\x09self visit: anIRInlinedIfNilIfNotNil instructions first.\x0a\x09\x09\x09self stream nextPutAll: ') == nil || $receiver == null' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfNilIfNotNil instructions third ]",
+messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", ",", "receiverInternalVariableName", "visit:", "first", "instructions", "second", "third", "visitIRInlinedIfNilIfNotNil:"],
 referencedClasses: []
 }),
 globals.IRInliningJSTranslator);
@@ -722,7 +765,7 @@ return self._visit_(_st(_st(anIRInlinedIfTrue)._instructions())._last());
 return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},globals.IRInliningJSTranslator)})},
 args: ["anIRInlinedIfTrue"],
 source: "visitIRInlinedIfTrue: anIRInlinedIfTrue\x0a\x09self stream nextPutIf: [\x0a\x09\x09self stream nextPutAll: 'smalltalk.assert('.\x0a\x09\x09self visit: anIRInlinedIfTrue instructions first.\x0a\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrue instructions last ]",
-messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last"],
+messageSends: ["nextPutIf:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "last", "visitIRInlinedIfTrue:"],
 referencedClasses: []
 }),
 globals.IRInliningJSTranslator);
@@ -763,7 +806,7 @@ return self._visit_(_st(_st(anIRInlinedIfTrueIfFalse)._instructions())._third())
 return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},globals.IRInliningJSTranslator)})},
 args: ["anIRInlinedIfTrueIfFalse"],
 source: "visitIRInlinedIfTrueIfFalse: anIRInlinedIfTrueIfFalse\x0a\x09self stream\x0a\x09\x09nextPutIfElse: [\x0a\x09\x09\x09self stream nextPutAll: 'smalltalk.assert('.\x0a\x09\x09\x09self visit: anIRInlinedIfTrueIfFalse instructions first.\x0a\x09\x09\x09self stream nextPutAll: ')' ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions second ]\x0a\x09\x09with: [ self visit: anIRInlinedIfTrueIfFalse instructions third ]",
-messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third"],
+messageSends: ["nextPutIfElse:with:with:", "stream", "nextPutAll:", "visit:", "first", "instructions", "second", "third", "visitIRInlinedIfTrueIfFalse:"],
 referencedClasses: []
 }),
 globals.IRInliningJSTranslator);
@@ -787,7 +830,7 @@ _st(self._stream())._nextPutNonLocalReturnWith_((function(){
 return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedNonLocalReturn:",{anIRInlinedReturn:anIRInlinedReturn},globals.IRInliningJSTranslator)})},
 args: ["anIRInlinedReturn"],
 source: "visitIRInlinedNonLocalReturn: anIRInlinedReturn\x0a\x09self stream nextPutStatementWith: [\x0a\x09\x09self visit: anIRInlinedReturn instructions last ].\x0a\x09self stream nextPutNonLocalReturnWith: [ ]",
-messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:"],
+messageSends: ["nextPutStatementWith:", "stream", "visit:", "last", "instructions", "nextPutNonLocalReturnWith:", "visitIRInlinedNonLocalReturn:"],
 referencedClasses: []
 }),
 globals.IRInliningJSTranslator);
@@ -803,7 +846,7 @@ self._visit_(_st(_st(anIRInlinedReturn)._instructions())._last());
 return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},globals.IRInliningJSTranslator)})},
 args: ["anIRInlinedReturn"],
 source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn instructions last",
-messageSends: ["visit:", "last", "instructions"],
+messageSends: ["visit:", "last", "instructions", "visitIRInlinedReturn:"],
 referencedClasses: []
 }),
 globals.IRInliningJSTranslator);
@@ -825,7 +868,7 @@ return self._visit_(each);
 return self}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},globals.IRInliningJSTranslator)})},
 args: ["anIRInlinedSequence"],
 source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09anIRInlinedSequence instructions do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ]]",
-messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:"],
+messageSends: ["do:", "instructions", "nextPutStatementWith:", "stream", "visit:", "visitIRInlinedSequence:"],
 referencedClasses: []
 }),
 globals.IRInliningJSTranslator);
@@ -848,7 +891,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
 args: ["anIRInstruction"],
 source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new with: anIRInstruction",
-messageSends: ["inlinedSend:with:", "new"],
+messageSends: ["inlinedSend:with:", "new", "ifFalse:"],
 referencedClasses: ["IRInlinedIfFalse"]
 }),
 globals.IRSendInliner);
@@ -866,7 +909,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
 args: ["anIRInstruction", "anotherIRInstruction"],
 source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
-messageSends: ["perform:withArguments:"],
+messageSends: ["perform:withArguments:", "ifFalse:ifTrue:"],
 referencedClasses: []
 }),
 globals.IRSendInliner);
@@ -902,7 +945,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
 args: ["anIRInstruction"],
 source: "ifNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: anIRInstruction\x0a\x09\x09with: (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)",
-messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
+messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself", "ifNil:"],
 referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
 }),
 globals.IRSendInliner);
@@ -921,7 +964,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
 args: ["anIRInstruction", "anotherIRInstruction"],
 source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anIRInstruction with: anotherIRInstruction",
-messageSends: ["inlinedSend:with:with:", "new"],
+messageSends: ["inlinedSend:with:with:", "new", "ifNil:ifNotNil:"],
 referencedClasses: ["IRInlinedIfNilIfNotNil"]
 }),
 globals.IRSendInliner);
@@ -957,7 +1000,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
 args: ["anIRInstruction"],
 source: "ifNotNil: anIRInstruction\x0a\x09^ self\x0a\x09\x09inlinedSend: IRInlinedIfNilIfNotNil new\x0a\x09\x09with: (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\x09with: anIRInstruction",
-messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself"],
+messageSends: ["inlinedSend:with:with:", "new", "scope:", "copy", "scope", "add:", "first", "instructions", "send", "yourself", "ifNotNil:"],
 referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"]
 }),
 globals.IRSendInliner);
@@ -976,7 +1019,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
 args: ["anIRInstruction", "anotherIRInstruction"],
 source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new with: anotherIRInstruction with: anIRInstruction",
-messageSends: ["inlinedSend:with:with:", "new"],
+messageSends: ["inlinedSend:with:with:", "new", "ifNotNil:ifNil:"],
 referencedClasses: ["IRInlinedIfNilIfNotNil"]
 }),
 globals.IRSendInliner);
@@ -995,7 +1038,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},globals.IRSendInliner)})},
 args: ["anIRInstruction"],
 source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new with: anIRInstruction",
-messageSends: ["inlinedSend:with:", "new"],
+messageSends: ["inlinedSend:with:", "new", "ifTrue:"],
 referencedClasses: ["IRInlinedIfTrue"]
 }),
 globals.IRSendInliner);
@@ -1014,7 +1057,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},globals.IRSendInliner)})},
 args: ["anIRInstruction", "anotherIRInstruction"],
 source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new with: anIRInstruction with: anotherIRInstruction",
-messageSends: ["inlinedSend:with:with:", "new"],
+messageSends: ["inlinedSend:with:with:", "new", "ifTrue:ifFalse:"],
 referencedClasses: ["IRInlinedIfTrueIfFalse"]
 }),
 globals.IRSendInliner);
@@ -1031,13 +1074,15 @@ function $IRAssignment(){return globals.IRAssignment||(typeof IRAssignment=="und
 function $IRVariable(){return globals.IRVariable||(typeof IRVariable=="undefined"?nil:IRVariable)}
 function $AliasVar(){return globals.AliasVar||(typeof AliasVar=="undefined"?nil:AliasVar)}
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3,$5,$6,$4,$7,$9,$10,$12,$14,$15,$16,$17,$13,$11,$18,$20,$22,$23,$21,$19,$24,$8,$26,$25,$29,$28,$30,$27,$31,$34,$33,$32,$35;
+var $1,$2,$3,$4,$5,$7,$8,$6,$9,$11,$12,$14,$16,$17,$18,$19,$15,$13,$20,$22,$24,$25,$23,$21,$26,$10,$28,$27,$31,$30,$32,$29,$33,$36,$35,$34,$37;
 inlinedClosure=self._inlinedClosure();
 $1=inlinedClosure;
-$2=_st(anIRClosure)._scope();
+$2=$1;
+$3=_st(anIRClosure)._scope();
 $ctx1.sendIdx["scope"]=1;
-_st($1)._scope_($2);
+_st($2)._scope_($3);
 $ctx1.sendIdx["scope:"]=1;
+$4=_st($1)._parent_(_st(anIRClosure)._parent());
 _st(_st(anIRClosure)._tempDeclarations())._do_((function(each){
 return smalltalk.withContext(function($ctx2) {
 return _st(inlinedClosure)._add_(each);
@@ -1047,63 +1092,63 @@ $ctx1.sendIdx["do:"]=1;
 sequence=self._inlinedSequence();
 _st(_st(anIRClosure)._arguments())._do_((function(each){
 return smalltalk.withContext(function($ctx2) {
-$3=inlinedClosure;
-$5=_st($IRTempDeclaration())._new();
+$5=inlinedClosure;
+$7=_st($IRTempDeclaration())._new();
 $ctx2.sendIdx["new"]=1;
-_st($5)._name_(each);
+_st($7)._name_(each);
 $ctx2.sendIdx["name:"]=1;
-$6=_st($5)._yourself();
+$8=_st($7)._yourself();
 $ctx2.sendIdx["yourself"]=1;
-$4=$6;
-_st($3)._add_($4);
+$6=$8;
+_st($5)._add_($6);
 $ctx2.sendIdx["add:"]=2;
-$7=sequence;
-$9=_st($IRAssignment())._new();
+$9=sequence;
+$11=_st($IRAssignment())._new();
 $ctx2.sendIdx["new"]=2;
-$10=$9;
-$12=_st($IRVariable())._new();
+$12=$11;
+$14=_st($IRVariable())._new();
 $ctx2.sendIdx["new"]=3;
-$14=_st($AliasVar())._new();
+$16=_st($AliasVar())._new();
 $ctx2.sendIdx["new"]=4;
-$15=$14;
-$16=_st(inlinedClosure)._scope();
+$17=$16;
+$18=_st(inlinedClosure)._scope();
 $ctx2.sendIdx["scope"]=2;
-_st($15)._scope_($16);
+_st($17)._scope_($18);
 $ctx2.sendIdx["scope:"]=2;
-_st($14)._name_(each);
+_st($16)._name_(each);
 $ctx2.sendIdx["name:"]=2;
-$17=_st($14)._yourself();
+$19=_st($16)._yourself();
 $ctx2.sendIdx["yourself"]=2;
-$13=$17;
-$11=_st($12)._variable_($13);
+$15=$19;
+$13=_st($14)._variable_($15);
 $ctx2.sendIdx["variable:"]=1;
-_st($10)._add_($11);
+_st($12)._add_($13);
 $ctx2.sendIdx["add:"]=4;
-$18=$9;
-$20=_st($IRVariable())._new();
+$20=$11;
+$22=_st($IRVariable())._new();
 $ctx2.sendIdx["new"]=5;
-$22=_st($AliasVar())._new();
-_st($22)._scope_(_st(inlinedClosure)._scope());
-_st($22)._name_("$receiver");
-$23=_st($22)._yourself();
+$24=_st($AliasVar())._new();
+_st($24)._scope_(_st(inlinedClosure)._scope());
+_st($24)._name_("$receiver");
+$25=_st($24)._yourself();
 $ctx2.sendIdx["yourself"]=3;
-$21=$23;
-$19=_st($20)._variable_($21);
-_st($18)._add_($19);
+$23=$25;
+$21=_st($22)._variable_($23);
+_st($20)._add_($21);
 $ctx2.sendIdx["add:"]=5;
-$24=_st($9)._yourself();
-$8=$24;
-return _st($7)._add_($8);
+$26=_st($11)._yourself();
+$10=$26;
+return _st($9)._add_($10);
 $ctx2.sendIdx["add:"]=3;
 }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
 $ctx1.sendIdx["do:"]=2;
 _st(inlinedClosure)._add_(sequence);
 $ctx1.sendIdx["add:"]=6;
-$26=_st(anIRClosure)._instructions();
+$28=_st(anIRClosure)._instructions();
 $ctx1.sendIdx["instructions"]=2;
-$25=_st($26)._last();
+$27=_st($28)._last();
 $ctx1.sendIdx["last"]=1;
-statements=_st($25)._instructions();
+statements=_st($27)._instructions();
 $ctx1.sendIdx["instructions"]=1;
 _st(statements)._ifNotEmpty_((function(){
 return smalltalk.withContext(function($ctx2) {
@@ -1112,33 +1157,33 @@ return smalltalk.withContext(function($ctx3) {
 return _st(sequence)._add_(each);
 $ctx3.sendIdx["add:"]=7;
 }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)})}));
-$29=_st(statements)._last();
+$31=_st(statements)._last();
 $ctx2.sendIdx["last"]=2;
-$28=_st($29)._isReturn();
-$27=_st($28)._and_((function(){
+$30=_st($31)._isReturn();
+$29=_st($30)._and_((function(){
 return smalltalk.withContext(function($ctx3) {
-$30=_st(statements)._last();
+$32=_st(statements)._last();
 $ctx3.sendIdx["last"]=3;
-return _st($30)._isBlockReturn();
+return _st($32)._isBlockReturn();
 }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)})}));
-if(smalltalk.assert($27)){
-$31=sequence;
-$34=_st(statements)._last();
+if(smalltalk.assert($29)){
+$33=sequence;
+$36=_st(statements)._last();
 $ctx2.sendIdx["last"]=4;
-$33=_st($34)._instructions();
-$32=_st($33)._first();
-return _st($31)._add_($32);
+$35=_st($36)._instructions();
+$34=_st($35)._first();
+return _st($33)._add_($34);
 $ctx2.sendIdx["add:"]=8;
 } else {
 return _st(sequence)._add_(_st(statements)._last());
 };
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
-$35=inlinedClosure;
-return $35;
+$37=inlinedClosure;
+return $37;
 }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},globals.IRSendInliner)})},
 args: ["anIRClosure"],
-source: "inlineClosure: anIRClosure\x0a\x09| inlinedClosure sequence statements |\x0a\x0a\x09inlinedClosure := self inlinedClosure.\x0a\x09inlinedClosure scope: anIRClosure scope.\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",
-messageSends: ["inlinedClosure", "scope:", "scope", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "instructions", "last", "ifNotEmpty:", "allButLast", "ifTrue:ifFalse:", "and:", "isReturn", "isBlockReturn", "first"],
+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",
+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", "inlineClosure:"],
 referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"]
 }),
 globals.IRSendInliner);
@@ -1160,7 +1205,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},globals.IRSendInliner)})},
 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",
-messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions"],
+messageSends: ["send:", "perform:withArguments:", "selector", "send", "allButFirst", "instructions", "inlineSend:"],
 referencedClasses: []
 }),
 globals.IRSendInliner);
@@ -1179,7 +1224,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},globals.IRSendInliner)})},
 args: [],
 source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
-messageSends: ["new"],
+messageSends: ["new", "inlinedClosure"],
 referencedClasses: ["IRInlinedClosure"]
 }),
 globals.IRSendInliner);
@@ -1192,7 +1237,7 @@ fn: function (inlinedSend,anIRInstruction){
 var self=this;
 var inlinedClosure;
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$5,$4,$3,$6;
+var $1,$2,$5,$4,$3,$6,$7;
 $1=_st(anIRInstruction)._isClosure();
 if(! smalltalk.assert($1)){
 self._inliningError_("Message argument should be a block");
@@ -1211,11 +1256,14 @@ _st(inlinedSend)._add_($3);
 $ctx1.sendIdx["add:"]=1;
 $6=_st(inlinedSend)._add_(inlinedClosure);
 _st(self._send())._replaceWith_(inlinedSend);
+$7=_st(_st(inlinedSend)._method())._internalVariables();
+$ctx1.sendIdx["internalVariables"]=1;
+_st($7)._addAll_(_st(inlinedSend)._internalVariables());
 return inlinedSend;
 }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},globals.IRSendInliner)})},
 args: ["inlinedSend", "anIRInstruction"],
-source: "inlinedSend: inlinedSend with: 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\x0a\x09^ inlinedSend",
-messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:"],
+source: "inlinedSend: inlinedSend with: 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",
+messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method", "inlinedSend:with:"],
 referencedClasses: []
 }),
 globals.IRSendInliner);
@@ -1228,7 +1276,7 @@ fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
 var self=this;
 var inlinedClosure1,inlinedClosure2;
 return smalltalk.withContext(function($ctx1) { 
-var $1,$2,$3,$4,$7,$6,$5,$8;
+var $1,$2,$3,$4,$7,$6,$5,$8,$9;
 $1=_st(anIRInstruction)._isClosure();
 $ctx1.sendIdx["isClosure"]=1;
 if(! smalltalk.assert($1)){
@@ -1256,11 +1304,14 @@ _st(inlinedSend)._add_(inlinedClosure1);
 $ctx1.sendIdx["add:"]=2;
 $8=_st(inlinedSend)._add_(inlinedClosure2);
 _st(self._send())._replaceWith_(inlinedSend);
+$9=_st(_st(inlinedSend)._method())._internalVariables();
+$ctx1.sendIdx["internalVariables"]=1;
+_st($9)._addAll_(_st(inlinedSend)._internalVariables());
 return inlinedSend;
 }, function($ctx1) {$ctx1.fill(self,"inlinedSend:with:with:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},globals.IRSendInliner)})},
 args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
-source: "inlinedSend: inlinedSend with: anIRInstruction with: 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\x09^ inlinedSend",
-messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:"],
+source: "inlinedSend: inlinedSend with: anIRInstruction with: 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",
+messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "first", "instructions", "send", "replaceWith:", "addAll:", "internalVariables", "method", "inlinedSend:with:with:"],
 referencedClasses: []
 }),
 globals.IRSendInliner);
@@ -1279,7 +1330,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},globals.IRSendInliner)})},
 args: [],
 source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
-messageSends: ["new"],
+messageSends: ["new", "inlinedSequence"],
 referencedClasses: ["IRInlinedSequence"]
 }),
 globals.IRSendInliner);
@@ -1296,7 +1347,7 @@ _st($InliningError())._signal_(aString);
 return self}, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},globals.IRSendInliner)})},
 args: ["aString"],
 source: "inliningError: aString\x0a\x09InliningError signal: aString",
-messageSends: ["signal:"],
+messageSends: ["signal:", "inliningError:"],
 referencedClasses: ["InliningError"]
 }),
 globals.IRSendInliner);
@@ -1313,7 +1364,7 @@ return $1;
 },
 args: [],
 source: "send\x0a\x09^ send",
-messageSends: [],
+messageSends: ["send"],
 referencedClasses: []
 }),
 globals.IRSendInliner);
@@ -1328,7 +1379,7 @@ self["@send"]=anIRSend;
 return self},
 args: ["anIRSend"],
 source: "send: anIRSend\x0a\x09send := anIRSend",
-messageSends: [],
+messageSends: ["send:"],
 referencedClasses: []
 }),
 globals.IRSendInliner);
@@ -1345,7 +1396,7 @@ return $1;
 },
 args: [],
 source: "translator\x0a\x09^ translator",
-messageSends: [],
+messageSends: ["translator"],
 referencedClasses: []
 }),
 globals.IRSendInliner);
@@ -1360,7 +1411,7 @@ self["@translator"]=anASTTranslator;
 return self},
 args: ["anASTTranslator"],
 source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
-messageSends: [],
+messageSends: ["translator:"],
 referencedClasses: []
 }),
 globals.IRSendInliner);
@@ -1378,7 +1429,7 @@ return $1;
 },
 args: [],
 source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
-messageSends: [],
+messageSends: ["inlinedSelectors"],
 referencedClasses: []
 }),
 globals.IRSendInliner.klass);
@@ -1410,7 +1461,7 @@ catch(e) {if(e===$early)return e[0]; throw e}
 }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRInstruction:anIRInstruction},globals.IRSendInliner.klass)})},
 args: ["anIRInstruction"],
 source: "shouldInline: anIRInstruction\x0a\x09(self inlinedSelectors includes: anIRInstruction selector) ifFalse: [ ^ false ].\x0a\x09anIRInstruction instructions allButFirst do: [ :each |\x0a\x09\x09each isClosure ifFalse: [ ^ false ]].\x0a\x09^ true",
-messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "do:", "allButFirst", "instructions", "isClosure"],
+messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "do:", "allButFirst", "instructions", "isClosure", "shouldInline:"],
 referencedClasses: []
 }),
 globals.IRSendInliner.klass);
@@ -1430,7 +1481,7 @@ return $1;
 },
 args: [],
 source: "assignment\x0a\x09^ assignment",
-messageSends: [],
+messageSends: ["assignment"],
 referencedClasses: []
 }),
 globals.IRAssignmentInliner);
@@ -1445,7 +1496,7 @@ self["@assignment"]=aNode;
 return self},
 args: ["aNode"],
 source: "assignment: aNode\x0a\x09assignment := aNode",
-messageSends: [],
+messageSends: ["assignment:"],
 referencedClasses: []
 }),
 globals.IRAssignmentInliner);
@@ -1475,7 +1526,7 @@ return $2;
 }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},globals.IRAssignmentInliner)})},
 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",
-messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"],
+messageSends: ["assignment:", "new", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last", "inlineAssignment:"],
 referencedClasses: ["IRInlinedAssignment"]
 }),
 globals.IRAssignmentInliner);
@@ -1519,7 +1570,7 @@ return $9;
 }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,statements:statements},globals.IRAssignmentInliner)})},
 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",
-messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself"],
+messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifTrue:", "canBeAssigned", "replaceWith:", "add:", "new", "first", "assignment", "copy", "yourself", "inlineClosure:"],
 referencedClasses: ["IRAssignment"]
 }),
 globals.IRAssignmentInliner);
@@ -1562,7 +1613,7 @@ return $7;
 }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},globals.IRReturnInliner)})},
 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",
-messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself"],
+messageSends: ["inlineClosure:", "instructions", "last", "ifNotEmpty:", "ifFalse:", "isReturn", "replaceWith:", "add:", "new", "copy", "yourself", "inlineClosure:"],
 referencedClasses: ["IRReturn"]
 }),
 globals.IRReturnInliner);
@@ -1590,7 +1641,7 @@ return $2;
 }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},globals.IRReturnInliner)})},
 args: ["anIRReturn"],
 source: "inlineReturn: anIRReturn\x0a\x09| return |\x0a\x09return := self inlinedReturn.\x0a\x09anIRReturn instructions do: [ :each |\x0a\x09\x09return add: each ].\x0a\x09anIRReturn replaceWith: return.\x0a\x09self inlineSend: return instructions last.\x0a\x09^ return",
-messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last"],
+messageSends: ["inlinedReturn", "do:", "instructions", "add:", "replaceWith:", "inlineSend:", "last", "inlineReturn:"],
 referencedClasses: []
 }),
 globals.IRReturnInliner);
@@ -1609,7 +1660,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},globals.IRReturnInliner)})},
 args: [],
 source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
-messageSends: ["new"],
+messageSends: ["new", "inlinedReturn"],
 referencedClasses: ["IRInlinedReturn"]
 }),
 globals.IRReturnInliner);
@@ -1642,7 +1693,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,ir:ir,stream:stream},globals.InliningCodeGenerator)})},
 args: ["aNode"],
 source: "compileNode: aNode\x0a\x09| ir stream |\x0a\x0a\x09self semanticAnalyzer visit: aNode.\x0a\x09ir := self translator visit: aNode.\x0a\x09self inliner visit: ir.\x0a\x0a\x09^ self irTranslator\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09visit: ir;\x0a\x09\x09contents",
-messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents"],
+messageSends: ["visit:", "semanticAnalyzer", "translator", "inliner", "currentClass:", "irTranslator", "currentClass", "contents", "compileNode:"],
 referencedClasses: []
 }),
 globals.InliningCodeGenerator);
@@ -1661,7 +1712,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"inliner",{},globals.InliningCodeGenerator)})},
 args: [],
 source: "inliner\x0a\x09^ IRInliner new",
-messageSends: ["new"],
+messageSends: ["new", "inliner"],
 referencedClasses: ["IRInliner"]
 }),
 globals.InliningCodeGenerator);
@@ -1680,7 +1731,7 @@ return $1;
 }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},globals.InliningCodeGenerator)})},
 args: [],
 source: "irTranslator\x0a\x09^ IRInliningJSTranslator new",
-messageSends: ["new"],
+messageSends: ["new", "irTranslator"],
 referencedClasses: ["IRInliningJSTranslator"]
 }),
 globals.InliningCodeGenerator);

+ 34 - 10
src/Compiler-Inlining.st

@@ -59,6 +59,15 @@ IRSend subclass: #IRInlinedSend
 !IRInlinedSend commentStamp!
 I am the abstract super class of inlined message send instructions.!
 
+!IRInlinedSend methodsFor: 'accessing'!
+
+internalVariables
+	"Answer a collection of internal variables required 
+	to perform the inlining"
+	
+	^ #()
+! !
+
 !IRInlinedSend methodsFor: 'testing'!
 
 isInlined
@@ -89,6 +98,22 @@ IRInlinedSend subclass: #IRInlinedIfNilIfNotNil
 !IRInlinedIfNilIfNotNil commentStamp!
 I represent an inlined `#ifNil:ifNotNil:` message send instruction.!
 
+!IRInlinedIfNilIfNotNil methodsFor: 'accessing'!
+
+internalVariables
+	^ Array with: self receiverInternalVariable
+!
+
+receiverInternalVariable
+	^ IRVariable new
+		variable: (AliasVar new name: self receiverInternalVariableName);
+		yourself.
+!
+
+receiverInternalVariableName
+	^ '$receiver'
+! !
+
 !IRInlinedIfNilIfNotNil methodsFor: 'visiting'!
 
 accept: aVisitor
@@ -251,18 +276,10 @@ visitIRInlinedIfFalse: anIRInlinedIfFalse
 		with: [ self visit: anIRInlinedIfFalse instructions last ]
 !
 
-visitIRInlinedIfNil: anIRInlinedIfNil
-	self stream nextPutIf: [
-		self stream nextPutAll: '($receiver = '.
-		self visit: anIRInlinedIfNil instructions first.
-		self stream nextPutAll: ') == nil || $receiver == null' ]
-		with: [ self visit: anIRInlinedIfNil instructions last ]
-!
-
 visitIRInlinedIfNilIfNotNil: anIRInlinedIfNilIfNotNil
 	self stream
 		nextPutIfElse: [
-			self stream nextPutAll: '($receiver = '.
+			self stream nextPutAll: '(', anIRInlinedIfNilIfNotNil receiverInternalVariableName, ' = '.
 			self visit: anIRInlinedIfNilIfNotNil instructions first.
 			self stream nextPutAll: ') == nil || $receiver == null' ]
 		with: [ self visit: anIRInlinedIfNilIfNotNil instructions second ]
@@ -396,7 +413,9 @@ inlineClosure: anIRClosure
 	| inlinedClosure sequence statements |
 
 	inlinedClosure := self inlinedClosure.
-	inlinedClosure scope: anIRClosure scope.
+	inlinedClosure 
+		scope: anIRClosure scope;
+		parent: anIRClosure parent.
 
 	"Add the possible temp declarations"
 	anIRClosure tempDeclarations do: [ :each |
@@ -450,6 +469,8 @@ inlinedSend: inlinedSend with: anIRInstruction
 		add: inlinedClosure.
 
 	self send replaceWith: inlinedSend.
+	inlinedSend method internalVariables 
+		addAll: inlinedSend internalVariables.
 
 	^ inlinedSend
 !
@@ -469,6 +490,9 @@ inlinedSend: inlinedSend with: anIRInstruction with: anotherIRInstruction
 		add: inlinedClosure2.
 
 	self send replaceWith: inlinedSend.
+	inlinedSend method internalVariables 
+		addAll: inlinedSend internalVariables.
+		
 	^ inlinedSend
 ! !