|
@@ -6,53 +6,6 @@ $core.addPackage('Compiler-Inlining');
|
|
$core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
|
|
$core.packages["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
|
|
$core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
|
|
$core.packages["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
|
|
|
|
|
|
-$core.addClass('IRInlinedAssignment', $globals.IRAssignment, [], 'Compiler-Inlining');
|
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
-$globals.IRInlinedAssignment.comment="I represent an inlined assignment instruction.";
|
|
|
|
-//>>excludeEnd("ide");
|
|
|
|
-$core.addMethod(
|
|
|
|
-$core.method({
|
|
|
|
-selector: "acceptDagVisitor:",
|
|
|
|
-protocol: 'visiting',
|
|
|
|
-fn: function (aVisitor){
|
|
|
|
-var self=this;
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-return $recv(aVisitor)._visitIRInlinedAssignment_(self);
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedAssignment)});
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-},
|
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
-args: ["aVisitor"],
|
|
|
|
-source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRInlinedAssignment: self",
|
|
|
|
-referencedClasses: [],
|
|
|
|
-//>>excludeEnd("ide");
|
|
|
|
-messageSends: ["visitIRInlinedAssignment:"]
|
|
|
|
-}),
|
|
|
|
-$globals.IRInlinedAssignment);
|
|
|
|
-
|
|
|
|
-$core.addMethod(
|
|
|
|
-$core.method({
|
|
|
|
-selector: "isInlined",
|
|
|
|
-protocol: 'testing',
|
|
|
|
-fn: function (){
|
|
|
|
-var self=this;
|
|
|
|
-return true;
|
|
|
|
-
|
|
|
|
-},
|
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
-args: [],
|
|
|
|
-source: "isInlined\x0a\x09^ true",
|
|
|
|
-referencedClasses: [],
|
|
|
|
-//>>excludeEnd("ide");
|
|
|
|
-messageSends: []
|
|
|
|
-}),
|
|
|
|
-$globals.IRInlinedAssignment);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
$core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
|
|
$core.addClass('IRInlinedClosure', $globals.IRClosure, [], 'Compiler-Inlining');
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
$globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
|
|
$globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
|
|
@@ -101,53 +54,6 @@ $globals.IRInlinedClosure);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-$core.addClass('IRInlinedReturn', $globals.IRReturn, [], 'Compiler-Inlining');
|
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
-$globals.IRInlinedReturn.comment="I represent an inlined local return instruction.";
|
|
|
|
-//>>excludeEnd("ide");
|
|
|
|
-$core.addMethod(
|
|
|
|
-$core.method({
|
|
|
|
-selector: "acceptDagVisitor:",
|
|
|
|
-protocol: 'visiting',
|
|
|
|
-fn: function (aVisitor){
|
|
|
|
-var self=this;
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-return $recv(aVisitor)._visitIRInlinedReturn_(self);
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedReturn)});
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-},
|
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
-args: ["aVisitor"],
|
|
|
|
-source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRInlinedReturn: self",
|
|
|
|
-referencedClasses: [],
|
|
|
|
-//>>excludeEnd("ide");
|
|
|
|
-messageSends: ["visitIRInlinedReturn:"]
|
|
|
|
-}),
|
|
|
|
-$globals.IRInlinedReturn);
|
|
|
|
-
|
|
|
|
-$core.addMethod(
|
|
|
|
-$core.method({
|
|
|
|
-selector: "isInlined",
|
|
|
|
-protocol: 'testing',
|
|
|
|
-fn: function (){
|
|
|
|
-var self=this;
|
|
|
|
-return true;
|
|
|
|
-
|
|
|
|
-},
|
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
-args: [],
|
|
|
|
-source: "isInlined\x0a\x09^ true",
|
|
|
|
-referencedClasses: [],
|
|
|
|
-//>>excludeEnd("ide");
|
|
|
|
-messageSends: []
|
|
|
|
-}),
|
|
|
|
-$globals.IRInlinedReturn);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
$core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
|
|
$core.addClass('IRInlinedSend', $globals.IRSend, [], 'Compiler-Inlining');
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
$globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
|
|
$globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
|
|
@@ -842,30 +748,6 @@ $core.addClass('IRInliningJSTranslator', $globals.IRJSTranslator, [], 'Compiler-
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
$globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
|
|
$globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
|
|
//>>excludeEnd("ide");
|
|
//>>excludeEnd("ide");
|
|
-$core.addMethod(
|
|
|
|
-$core.method({
|
|
|
|
-selector: "visitIRInlinedAssignment:",
|
|
|
|
-protocol: 'visiting',
|
|
|
|
-fn: function (anIRInlinedAssignment){
|
|
|
|
-var self=this;
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-self._visit_($recv(anIRInlinedAssignment)._right());
|
|
|
|
-return self;
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedAssignment:",{anIRInlinedAssignment:anIRInlinedAssignment},$globals.IRInliningJSTranslator)});
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-},
|
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
-args: ["anIRInlinedAssignment"],
|
|
|
|
-source: "visitIRInlinedAssignment: anIRInlinedAssignment\x0a\x09self visit: anIRInlinedAssignment right",
|
|
|
|
-referencedClasses: [],
|
|
|
|
-//>>excludeEnd("ide");
|
|
|
|
-messageSends: ["visit:", "right"]
|
|
|
|
-}),
|
|
|
|
-$globals.IRInliningJSTranslator);
|
|
|
|
-
|
|
|
|
$core.addMethod(
|
|
$core.addMethod(
|
|
$core.method({
|
|
$core.method({
|
|
selector: "visitIRInlinedClosure:",
|
|
selector: "visitIRInlinedClosure:",
|
|
@@ -1195,30 +1077,6 @@ messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first
|
|
}),
|
|
}),
|
|
$globals.IRInliningJSTranslator);
|
|
$globals.IRInliningJSTranslator);
|
|
|
|
|
|
-$core.addMethod(
|
|
|
|
-$core.method({
|
|
|
|
-selector: "visitIRInlinedReturn:",
|
|
|
|
-protocol: 'visiting',
|
|
|
|
-fn: function (anIRInlinedReturn){
|
|
|
|
-var self=this;
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-self._visit_($recv(anIRInlinedReturn)._expression());
|
|
|
|
-return self;
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"visitIRInlinedReturn:",{anIRInlinedReturn:anIRInlinedReturn},$globals.IRInliningJSTranslator)});
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-},
|
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
-args: ["anIRInlinedReturn"],
|
|
|
|
-source: "visitIRInlinedReturn: anIRInlinedReturn\x0a\x09self visit: anIRInlinedReturn expression",
|
|
|
|
-referencedClasses: [],
|
|
|
|
-//>>excludeEnd("ide");
|
|
|
|
-messageSends: ["visit:", "expression"]
|
|
|
|
-}),
|
|
|
|
-$globals.IRInliningJSTranslator);
|
|
|
|
-
|
|
|
|
$core.addMethod(
|
|
$core.addMethod(
|
|
$core.method({
|
|
$core.method({
|
|
selector: "visitIRInlinedSequence:",
|
|
selector: "visitIRInlinedSequence:",
|
|
@@ -1690,6 +1548,31 @@ messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments
|
|
}),
|
|
}),
|
|
$globals.IRSendInliner);
|
|
$globals.IRSendInliner);
|
|
|
|
|
|
|
|
+$core.addMethod(
|
|
|
|
+$core.method({
|
|
|
|
+selector: "inlineSend:andReplace:",
|
|
|
|
+protocol: 'private',
|
|
|
|
+fn: function (anIRSend,anIRInstruction){
|
|
|
|
+var self=this;
|
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
+return $core.withContext(function($ctx1) {
|
|
|
|
+//>>excludeEnd("ctx");
|
|
|
|
+$recv(anIRInstruction)._replaceWith_(anIRSend);
|
|
|
|
+self._inlineSend_(anIRSend);
|
|
|
|
+return anIRSend;
|
|
|
|
+//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
|
|
|
|
+//>>excludeEnd("ctx");
|
|
|
|
+},
|
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
+args: ["anIRSend", "anIRInstruction"],
|
|
|
|
+source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09self inlineSend: anIRSend.\x0a\x09^ anIRSend",
|
|
|
|
+referencedClasses: [],
|
|
|
|
+//>>excludeEnd("ide");
|
|
|
|
+messageSends: ["replaceWith:", "inlineSend:"]
|
|
|
|
+}),
|
|
|
|
+$globals.IRSendInliner);
|
|
|
|
+
|
|
$core.addMethod(
|
|
$core.addMethod(
|
|
$core.method({
|
|
$core.method({
|
|
selector: "inlinedClosure",
|
|
selector: "inlinedClosure",
|
|
@@ -1716,7 +1599,7 @@ $globals.IRSendInliner);
|
|
$core.addMethod(
|
|
$core.addMethod(
|
|
$core.method({
|
|
$core.method({
|
|
selector: "inlinedSend:withBlock:",
|
|
selector: "inlinedSend:withBlock:",
|
|
-protocol: 'inlining',
|
|
|
|
|
|
+protocol: 'private',
|
|
fn: function (inlinedSend,anIRInstruction){
|
|
fn: function (inlinedSend,anIRInstruction){
|
|
var self=this;
|
|
var self=this;
|
|
var inlinedClosure;
|
|
var inlinedClosure;
|
|
@@ -1769,7 +1652,7 @@ $globals.IRSendInliner);
|
|
$core.addMethod(
|
|
$core.addMethod(
|
|
$core.method({
|
|
$core.method({
|
|
selector: "inlinedSend:withBlock:withBlock:",
|
|
selector: "inlinedSend:withBlock:withBlock:",
|
|
-protocol: 'inlining',
|
|
|
|
|
|
+protocol: 'private',
|
|
fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
|
|
fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
|
|
var self=this;
|
|
var self=this;
|
|
var inlinedClosure1,inlinedClosure2;
|
|
var inlinedClosure1,inlinedClosure2;
|
|
@@ -2015,81 +1898,31 @@ messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSati
|
|
$globals.IRSendInliner.klass);
|
|
$globals.IRSendInliner.klass);
|
|
|
|
|
|
|
|
|
|
-$core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['assignment'], 'Compiler-Inlining');
|
|
|
|
|
|
+$core.addClass('IRAssignmentInliner', $globals.IRSendInliner, ['target'], 'Compiler-Inlining');
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
$globals.IRAssignmentInliner.comment="I inline message sends together with assignments by moving them around into the inline closure instructions.\x0a\x0a##Example\x0a\x0a\x09foo\x0a\x09\x09| a |\x0a\x09\x09a := true ifTrue: [ 1 ]\x0a\x0aWill produce:\x0a\x0a\x09if($core.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};";
|
|
$globals.IRAssignmentInliner.comment="I inline message sends together with assignments by moving them around into the inline closure instructions.\x0a\x0a##Example\x0a\x0a\x09foo\x0a\x09\x09| a |\x0a\x09\x09a := true ifTrue: [ 1 ]\x0a\x0aWill produce:\x0a\x0a\x09if($core.assert(true) {\x0a\x09\x09a = 1;\x0a\x09};";
|
|
//>>excludeEnd("ide");
|
|
//>>excludeEnd("ide");
|
|
-$core.addMethod(
|
|
|
|
-$core.method({
|
|
|
|
-selector: "assignment",
|
|
|
|
-protocol: 'accessing',
|
|
|
|
-fn: function (){
|
|
|
|
-var self=this;
|
|
|
|
-return self["@assignment"];
|
|
|
|
-
|
|
|
|
-},
|
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
-args: [],
|
|
|
|
-source: "assignment\x0a\x09^ assignment",
|
|
|
|
-referencedClasses: [],
|
|
|
|
-//>>excludeEnd("ide");
|
|
|
|
-messageSends: []
|
|
|
|
-}),
|
|
|
|
-$globals.IRAssignmentInliner);
|
|
|
|
-
|
|
|
|
-$core.addMethod(
|
|
|
|
-$core.method({
|
|
|
|
-selector: "assignment:",
|
|
|
|
-protocol: 'accessing',
|
|
|
|
-fn: function (aNode){
|
|
|
|
-var self=this;
|
|
|
|
-self["@assignment"]=aNode;
|
|
|
|
-return self;
|
|
|
|
-
|
|
|
|
-},
|
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
-args: ["aNode"],
|
|
|
|
-source: "assignment: aNode\x0a\x09assignment := aNode",
|
|
|
|
-referencedClasses: [],
|
|
|
|
-//>>excludeEnd("ide");
|
|
|
|
-messageSends: []
|
|
|
|
-}),
|
|
|
|
-$globals.IRAssignmentInliner);
|
|
|
|
-
|
|
|
|
$core.addMethod(
|
|
$core.addMethod(
|
|
$core.method({
|
|
$core.method({
|
|
selector: "inlineAssignment:",
|
|
selector: "inlineAssignment:",
|
|
protocol: 'inlining',
|
|
protocol: 'inlining',
|
|
fn: function (anIRAssignment){
|
|
fn: function (anIRAssignment){
|
|
var self=this;
|
|
var self=this;
|
|
-var inlinedAssignment;
|
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
return $core.withContext(function($ctx1) {
|
|
return $core.withContext(function($ctx1) {
|
|
//>>excludeEnd("ctx");
|
|
//>>excludeEnd("ctx");
|
|
-self._assignment_(anIRAssignment);
|
|
|
|
-inlinedAssignment=$recv($globals.IRInlinedAssignment)._new();
|
|
|
|
-$recv($recv(anIRAssignment)._dagChildren())._do_((function(each){
|
|
|
|
|
|
+self._target_($recv(anIRAssignment)._left());
|
|
|
|
+return self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
-return $core.withContext(function($ctx2) {
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-return $recv(inlinedAssignment)._add_(each);
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-}));
|
|
|
|
-$recv(anIRAssignment)._replaceWith_(inlinedAssignment);
|
|
|
|
-self._inlineSend_($recv(inlinedAssignment)._right());
|
|
|
|
-return inlinedAssignment;
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment,inlinedAssignment:inlinedAssignment},$globals.IRAssignmentInliner)});
|
|
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
|
|
//>>excludeEnd("ctx");
|
|
//>>excludeEnd("ctx");
|
|
},
|
|
},
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
args: ["anIRAssignment"],
|
|
args: ["anIRAssignment"],
|
|
-source: "inlineAssignment: anIRAssignment\x0a\x09| inlinedAssignment |\x0a\x09self assignment: anIRAssignment.\x0a\x09inlinedAssignment := IRInlinedAssignment new.\x0a\x09anIRAssignment dagChildren do: [ :each |\x0a\x09\x09inlinedAssignment add: each ].\x0a\x09anIRAssignment replaceWith: inlinedAssignment.\x0a\x09self inlineSend: inlinedAssignment right.\x0a\x09^ inlinedAssignment",
|
|
|
|
-referencedClasses: ["IRInlinedAssignment"],
|
|
|
|
|
|
+source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
|
|
|
|
+referencedClasses: [],
|
|
//>>excludeEnd("ide");
|
|
//>>excludeEnd("ide");
|
|
-messageSends: ["assignment:", "new", "do:", "dagChildren", "add:", "replaceWith:", "inlineSend:", "right"]
|
|
|
|
|
|
+messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
|
|
}),
|
|
}),
|
|
$globals.IRAssignmentInliner);
|
|
$globals.IRAssignmentInliner);
|
|
|
|
|
|
@@ -2099,11 +1932,11 @@ selector: "inlineClosure:",
|
|
protocol: 'inlining',
|
|
protocol: 'inlining',
|
|
fn: function (anIRClosure){
|
|
fn: function (anIRClosure){
|
|
var self=this;
|
|
var self=this;
|
|
-var closure,statements;
|
|
|
|
|
|
+var closure,sequence,statements;
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
return $core.withContext(function($ctx1) {
|
|
return $core.withContext(function($ctx1) {
|
|
//>>excludeEnd("ctx");
|
|
//>>excludeEnd("ctx");
|
|
-var $2,$1,$3,$5,$4;
|
|
|
|
|
|
+var $1,$2,$3,$5,$4;
|
|
closure=(
|
|
closure=(
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
$ctx1.supercall = true,
|
|
$ctx1.supercall = true,
|
|
@@ -2112,45 +1945,80 @@ $ctx1.supercall = true,
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
$ctx1.supercall = false;
|
|
$ctx1.supercall = false;
|
|
//>>excludeEnd("ctx");;
|
|
//>>excludeEnd("ctx");;
|
|
-statements=$recv($recv(closure)._sequence())._dagChildren();
|
|
|
|
|
|
+sequence=$recv(closure)._sequence();
|
|
|
|
+statements=$recv(sequence)._dagChildren();
|
|
$recv(statements)._ifNotEmpty_((function(){
|
|
$recv(statements)._ifNotEmpty_((function(){
|
|
|
|
+var final;
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
return $core.withContext(function($ctx2) {
|
|
return $core.withContext(function($ctx2) {
|
|
//>>excludeEnd("ctx");
|
|
//>>excludeEnd("ctx");
|
|
-$2=$recv(statements)._last();
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-$ctx2.sendIdx["last"]=1;
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-$1=$recv($2)._yieldsValue();
|
|
|
|
|
|
+final=$recv(statements)._last();
|
|
|
|
+final;
|
|
|
|
+$1=$recv(final)._yieldsValue();
|
|
if($core.assert($1)){
|
|
if($core.assert($1)){
|
|
-$3=$recv(statements)._last();
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-$ctx2.sendIdx["last"]=2;
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
|
|
+$2=sequence;
|
|
|
|
+$3=final;
|
|
$5=$recv($globals.IRAssignment)._new();
|
|
$5=$recv($globals.IRAssignment)._new();
|
|
-$recv($5)._add_($recv(self._assignment())._left());
|
|
|
|
|
|
+$recv($5)._add_(self._target());
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
$ctx2.sendIdx["add:"]=1;
|
|
$ctx2.sendIdx["add:"]=1;
|
|
//>>excludeEnd("ctx");
|
|
//>>excludeEnd("ctx");
|
|
-$recv($5)._add_($recv($recv(statements)._last())._copy());
|
|
|
|
|
|
+$recv($5)._add_($recv(final)._copy());
|
|
$4=$recv($5)._yourself();
|
|
$4=$recv($5)._yourself();
|
|
-return $recv($3)._replaceWith_($4);
|
|
|
|
|
|
+return $recv($2)._replace_with_($3,$4);
|
|
};
|
|
};
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
|
|
//>>excludeEnd("ctx");
|
|
//>>excludeEnd("ctx");
|
|
}));
|
|
}));
|
|
return closure;
|
|
return closure;
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
-}, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRAssignmentInliner)});
|
|
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
|
|
//>>excludeEnd("ctx");
|
|
//>>excludeEnd("ctx");
|
|
},
|
|
},
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
args: ["anIRClosure"],
|
|
args: ["anIRClosure"],
|
|
-source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last yieldsValue 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^ closure",
|
|
|
|
|
|
+source: "inlineClosure: anIRClosure\x0a\x09| closure sequence statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09sequence := closure sequence.\x0a\x09statements := sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09| final |\x0a\x09\x09final := statements last.\x0a\x09\x09final yieldsValue ifTrue: [\x0a\x09\x09\x09sequence replace: final with: (IRAssignment new\x0a\x09\x09\x09\x09add: self target;\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ closure",
|
|
referencedClasses: ["IRAssignment"],
|
|
referencedClasses: ["IRAssignment"],
|
|
//>>excludeEnd("ide");
|
|
//>>excludeEnd("ide");
|
|
-messageSends: ["inlineClosure:", "dagChildren", "sequence", "ifNotEmpty:", "ifTrue:", "yieldsValue", "last", "replaceWith:", "add:", "new", "left", "assignment", "copy", "yourself"]
|
|
|
|
|
|
+messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
|
|
|
|
+}),
|
|
|
|
+$globals.IRAssignmentInliner);
|
|
|
|
+
|
|
|
|
+$core.addMethod(
|
|
|
|
+$core.method({
|
|
|
|
+selector: "target",
|
|
|
|
+protocol: 'accessing',
|
|
|
|
+fn: function (){
|
|
|
|
+var self=this;
|
|
|
|
+return self["@target"];
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
+args: [],
|
|
|
|
+source: "target\x0a\x09^ target",
|
|
|
|
+referencedClasses: [],
|
|
|
|
+//>>excludeEnd("ide");
|
|
|
|
+messageSends: []
|
|
|
|
+}),
|
|
|
|
+$globals.IRAssignmentInliner);
|
|
|
|
+
|
|
|
|
+$core.addMethod(
|
|
|
|
+$core.method({
|
|
|
|
+selector: "target:",
|
|
|
|
+protocol: 'accessing',
|
|
|
|
+fn: function (anObject){
|
|
|
|
+var self=this;
|
|
|
|
+self["@target"]=anObject;
|
|
|
|
+return self;
|
|
|
|
+
|
|
|
|
+},
|
|
|
|
+//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
+args: ["anObject"],
|
|
|
|
+source: "target: anObject\x0a\x09target := anObject",
|
|
|
|
+referencedClasses: [],
|
|
|
|
+//>>excludeEnd("ide");
|
|
|
|
+messageSends: []
|
|
}),
|
|
}),
|
|
$globals.IRAssignmentInliner);
|
|
$globals.IRAssignmentInliner);
|
|
|
|
|
|
@@ -2166,11 +2034,11 @@ selector: "inlineClosure:",
|
|
protocol: 'inlining',
|
|
protocol: 'inlining',
|
|
fn: function (anIRClosure){
|
|
fn: function (anIRClosure){
|
|
var self=this;
|
|
var self=this;
|
|
-var closure,statements;
|
|
|
|
|
|
+var closure,sequence,statements;
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
return $core.withContext(function($ctx1) {
|
|
return $core.withContext(function($ctx1) {
|
|
//>>excludeEnd("ctx");
|
|
//>>excludeEnd("ctx");
|
|
-var $2,$1,$3,$5,$4;
|
|
|
|
|
|
+var $1,$2,$3,$5,$4;
|
|
closure=(
|
|
closure=(
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
$ctx1.supercall = true,
|
|
$ctx1.supercall = true,
|
|
@@ -2179,41 +2047,39 @@ $ctx1.supercall = true,
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
$ctx1.supercall = false;
|
|
$ctx1.supercall = false;
|
|
//>>excludeEnd("ctx");;
|
|
//>>excludeEnd("ctx");;
|
|
-statements=$recv($recv(closure)._sequence())._dagChildren();
|
|
|
|
|
|
+sequence=$recv(closure)._sequence();
|
|
|
|
+statements=$recv(sequence)._dagChildren();
|
|
$recv(statements)._ifNotEmpty_((function(){
|
|
$recv(statements)._ifNotEmpty_((function(){
|
|
|
|
+var final;
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
return $core.withContext(function($ctx2) {
|
|
return $core.withContext(function($ctx2) {
|
|
//>>excludeEnd("ctx");
|
|
//>>excludeEnd("ctx");
|
|
-$2=$recv(statements)._last();
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-$ctx2.sendIdx["last"]=1;
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-$1=$recv($2)._yieldsValue();
|
|
|
|
|
|
+final=$recv(statements)._last();
|
|
|
|
+final;
|
|
|
|
+$1=$recv(final)._yieldsValue();
|
|
if($core.assert($1)){
|
|
if($core.assert($1)){
|
|
-$3=$recv(statements)._last();
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-$ctx2.sendIdx["last"]=2;
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
|
|
+$2=sequence;
|
|
|
|
+$3=final;
|
|
$5=$recv($globals.IRReturn)._new();
|
|
$5=$recv($globals.IRReturn)._new();
|
|
-$recv($5)._add_($recv($recv(statements)._last())._copy());
|
|
|
|
|
|
+$recv($5)._add_($recv(final)._copy());
|
|
$4=$recv($5)._yourself();
|
|
$4=$recv($5)._yourself();
|
|
-return $recv($3)._replaceWith_($4);
|
|
|
|
|
|
+return $recv($2)._replace_with_($3,$4);
|
|
};
|
|
};
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
|
|
|
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
|
|
//>>excludeEnd("ctx");
|
|
//>>excludeEnd("ctx");
|
|
}));
|
|
}));
|
|
return closure;
|
|
return closure;
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
-}, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,statements:statements},$globals.IRReturnInliner)});
|
|
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
|
|
//>>excludeEnd("ctx");
|
|
//>>excludeEnd("ctx");
|
|
},
|
|
},
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
args: ["anIRClosure"],
|
|
args: ["anIRClosure"],
|
|
-source: "inlineClosure: anIRClosure\x0a\x09| closure statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09statements := closure sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09statements last yieldsValue ifTrue: [\x0a\x09\x09\x09statements 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 sequence statements |\x0a\x0a\x09closure := super inlineClosure: anIRClosure.\x0a\x09sequence := closure sequence.\x0a\x09statements := sequence dagChildren.\x0a\x09\x0a\x09statements ifNotEmpty: [\x0a\x09\x09| final |\x0a\x09\x09final := statements last.\x0a\x09\x09final yieldsValue ifTrue: [\x0a\x09\x09\x09sequence replace: final with: (IRReturn new\x0a\x09\x09\x09\x09add: final copy;\x0a\x09\x09\x09\x09yourself) ] ].\x0a\x0a\x09^ closure",
|
|
referencedClasses: ["IRReturn"],
|
|
referencedClasses: ["IRReturn"],
|
|
//>>excludeEnd("ide");
|
|
//>>excludeEnd("ide");
|
|
-messageSends: ["inlineClosure:", "dagChildren", "sequence", "ifNotEmpty:", "ifTrue:", "yieldsValue", "last", "replaceWith:", "add:", "new", "copy", "yourself"]
|
|
|
|
|
|
+messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
|
|
}),
|
|
}),
|
|
$globals.IRReturnInliner);
|
|
$globals.IRReturnInliner);
|
|
|
|
|
|
@@ -2223,56 +2089,20 @@ selector: "inlineReturn:",
|
|
protocol: 'inlining',
|
|
protocol: 'inlining',
|
|
fn: function (anIRReturn){
|
|
fn: function (anIRReturn){
|
|
var self=this;
|
|
var self=this;
|
|
-var return_;
|
|
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
return $core.withContext(function($ctx1) {
|
|
return $core.withContext(function($ctx1) {
|
|
//>>excludeEnd("ctx");
|
|
//>>excludeEnd("ctx");
|
|
-return_=self._inlinedReturn();
|
|
|
|
-$recv($recv(anIRReturn)._dagChildren())._do_((function(each){
|
|
|
|
|
|
+return self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
-return $core.withContext(function($ctx2) {
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-return $recv(return_)._add_(each);
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-}));
|
|
|
|
-$recv(anIRReturn)._replaceWith_(return_);
|
|
|
|
-self._inlineSend_($recv(return_)._expression());
|
|
|
|
-return return_;
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn,return_:return_},$globals.IRReturnInliner)});
|
|
|
|
|
|
+}, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
|
|
//>>excludeEnd("ctx");
|
|
//>>excludeEnd("ctx");
|
|
},
|
|
},
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
args: ["anIRReturn"],
|
|
args: ["anIRReturn"],
|
|
-source: "inlineReturn: anIRReturn\x0a\x09| return |\x0a\x09return := self inlinedReturn.\x0a\x09anIRReturn dagChildren do: [ :each |\x0a\x09\x09return add: each ].\x0a\x09anIRReturn replaceWith: return.\x0a\x09self inlineSend: return expression.\x0a\x09^ return",
|
|
|
|
|
|
+source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
|
|
referencedClasses: [],
|
|
referencedClasses: [],
|
|
//>>excludeEnd("ide");
|
|
//>>excludeEnd("ide");
|
|
-messageSends: ["inlinedReturn", "do:", "dagChildren", "add:", "replaceWith:", "inlineSend:", "expression"]
|
|
|
|
-}),
|
|
|
|
-$globals.IRReturnInliner);
|
|
|
|
-
|
|
|
|
-$core.addMethod(
|
|
|
|
-$core.method({
|
|
|
|
-selector: "inlinedReturn",
|
|
|
|
-protocol: 'factory',
|
|
|
|
-fn: function (){
|
|
|
|
-var self=this;
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-return $core.withContext(function($ctx1) {
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-return $recv($globals.IRInlinedReturn)._new();
|
|
|
|
-//>>excludeStart("ctx", pragmas.excludeDebugContexts);
|
|
|
|
-}, function($ctx1) {$ctx1.fill(self,"inlinedReturn",{},$globals.IRReturnInliner)});
|
|
|
|
-//>>excludeEnd("ctx");
|
|
|
|
-},
|
|
|
|
-//>>excludeStart("ide", pragmas.excludeIdeData);
|
|
|
|
-args: [],
|
|
|
|
-source: "inlinedReturn\x0a\x09^ IRInlinedReturn new",
|
|
|
|
-referencedClasses: ["IRInlinedReturn"],
|
|
|
|
-//>>excludeEnd("ide");
|
|
|
|
-messageSends: ["new"]
|
|
|
|
|
|
+messageSends: ["inlineSend:andReplace:", "expression"]
|
|
}),
|
|
}),
|
|
$globals.IRReturnInliner);
|
|
$globals.IRReturnInliner);
|
|
|
|
|