Browse Source

Moves #requiresSmalltalkContext up to IRClosureInstruction

Nicolas Petton 11 years ago
parent
commit
b998618002
2 changed files with 52 additions and 50 deletions
  1. 42 41
      js/Compiler-IR.js
  2. 10 9
      st/Compiler-IR.st

+ 42 - 41
js/Compiler-IR.js

@@ -295,6 +295,7 @@ var $1,$2,$3,$4,$6,$5,$7,$8,$9;
 $1=_st($IRClosure())._new();
 $ctx1.sendIdx["new"]=1;
 _st($1)._arguments_(_st(aNode)._parameters());
+_st($1)._requiresSmalltalkContext_(_st(aNode)._requiresSmalltalkContext());
 $2=$1;
 $3=_st(aNode)._scope();
 $ctx1.sendIdx["scope"]=1;
@@ -324,8 +325,8 @@ $9=closure;
 return $9;
 }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},globals.IRASTTranslator)})},
 args: ["aNode"],
-source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
-messageSends: ["arguments:", "new", "parameters", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"],
+source: "visitBlockNode: aNode\x0a\x09| closure |\x0a\x09closure := IRClosure new\x0a\x09\x09arguments: aNode parameters;\x0a\x09\x09requiresSmalltalkContext: aNode requiresSmalltalkContext;\x0a\x09\x09scope: aNode scope;\x0a\x09\x09yourself.\x0a\x09aNode scope temps do: [ :each |\x0a\x09\x09closure add: (IRTempDeclaration new\x0a\x09\x09\x09name: each name;\x0a\x09\x09\x09scope: aNode scope;\x0a\x09\x09\x09yourself) ].\x0a\x09aNode nodes do: [ :each | closure add: (self visit: each) ].\x0a\x09^ closure",
+messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "nodes", "visit:"],
 referencedClasses: ["IRClosure", "IRTempDeclaration"]
 }),
 globals.IRASTTranslator);
@@ -1285,7 +1286,7 @@ globals.IRScopedInstruction);
 
 
 
-smalltalk.addClass('IRClosureInstruction', globals.IRScopedInstruction, ['arguments'], 'Compiler-IR');
+smalltalk.addClass('IRClosureInstruction', globals.IRScopedInstruction, ['arguments', 'requiresSmalltalkContext'], 'Compiler-IR');
 smalltalk.addMethod(
 smalltalk.method({
 selector: "arguments",
@@ -1348,6 +1349,44 @@ referencedClasses: []
 }),
 globals.IRClosureInstruction);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "requiresSmalltalkContext",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=self["@requiresSmalltalkContext"];
+if(($receiver = $2) == nil || $receiver == null){
+$1=false;
+} else {
+$1=$2;
+};
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.IRClosureInstruction)})},
+args: [],
+source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
+messageSends: ["ifNil:"],
+referencedClasses: []
+}),
+globals.IRClosureInstruction);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "requiresSmalltalkContext:",
+protocol: 'accessing',
+fn: function (anObject){
+var self=this;
+self["@requiresSmalltalkContext"]=anObject;
+return self},
+args: ["anObject"],
+source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
+messageSends: [],
+referencedClasses: []
+}),
+globals.IRClosureInstruction);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "scope:",
@@ -1567,44 +1606,6 @@ referencedClasses: []
 }),
 globals.IRMethod);
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "requiresSmalltalkContext",
-protocol: 'accessing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-var $2,$1;
-$2=self["@requiresSmalltalkContext"];
-if(($receiver = $2) == nil || $receiver == null){
-$1=false;
-} else {
-$1=$2;
-};
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},globals.IRMethod)})},
-args: [],
-source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
-messageSends: ["ifNil:"],
-referencedClasses: []
-}),
-globals.IRMethod);
-
-smalltalk.addMethod(
-smalltalk.method({
-selector: "requiresSmalltalkContext:",
-protocol: 'accessing',
-fn: function (anObject){
-var self=this;
-self["@requiresSmalltalkContext"]=anObject;
-return self},
-args: ["anObject"],
-source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
-messageSends: [],
-referencedClasses: []
-}),
-globals.IRMethod);
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "selector",

+ 10 - 9
st/Compiler-IR.st

@@ -113,6 +113,7 @@ visitBlockNode: aNode
 	| closure |
 	closure := IRClosure new
 		arguments: aNode parameters;
+		requiresSmalltalkContext: aNode requiresSmalltalkContext;
 		scope: aNode scope;
 		yourself.
 	aNode scope temps do: [ :each |
@@ -422,7 +423,7 @@ scope: aScope
 ! !
 
 IRScopedInstruction subclass: #IRClosureInstruction
-	instanceVariableNames: 'arguments'
+	instanceVariableNames: 'arguments requiresSmalltalkContext'
 	package: 'Compiler-IR'!
 
 !IRClosureInstruction methodsFor: 'accessing'!
@@ -441,6 +442,14 @@ locals
 		yourself
 !
 
+requiresSmalltalkContext
+	^ requiresSmalltalkContext ifNil: [ false ]
+!
+
+requiresSmalltalkContext: anObject
+	requiresSmalltalkContext := anObject
+!
+
 scope: aScope
 	super scope: aScope.
 	aScope instruction: self
@@ -505,14 +514,6 @@ method
 	^ self
 !
 
-requiresSmalltalkContext
-	^ requiresSmalltalkContext ifNil: [ false ]
-!
-
-requiresSmalltalkContext: anObject
-	requiresSmalltalkContext := anObject
-!
-
 selector
 	^ selector
 !