[squeak-dev] The Trunk: Compiler-mt.477.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jun 15 07:15:26 UTC 2022


Marcel Taeumel uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-mt.477.mcz

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

Name: Compiler-mt.477
Author: mt
Time: 8 June 2022, 2:04:54.227335 pm
UUID: 814c7797-c5f1-4844-bb20-83e85b5656ca
Ancestors: Compiler-mt.476

Fixes decompilation of

1 caseOf: { [ 1 ] -> [ | x | [ true ] whileTrue: [ x := 42 ] ] }.

See https://github.com/squeak-smalltalk/squeak-object-memory/issues/36

=============== Diff against Compiler-mt.476 ===============

Item was changed:
  ----- Method: Decompiler>>startAndLimitFor:from:into: (in category 'private') -----
  startAndLimitFor: incrVar from: aStack into: binaryBlock
  	"If incrVar matches the increment of a whileLoop at the end of statements
  	 evaluate binaryBlock with the init statement for incrVar and the init statement
  	 for the block's limit, if any, and answer true.  Otherwise answer false.  Used to
  	 help convert whileTrue: loops into to:[by:]do: loops."
  	| guard initExpr limitInit size |
  	((size := aStack size) >= 1
+ 	 and: [(initExpr := aStack at: size) ~~ CaseFlag]
+ 	 and: [initExpr isAssignmentNode]) ifFalse:
- 	 and: [(initExpr := aStack at: size) isAssignmentNode]) ifFalse:
  		[^false].
  	initExpr variable == incrVar ifTrue:
  		[binaryBlock value: initExpr value: nil.
  		 ^true].
  	limitInit := initExpr.
  	(size >= 2
  	 and: [(initExpr := aStack at: size - 1) isAssignmentNode
  	 and: [initExpr variable == incrVar
  	 and: [(guard := statements last receiver) isBlockNode
  	 and: [guard statements size = 1
  	 and: [(guard := guard statements first) isMessageNode
  	 and: [guard receiver == incrVar
  	 and: [guard arguments first == limitInit variable]]]]]]]) ifTrue:
  		[binaryBlock value: initExpr value: limitInit.
  		 ^true].
  	^false!



More information about the Squeak-dev mailing list