[squeak-dev] The Trunk: Compiler-bf.390.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Aug 20 06:24:31 UTC 2018

Bert Freudenberg uploaded a new version of Compiler to project The Trunk:

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

Name: Compiler-bf.390
Author: bf
Time: 19 August 2018, 11:24:12.350952 pm
UUID: d76ef6ae-8303-476d-bb1e-640b2476c276
Ancestors: Compiler-eem.389

Fix source range for caseOf: debugging

=============== Diff against Compiler-eem.389 ===============

Item was changed:
  ----- Method: MessageNode>>emitCodeForCase:encoder:value: (in category 'code generation') -----
  emitCodeForCase: stack encoder: encoder value: forValue
  	| braceNode sizeStream allReturn |
  	forValue ifFalse:
  		[^super emitCodeForEffect: stack encoder: encoder].
  	braceNode := arguments first.
  	sizeStream := ReadStream on: sizes.
  	receiver emitCodeForValue: stack encoder: encoder.
  	"There must be at least one branch around the otherwise/caseError
  	  so the decompiler can identify the end of the otherwise/caseError."
  	allReturn := true. "assume every case ends with a return"
  	braceNode casesForwardDo:
  		[:keyNode :valueNode :last | | thenSize elseSize |
  		thenSize := sizeStream next.
  		elseSize := sizeStream next.
  		last ifFalse: [encoder genDup. stack push: 1].
  		keyNode emitCodeForEvaluatedValue: stack encoder: encoder.
+ 		keyNode pc: encoder pc.
  		equalNode emitCode: stack args: 1 encoder: encoder.
  		self emitCodeForBranchOn: false dist: thenSize pop: stack encoder: encoder.
  		last ifFalse: [encoder genPop. stack pop: 1].
  		valueNode emitCodeForEvaluatedValue: stack encoder: encoder.
  		last ifTrue: [stack pop: 1].
  		valueNode returns ifFalse:
  			[self emitCodeForJump: elseSize encoder: encoder.
  			 allReturn := false].
  		(last and: [allReturn]) ifTrue:
  			[self emitCodeForJump: elseSize encoder: encoder]].
  	arguments size = 2
  			[arguments last emitCodeForEvaluatedValue: stack encoder: encoder] "otherwise: [...]"
  			[NodeSelf emitCodeForValue: stack encoder: encoder.
  			caseErrorNode emitCode: stack args: 0 encoder: encoder]!

More information about the Squeak-dev mailing list