The Trunk: Compiler-eem.398.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-eem.398.mcz

commits-2
Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.398.mcz

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

Name: Compiler-eem.398
Author: eem
Time: 3 January 2019, 3:47:34.750814 pm
UUID: 641c8172-6e85-49c8-aa42-0e2cd184e05a
Ancestors: Compiler-eem.397

Fix a spelling error

=============== Diff against Compiler-eem.397 ===============

Item was changed:
  ----- Method: MethodNode>>preenableNodes (in category 'converting-private') -----
  preenableNodes
  "Answer a Dictionary from node or sequence of nodes to preen method selector for nodes
  in the tree that require post-processing after either a format or a decompile.  Such issues
  are the variable for an ifNotNil: which is local to the ifNotNil: block but, due to the inlining
  of ifNotNil: appears to be declared at the outer level, and, similarly, a temporary variable
  that conflicts with one of the same name in a block when, were the variable declared
  local to some inlined block it would no longer conflict.  The resulting dictionary is used to
  perform the value with the key (node or array) as argument to preen the tree."
 
  | preenableNodes priorBlocks priorVariables |
  preenableNodes := Dictionary new.
  priorBlocks := OrderedCollection new.
  priorVariables := Set new.
+ self nodesWithPrecedingStatementsDo:
- self nodesWithPreceedingStatementsDo:
  [:node :preceedingStatementOrNil| | variable temps |
  (node isMessageNode
  and: [node macroPrinter == #printIfNilNotNil:indent:
  and: [node receiver isMessageNode
  and: [node receiver selector key == #==
  and: [node receiver receiver isAssignmentNode
  and: [(variable := node receiver receiver variable) isTemp
  and: [variable isRemote not
  and: [variable isOnlySubnodeOf: node in: self]]]]]]]) ifTrue:
  [preenableNodes at: node put: #preenIfNotNilNode:.
  priorVariables add: variable].
  node isBlockNode ifTrue:
  [temps := OrderedCollection new.
  node temporaries do:
  [:temp|
  priorBlocks do:
  [:aBlock|
  aBlock temporaries do:
  [:priorTemp|
  (priorVariables includes: priorTemp) ifFalse:
  [priorTemp key = temp key ifTrue:
  [temps addLast: priorTemp]]]]].
  temps isEmpty ifFalse:
  [preenableNodes at: temps put: #preenTempsConflictingWithBlockNode:].
  priorBlocks addLast: node].
  (node == NodeNil
  and: [preceedingStatementOrNil notNil
  and: [preceedingStatementOrNil isMessageNode
  and: [preceedingStatementOrNil isNilIf]]]) ifTrue:
  [preenableNodes at: preceedingStatementOrNil put: #preenNilNodeFollowingNilIfNode:]].
  ^preenableNodes!

Item was added:
+ ----- Method: ParseNode>>nodesWithPrecedingStatementsDo: (in category 'visiting') -----
+ nodesWithPrecedingStatementsDo: aBinaryBlock
+ self accept: (ParseNodeWithPrecedingStatementEnumerator ofBlock: aBinaryBlock)!

Item was removed:
- ----- Method: ParseNode>>nodesWithPreceedingStatementsDo: (in category 'visiting') -----
- nodesWithPreceedingStatementsDo: aBinaryBlock
- self accept: (ParseNodeWithPreceedingStatementEnumerator ofBlock: aBinaryBlock)!

Item was added:
+ ParseNodeEnumerator subclass: #ParseNodeWithPrecedingStatementEnumerator
+ instanceVariableNames: 'precedingStatement'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Compiler-Support'!

Item was added:
+ ----- Method: ParseNodeWithPrecedingStatementEnumerator>>ofBlock: (in category 'initialize-release') -----
+ ofBlock: aBlock
+ "N.B. This enumerator visits a node before any of the node's children.
+ Hence, when enumewrating statements in a block, we can ensure that
+ the second argument to the block, the preceeding statement, is non-nil
+ only for top-level statements in the block by nilling out preceedingStatement
+ once the block is evaluated. Perhaps stronger would be to capture its value
+ in a temporary and nil it before evaluating, but this is good enough."
+ theBlock := [:node|
+ aBlock value: node value: precedingStatement.
+ preceedingStatement := nil]!

Item was added:
+ ----- Method: ParseNodeWithPrecedingStatementEnumerator>>ofBlock:select: (in category 'initialize-release') -----
+ ofBlock: aBlock select: aSelectBlock
+ self ofBlock: aBlock.
+ theSelectBlock := aSelectBlock!

Item was added:
+ ----- Method: ParseNodeWithPrecedingStatementEnumerator>>visitBlockNode: (in category 'visiting') -----
+ visitBlockNode: aBlockNode
+ | savedPrecedingStatement |
+ (theSelectBlock isNil or: [theSelectBlock value: aBlockNode]) ifFalse:
+ [^nil].
+ theBlock value: aBlockNode.
+ savedPrecedingStatement := precedingStatement.
+ precedingStatement := nil.
+ [aBlockNode statements do:
+ [:statement|
+ statement accept: self.
+ precedingStatement := statement]] ensure:
+ [precedingStatement := savedPrecedingStatement]!

Item was removed:
- ParseNodeEnumerator subclass: #ParseNodeWithPreceedingStatementEnumerator
- instanceVariableNames: 'preceedingStatement'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Compiler-Support'!

Item was removed:
- ----- Method: ParseNodeWithPreceedingStatementEnumerator>>ofBlock: (in category 'initialize-release') -----
- ofBlock: aBlock
- "N.B. This enumerator visits a node before any of the node's children.
- Hence, when enumewrating statements in a block, we can ensure that
- the second argument to the block, the preceeding statement, is non-nil
- only for top-level statements in the block by nilling out preceedingStatement
- once the block is evaluated. Perhaps stronger would be to capture its value
- in a temporary and nil it before evaluating, but this is good enough."
- theBlock := [:node|
- aBlock value: node value: preceedingStatement.
- preceedingStatement := nil]!

Item was removed:
- ----- Method: ParseNodeWithPreceedingStatementEnumerator>>ofBlock:select: (in category 'initialize-release') -----
- ofBlock: aBlock select: aSelectBlock
- self ofBlock: aBlock.
- theSelectBlock := aSelectBlock!

Item was removed:
- ----- Method: ParseNodeWithPreceedingStatementEnumerator>>visitBlockNode: (in category 'visiting') -----
- visitBlockNode: aBlockNode
- | savedPreceedingStatement |
- (theSelectBlock isNil or: [theSelectBlock value: aBlockNode]) ifFalse:
- [^nil].
- theBlock value: aBlockNode.
- savedPreceedingStatement := preceedingStatement.
- preceedingStatement := nil.
- [aBlockNode statements do:
- [:statement|
- statement accept: self.
- preceedingStatement := statement]] ensure:
- [preceedingStatement := savedPreceedingStatement]!