Squeak 4.6: Compiler-eem.301.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Squeak 4.6: Compiler-eem.301.mcz

commits-2
Chris Muller uploaded a new version of Compiler to project Squeak 4.6:
http://source.squeak.org/squeak46/Compiler-eem.301.mcz

==================== Summary ====================

Name: Compiler-eem.301
Author: eem
Time: 19 June 2015, 10:01:55.282 am
UUID: 2e7f25b0-33b9-4efc-b492-27a58ff8d78f
Ancestors: Compiler-eem.300

Fix pc range highlighting when at the #+ in the
increment at the end of an optimized to:[by:]do:
loop.

=============== Diff against Compiler-eem.300 ===============

Item was changed:
  ----- Method: MessageNode>>transformToDo: (in category 'macro transformations') -----
  transformToDo: encoder
+ " var := rcvr. L1: [var <= arg1] Bfp(L2) [block body. var := var + inc] Jmp(L1) L2: "
- " var := rcvr. L1: [var <= arg1] Bfp(L2) [block body. var := var + inc]
- Jmp(L1) L2: "
  | limit increment block initStmt test incStmt limitInit blockVar myRange blockRange limitIsAssignedTo |
+ block := arguments last.
  "First check for valid arguments"
+ (block notNil
+ and: [block isBlockNode
+ and: [block numberOfArguments = 1
+ and: [block firstArgument isVariableReference "As with debugger remote vars"]]]) ifFalse:
- ((arguments last isMemberOf: BlockNode)
-  and: [arguments last numberOfArguments = 1
-  and: [arguments last firstArgument isVariableReference "As with debugger remote vars"]]) ifFalse:
  [^false].
  arguments size = 3
  ifTrue: [increment := arguments at: 2.
  (increment isConstantNumber
  and: [increment literalValue ~= 0]) ifFalse: [^false]]
  ifFalse: [increment := encoder encodeLiteral: 1].
  (limit := arguments at: 1) isVariableReference ifTrue:
  [limitIsAssignedTo := false.
+ block nodesDo:
- arguments last nodesDo:
  [:node|
  (node isAssignmentNode and: [node variable = limit]) ifTrue:
  [limitIsAssignedTo := true]].
  limitIsAssignedTo ifTrue:
  [^false]].
  arguments size < 3 ifTrue:   "transform to full form"
  [selector := SelectorNode new key: #to:by:do: code: #macro].
 
  "Now generate auxiliary structures"
  myRange := encoder rawSourceRanges at: self ifAbsent: [1 to: 0].
- block := arguments last.
  blockRange := encoder rawSourceRanges at: block ifAbsent: [1 to: 0].
  blockVar := block firstArgument.
  initStmt := AssignmentNode new variable: blockVar value: receiver.
  limit isVariableReference | limit isConstantNumber
  ifTrue: [limitInit := nil]
  ifFalse:  "Need to store limit in a var"
  [limit := encoder bindBlockArg: blockVar key, 'LimiT' within: block.
  limit scope: -2.  "Already done parsing block; flag so it won't print"
  block addArgument: limit.
  limitInit := AssignmentNode new
  variable: limit
  value: arguments first].
  test := MessageNode new
  receiver: blockVar
  selector: (increment key > 0 ifTrue: [#<=] ifFalse: [#>=])
+ arguments: {limit}
+ precedence: precedence
+ from: encoder
- arguments: (Array with: limit)
- precedence: precedence from: encoder
  sourceRange: (myRange first to: blockRange first).
  incStmt := AssignmentNode new
  variable: blockVar
  value: (MessageNode new
  receiver: blockVar selector: #+
+ arguments: {increment}
+ precedence: precedence
+ from: encoder
+ sourceRange: (myRange last to: (myRange last max: blockRange last)))
- arguments: (Array with: increment)
- precedence: precedence from: encoder)
  from: encoder
+ sourceRange: (myRange last to: (myRange last max: blockRange last)).
+ arguments := {limit. increment. block. initStmt. test. incStmt. limitInit}.
- sourceRange: (myRange last to: myRange last).
- arguments := (Array with: limit with: increment with: block),
- (Array with: initStmt with: test with: incStmt with: limitInit).
  block noteOptimizedIn: self.
  ^true!