Browse Source

Scopes: #can{Inline=>Flatten}NonLocalReturns

Herby Vojčík 4 years ago
parent
commit
a65221487b

+ 3 - 3
lang/src/Compiler-Inlining.js

@@ -685,11 +685,11 @@ selector: "visitIRNonLocalReturn:",
 protocol: "visiting",
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["anIRNonLocalReturn"],
-source: "visitIRNonLocalReturn: anIRNonLocalReturn\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 dagChildren do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ self visitIRReturn: localReturn ].\x0a\x09^ (self shouldInlineReturn: anIRNonLocalReturn)\x0a\x09\x09ifTrue: [ self nonLocalReturnInliner inlineReturn: anIRNonLocalReturn ]\x0a\x09\x09ifFalse: [ super visitIRNonLocalReturn: anIRNonLocalReturn ]",
+source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09| localReturn |\x0a\x09anIRNonLocalReturn scope canFlattenNonLocalReturns 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 dagChildren do: [ :each |\x0a\x09\x09\x09localReturn add: each ].\x0a\x09\x09anIRNonLocalReturn replaceWith: localReturn.\x0a\x09\x09^ self visitIRReturn: localReturn ].\x0a\x09^ (self shouldInlineReturn: anIRNonLocalReturn)\x0a\x09\x09ifTrue: [ self nonLocalReturnInliner inlineReturn: anIRNonLocalReturn ]\x0a\x09\x09ifFalse: [ super visitIRNonLocalReturn: anIRNonLocalReturn ]",
 referencedClasses: ["IRReturn"],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "nonLocalReturnInliner", "visitIRNonLocalReturn:"]
+messageSends: ["ifTrue:", "canFlattenNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "nonLocalReturnInliner", "visitIRNonLocalReturn:"]
 }, function ($methodClass){ return function (anIRNonLocalReturn){
 var self=this,$self=this;
 var localReturn;
@@ -701,7 +701,7 @@ $2=$recv(anIRNonLocalReturn)._scope();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 $ctx1.sendIdx["scope"]=1;
 //>>excludeEnd("ctx");
-$1=$recv($2)._canInlineNonLocalReturns();
+$1=$recv($2)._canFlattenNonLocalReturns();
 if($core.assert($1)){
 $4=$recv(anIRNonLocalReturn)._scope();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);

+ 1 - 1
lang/src/Compiler-Inlining.st

@@ -206,7 +206,7 @@ visitIRAssignment: anIRAssignment
 
 visitIRNonLocalReturn: anIRNonLocalReturn
 	| localReturn |
-	anIRNonLocalReturn scope canInlineNonLocalReturns ifTrue: [
+	anIRNonLocalReturn scope canFlattenNonLocalReturns ifTrue: [
 		anIRNonLocalReturn scope methodScope removeNonLocalReturn: anIRNonLocalReturn scope.
 		localReturn := IRReturn new
 			scope: anIRNonLocalReturn scope;

+ 7 - 7
lang/src/Compiler-Semantic.js

@@ -259,15 +259,15 @@ $globals.LexicalScope);
 
 $core.addMethod(
 $core.method({
-selector: "canInlineNonLocalReturns",
+selector: "canFlattenNonLocalReturns",
 protocol: "testing",
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
+source: "canFlattenNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canFlattenNonLocalReturns ]",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],
-messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
+messageSends: ["and:", "isInlined", "canFlattenNonLocalReturns", "outerScope"]
 }, function ($methodClass){ return function (){
 var self=this,$self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
@@ -277,13 +277,13 @@ return $recv($self._isInlined())._and_((function(){
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
-return $recv($self._outerScope())._canInlineNonLocalReturns();
+return $recv($self._outerScope())._canFlattenNonLocalReturns();
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
 //>>excludeEnd("ctx");
 }));
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
-}, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{})});
+}, function($ctx1) {$ctx1.fill(self,"canFlattenNonLocalReturns",{})});
 //>>excludeEnd("ctx");
 }; }),
 $globals.LexicalScope);
@@ -781,11 +781,11 @@ $globals.MethodLexicalScope);
 
 $core.addMethod(
 $core.method({
-selector: "canInlineNonLocalReturns",
+selector: "canFlattenNonLocalReturns",
 protocol: "testing",
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "canInlineNonLocalReturns\x0a\x09^ true",
+source: "canFlattenNonLocalReturns\x0a\x09^ true",
 referencedClasses: [],
 //>>excludeEnd("ide");
 pragmas: [],

+ 3 - 3
lang/src/Compiler-Semantic.st

@@ -106,8 +106,8 @@ addTemp: aString
 
 !LexicalScope methodsFor: 'testing'!
 
-canInlineNonLocalReturns
-	^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]
+canFlattenNonLocalReturns
+	^ self isInlined and: [ self outerScope canFlattenNonLocalReturns ]
 !
 
 isBlockScope
@@ -191,7 +191,7 @@ removeNonLocalReturn: aScope
 
 !MethodLexicalScope methodsFor: 'testing'!
 
-canInlineNonLocalReturns
+canFlattenNonLocalReturns
 	^ true
 !