The Trunk: Compiler-ul.332.mcz

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

The Trunk: Compiler-ul.332.mcz

commits-2
Levente Uzonyi uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-ul.332.mcz

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

Name: Compiler-ul.332
Author: ul
Time: 13 March 2017, 4:02:25.191527 am
UUID: 7bcb6664-de39-420a-97ab-8968cd28927e
Ancestors: Compiler-dtl.331

SortedCollection Whack-a-mole

=============== Diff against Compiler-dtl.331 ===============

Item was changed:
  ----- Method: Encoder>>sourceMap (in category 'source mapping') -----
  sourceMap
  "Answer with a sorted set of associations (pc range)."
 
+ ^sourceRanges associations
+ replace: [ :association | Association key: association key pc value: association value ];
+ sort!
- ^ (sourceRanges keys collect:
- [:key |  Association key: key pc value: (sourceRanges at: key)])
- asSortedCollection!

Item was changed:
  ----- Method: Encoder>>tempNodes (in category 'results') -----
+ tempNodes
+
- tempNodes
  | tempNodes |
+ tempNodes := OrderedCollection new.
- tempNodes := SortedCollection sortBlock: [:n1 :n2 | n1 code <= n2 code].
  scopeTable associationsDo:
  [:assn |
  assn value isArray
  ifTrue: [assn value do: [:temp| tempNodes add: temp]]
  ifFalse: [assn value isTemp ifTrue: [tempNodes add: assn value]]].
+ ^tempNodes sort: [:n1 :n2 | n1 code <= n2 code]!
- ^tempNodes!

Item was changed:
  ----- Method: MessageNode>>analyseTempsWithin:rootNode:assignmentPools: (in category 'code generation (closures)') -----
  analyseTempsWithin: scopeBlock "<BlockNode>" rootNode: rootNode "<MethodNode>" assignmentPools: assignmentPools "<Dictionary>"
  "Assignments within optimized loops are tricky.  Because a loop repeats a
  write to a temporary in an optimized loop effectively occurs after the loop.
  To handle this collect the set of temps assigned to in optimized loops and
  add extra writes after traversing the optimized loop constituents."
  | writtenToTemps |
  self isOptimizedLoop ifTrue:
  [{ receiver }, arguments do:
  [:node|
  (node notNil and: [node isBlockNode and: [node optimized]]) ifTrue:
  [assignmentPools at: node put: Set new]]].
  "receiver is nil in cascades"
  receiver == nil ifFalse:
  [receiver analyseTempsWithin: scopeBlock rootNode: rootNode assignmentPools: assignmentPools].
  arguments do:
  [:node|
  node == nil ifFalse: "last argument of optimized to:do: can be nil"
  [node analyseTempsWithin: scopeBlock rootNode: rootNode assignmentPools: assignmentPools]].
  "Add assignments representing subsequent iterations
  and redo the closure analysis for the written-to temps."
  self isOptimizedLoop ifTrue:
  [writtenToTemps := Set new.
  { receiver }, arguments do:
  [:node|
  (node notNil and: [node isBlockNode and: [node optimized]]) ifTrue:
  [(assignmentPools removeKey: node) do:
  [:temp|
  temp isBlockArg ifFalse: "ignore added assignments to to:do: loop args"
  [writtenToTemps add: temp.
  temp addWriteWithin: node at: rootNode locationCounter]]]].
  writtenToTemps isEmpty ifFalse:
+ [(writtenToTemps sorted: ParseNode tempSortBlock) do:
- [(writtenToTemps asSortedCollection: ParseNode tempSortBlock) do:
  [:each| each analyseClosure: rootNode].
  (writtenToTemps collect: [:each| each definingScope]) do:
  [:blockNode|
  blockNode ifHasRemoteTempNodeEnsureInitializationStatementExists: rootNode]]]!

Item was changed:
  ----- Method: RemoteTempVectorNode>>printDefinitionForClosureAnalysisOn: (in category 'printing') -----
  printDefinitionForClosureAnalysisOn: aStream
  | refs |
  aStream
  nextPut: ${;
  nextPutAll: key.
  definingScope ifNotNil: [definingScope blockExtent ifNotNil: [:be| aStream nextPutAll: ' d@'; print: be first]].
  readingScopes ifNotNil: [
  refs := Set new.
  readingScopes do: [:elems| refs addAll: elems].
+ refs sorted do: [:read| aStream nextPutAll: ' r@'; print: read]].
- refs asSortedCollection do: [:read| aStream nextPutAll: ' r@'; print: read]].
  remoteTemps
  do: [:rt| rt printDefinitionForClosureAnalysisOn: aStream]
  separatedBy: [aStream nextPut: $,; space].
  aStream nextPut: $}!

Item was changed:
  ----- Method: TempVariableNode>>printDefinitionForClosureAnalysisOn: (in category 'printing') -----
  printDefinitionForClosureAnalysisOn: aStream
  | refs |
  aStream
  nextPut: ${;
  nextPutAll: key.
  definingScope ifNotNil: [definingScope blockExtent ifNotNil: [:be| aStream nextPutAll: ' d@'; print: be first]].
  readingScopes notNil ifTrue:
  [refs := Set new.
  readingScopes do: [:elems| refs addAll: elems].
+ refs sorted do: [:read| aStream nextPutAll: ' r@'; print: read]].
- refs asSortedCollection do: [:read| aStream nextPutAll: ' r@'; print: read]].
  writingScopes notNil ifTrue:
  [refs := Set new.
  writingScopes do: [:elems| refs addAll: elems].
+ refs sorted do: [:write| aStream nextPutAll: ' w@'; print: write]].
- refs asSortedCollection do: [:write| aStream nextPutAll: ' w@'; print: write]].
  aStream nextPut: $}!

Item was changed:
  ----- Method: TempVariableNode>>printWithClosureAnalysisOn:indent: (in category 'printing') -----
  printWithClosureAnalysisOn: aStream indent: level
 
  aStream nextPutAll: name.
  readingScopes notNil ifTrue:
+ [(readingScopes inject: Set new into: [:them :reads| them addAll: reads. them]) sorted do:
- [(readingScopes inject: Set new into: [:them :reads| them addAll: reads. them]) asSortedCollection do:
  [:location|
  aStream space; nextPut: $r; nextPut: $@; print: location]].
  writingScopes notNil ifTrue:
+ [(writingScopes inject: Set new into: [:them :writes| them addAll: writes. them]) sorted do:
- [(writingScopes inject: Set new into: [:them :writes| them addAll: writes. them]) asSortedCollection do:
  [:location|
  aStream space; nextPut: $w; nextPut: $@; print: location]]!