Nicolas Cellier uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-nice.192.mcz ==================== Summary ==================== Name: Compiler-nice.192 Author: nice Time: 20 February 2011, 5:12:00.371 pm UUID: 3be37582-d3a2-4825-8210-073dd0af3f61 Ancestors: Compiler-ul.191 Let #caseOf: accept any ParseNode argument, not just BraceNode and VariableNode. Remove usage of canBeSpecialArgument which is now unsent. =============== Diff against Compiler-ul.191 =============== Item was changed: ----- Method: MessageNode>>checkBlock:as:from:maxArgs: (in category 'private') ----- checkBlock: node as: nodeName from: encoder maxArgs: maxArgs + "Answer true if node is a BlockNode with at most maxArgs arguments. + This check is required in order to inline some special messages. + Notify some undue usage of these special messages." - "vb: #canBeSpecialArgument for blocks hardcodes 0 arguments as the requirement for special blocks. We work around that here by further checking the number of arguments for blocks.." + node isBlockNode - node canBeSpecialArgument ifTrue: - [^node isBlockNode]. - ^node isBlockNode ifTrue: [node numberOfArguments <= maxArgs + ifTrue: [^true] - ifTrue: [true] ifFalse: [encoder notify: '<- ', nodeName , ' of ' , + (MacroSelectors at: special) , ' has too many arguments']]. + ^false! - (MacroSelectors at: special) , ' has too many arguments']] - ifFalse: - [false]! Item was changed: ----- Method: MessageNode>>transformCase: (in category 'macro transformations') ----- transformCase: encoder | caseNode | caseNode := arguments first. (caseNode isMemberOf: BraceNode) ifTrue: [((caseNode blockAssociationCheck: encoder) and: [arguments size = 1 or: [self checkBlock: arguments last as: 'otherwise arg' from: encoder]]) ifFalse: [^false]. caseNode elements do: [:messageNode| messageNode receiver noteOptimizedIn: self. messageNode arguments first noteOptimizedIn: self]. arguments size = 2 ifTrue: [arguments last noteOptimizedIn: self]. ^true]. + ^false! - (caseNode canBeSpecialArgument and: [(caseNode isMemberOf: BlockNode) not]) ifTrue: - [^false]. "caseOf: variable" - ^encoder notify: 'caseOf: argument must be a brace construct or a variable'! |
On Sun, 20 Feb 2011, [hidden email] wrote:
> Nicolas Cellier uploaded a new version of Compiler to project The Trunk: > http://source.squeak.org/trunk/Compiler-nice.192.mcz > > ==================== Summary ==================== > > Name: Compiler-nice.192 > Author: nice > Time: 20 February 2011, 5:12:00.371 pm > UUID: 3be37582-d3a2-4825-8210-073dd0af3f61 > Ancestors: Compiler-ul.191 > > Let #caseOf: accept any ParseNode argument, not just BraceNode and VariableNode. > Remove usage of canBeSpecialArgument which is now unsent. You were a bit faster again, so I pushed my version to the Inbox. Should we deprecate #canBeSpecialArgument implementations? Levente > > =============== Diff against Compiler-ul.191 =============== > > Item was changed: > ----- Method: MessageNode>>checkBlock:as:from:maxArgs: (in category 'private') ----- > checkBlock: node as: nodeName from: encoder maxArgs: maxArgs > + "Answer true if node is a BlockNode with at most maxArgs arguments. > + This check is required in order to inline some special messages. > + Notify some undue usage of these special messages." > - "vb: #canBeSpecialArgument for blocks hardcodes 0 arguments as the requirement for special blocks. We work around that here by further checking the number of arguments for blocks.." > > + node isBlockNode > - node canBeSpecialArgument ifTrue: > - [^node isBlockNode]. > - ^node isBlockNode > ifTrue: > [node numberOfArguments <= maxArgs > + ifTrue: [^true] > - ifTrue: [true] > ifFalse: [encoder notify: '<- ', nodeName , ' of ' , > + (MacroSelectors at: special) , ' has too many arguments']]. > + ^false! > - (MacroSelectors at: special) , ' has too many arguments']] > - ifFalse: > - [false]! > > Item was changed: > ----- Method: MessageNode>>transformCase: (in category 'macro transformations') ----- > transformCase: encoder > > | caseNode | > caseNode := arguments first. > (caseNode isMemberOf: BraceNode) ifTrue: > [((caseNode blockAssociationCheck: encoder) > and: [arguments size = 1 > or: [self checkBlock: arguments last as: 'otherwise arg' from: encoder]]) ifFalse: > [^false]. > caseNode elements do: > [:messageNode| > messageNode receiver noteOptimizedIn: self. > messageNode arguments first noteOptimizedIn: self]. > arguments size = 2 ifTrue: > [arguments last noteOptimizedIn: self]. > ^true]. > + ^false! > - (caseNode canBeSpecialArgument and: [(caseNode isMemberOf: BlockNode) not]) ifTrue: > - [^false]. "caseOf: variable" > - ^encoder notify: 'caseOf: argument must be a brace construct or a variable'! > > > |
2011/2/20 Levente Uzonyi <[hidden email]>:
> On Sun, 20 Feb 2011, [hidden email] wrote: > >> Nicolas Cellier uploaded a new version of Compiler to project The Trunk: >> http://source.squeak.org/trunk/Compiler-nice.192.mcz >> >> ==================== Summary ==================== >> >> Name: Compiler-nice.192 >> Author: nice >> Time: 20 February 2011, 5:12:00.371 pm >> UUID: 3be37582-d3a2-4825-8210-073dd0af3f61 >> Ancestors: Compiler-ul.191 >> >> Let #caseOf: accept any ParseNode argument, not just BraceNode and >> VariableNode. >> Remove usage of canBeSpecialArgument which is now unsent. > > You were a bit faster again, so I pushed my version to the Inbox. Should we > deprecate #canBeSpecialArgument implementations? > I would rather remove them. Usually, removals are loaded after additions in MC, so a mcm shouldn't be necessary... ...but I never feel comfortable with these tricks. Nicolas > > Levente > >> >> =============== Diff against Compiler-ul.191 =============== >> >> Item was changed: >> ----- Method: MessageNode>>checkBlock:as:from:maxArgs: (in category >> 'private') ----- >> checkBlock: node as: nodeName from: encoder maxArgs: maxArgs >> + "Answer true if node is a BlockNode with at most maxArgs >> arguments. >> + This check is required in order to inline some special messages. >> + Notify some undue usage of these special messages." >> - "vb: #canBeSpecialArgument for blocks hardcodes 0 arguments as the >> requirement for special blocks. We work around that here by further checking >> the number of arguments for blocks.." >> >> + node isBlockNode >> - node canBeSpecialArgument ifTrue: >> - [^node isBlockNode]. >> - ^node isBlockNode >> ifTrue: >> [node numberOfArguments <= maxArgs >> + ifTrue: [^true] >> - ifTrue: [true] >> ifFalse: [encoder notify: '<- ', nodeName , >> ' of ' , >> + (MacroSelectors at: special) , ' >> has too many arguments']]. >> + ^false! >> - (MacroSelectors at: special) , ' >> has too many arguments']] >> - ifFalse: >> - [false]! >> >> Item was changed: >> ----- Method: MessageNode>>transformCase: (in category 'macro >> transformations') ----- >> transformCase: encoder >> >> | caseNode | >> caseNode := arguments first. >> (caseNode isMemberOf: BraceNode) ifTrue: >> [((caseNode blockAssociationCheck: encoder) >> and: [arguments size = 1 >> or: [self checkBlock: arguments last as: >> 'otherwise arg' from: encoder]]) ifFalse: >> [^false]. >> caseNode elements do: >> [:messageNode| >> messageNode receiver noteOptimizedIn: self. >> messageNode arguments first noteOptimizedIn: self]. >> arguments size = 2 ifTrue: >> [arguments last noteOptimizedIn: self]. >> ^true]. >> + ^false! >> - (caseNode canBeSpecialArgument and: [(caseNode isMemberOf: >> BlockNode) not]) ifTrue: >> - [^false]. "caseOf: variable" >> - ^encoder notify: 'caseOf: argument must be a brace construct or a >> variable'! >> >> >> > > |
On Sun, 20 Feb 2011, Nicolas Cellier wrote:
> 2011/2/20 Levente Uzonyi <[hidden email]>: >> On Sun, 20 Feb 2011, [hidden email] wrote: >> >>> Nicolas Cellier uploaded a new version of Compiler to project The Trunk: >>> http://source.squeak.org/trunk/Compiler-nice.192.mcz >>> >>> ==================== Summary ==================== >>> >>> Name: Compiler-nice.192 >>> Author: nice >>> Time: 20 February 2011, 5:12:00.371 pm >>> UUID: 3be37582-d3a2-4825-8210-073dd0af3f61 >>> Ancestors: Compiler-ul.191 >>> >>> Let #caseOf: accept any ParseNode argument, not just BraceNode and >>> VariableNode. >>> Remove usage of canBeSpecialArgument which is now unsent. >> >> You were a bit faster again, so I pushed my version to the Inbox. Should we >> deprecate #canBeSpecialArgument implementations? >> > > I would rather remove them. > Usually, removals are loaded after additions in MC, so a mcm shouldn't > be necessary... > ...but I never feel comfortable with these tricks. This feature is really useful and pretty reliable. Levente > > Nicolas > >> >> Levente >> >>> >>> =============== Diff against Compiler-ul.191 =============== >>> >>> Item was changed: >>> ----- Method: MessageNode>>checkBlock:as:from:maxArgs: (in category >>> 'private') ----- >>> checkBlock: node as: nodeName from: encoder maxArgs: maxArgs >>> + "Answer true if node is a BlockNode with at most maxArgs >>> arguments. >>> + This check is required in order to inline some special messages. >>> + Notify some undue usage of these special messages." >>> - "vb: #canBeSpecialArgument for blocks hardcodes 0 arguments as the >>> requirement for special blocks. We work around that here by further checking >>> the number of arguments for blocks.." >>> >>> + node isBlockNode >>> - node canBeSpecialArgument ifTrue: >>> - [^node isBlockNode]. >>> - ^node isBlockNode >>> ifTrue: >>> [node numberOfArguments <= maxArgs >>> + ifTrue: [^true] >>> - ifTrue: [true] >>> ifFalse: [encoder notify: '<- ', nodeName , >>> ' of ' , >>> + (MacroSelectors at: special) , ' >>> has too many arguments']]. >>> + ^false! >>> - (MacroSelectors at: special) , ' >>> has too many arguments']] >>> - ifFalse: >>> - [false]! >>> >>> Item was changed: >>> ----- Method: MessageNode>>transformCase: (in category 'macro >>> transformations') ----- >>> transformCase: encoder >>> >>> | caseNode | >>> caseNode := arguments first. >>> (caseNode isMemberOf: BraceNode) ifTrue: >>> [((caseNode blockAssociationCheck: encoder) >>> and: [arguments size = 1 >>> or: [self checkBlock: arguments last as: >>> 'otherwise arg' from: encoder]]) ifFalse: >>> [^false]. >>> caseNode elements do: >>> [:messageNode| >>> messageNode receiver noteOptimizedIn: self. >>> messageNode arguments first noteOptimizedIn: self]. >>> arguments size = 2 ifTrue: >>> [arguments last noteOptimizedIn: self]. >>> ^true]. >>> + ^false! >>> - (caseNode canBeSpecialArgument and: [(caseNode isMemberOf: >>> BlockNode) not]) ifTrue: >>> - [^false]. "caseOf: variable" >>> - ^encoder notify: 'caseOf: argument must be a brace construct or a >>> variable'! >>> >>> >>> >> >> > > |
Free forum by Nabble | Edit this page |