[Pkg] The Trunk: Compiler-eem.374.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Mar 10 01:26:57 UTC 2018


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

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

Name: Compiler-eem.374
Author: eem
Time: 9 March 2018, 5:26:54.927757 pm
UUID: 346de92b-2782-45ad-b91b-fc790654a88f
Ancestors: Compiler-eem.373

Make reindexingLiteralsDo: more robust when literals get added during blocks and are used in an outer scope after use in a block.  c.f. Compiler-eem.369

=============== Diff against Compiler-eem.373 ===============

Item was changed:
  ----- Method: BytecodeEncoder>>reindexingLiteralsDo: (in category 'code generation') -----
  reindexingLiteralsDo: aBlock
+ 	"Reset any and all literals so that they will be given new indices in
+ 	 the literalStream during aBlock (which will be used to generate a
+ 	 nested block method).  Afterwards restore those same literals to
+ 	 their original state, and reset any and all new literals added during
+ 	 aBlock  so that they will be given new indices if used subsequently."
  	| savedNodes saveBlock |
  	savedNodes := IdentityDictionary new.
+ 	saveBlock := [:node|
+ 					savedNodes at: node put: node shallowCopy.
+ 					node resetForBlockGeneration].
- 	saveBlock := [:node| savedNodes at: node put: node shallowCopy.  node resetForBlockGeneration].
  	litSet do: saveBlock.
  	litIndSet do: saveBlock.
  	selectorSet do: saveBlock.
  	^aBlock ensure:
  		[| restoreBlock |
+ 		 restoreBlock := [:node|
+ 							savedNodes
+ 								at: node
+ 								ifPresent: [:copy| node resetFromCopy: copy]
+ 								ifAbsent: [node resetForBlockGeneration]].
- 		 restoreBlock := [:node| node resetFromCopy: (savedNodes at: node)].
  		 litSet do: restoreBlock.
  		 litIndSet do: restoreBlock.
+ 		 selectorSet do: restoreBlock]!
- 		 selectorSet do: [:node| node resetFromCopy: (savedNodes at: node ifAbsent: [node])]]!



More information about the Packages mailing list