[squeak-dev] The Trunk: Compiler-ct.424.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Feb 18 13:19:30 UTC 2021


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

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

Name: Compiler-ct.424
Author: ct
Time: 26 March 2020, 5:19:54.71456 pm
UUID: 10f4405b-896c-3149-b76b-b9cd45ca5734
Ancestors: Compiler-nice.420

Fixes a bug regarding decompilation of FullBlockClosures

Sample to reproduce: [^ true] decompile should NOT return {[]}!

=============== Diff against Compiler-nice.420 ===============

Item was changed:
  ----- Method: Decompiler>>blockTo: (in category 'control') -----
  blockTo: end
+ 	"Decompile a range of code as in statementsTo:, but return a block node. NB: end is an exclusive index."
- 	"Decompile a range of code as in statementsTo:, but return a block node."
  	| exprs block oldBase lastStatementOfBlockIsNil |
  	oldBase := blockStackBase.
  	blockStackBase := stack size.
  	exprs := self statementsTo: end.
  	lastStatementOfBlockIsNil := pc < method endPC and: [exprs notEmpty and: [exprs last == (constTable at: 4)]].
  	lastStatementOfBlockIsNil ifTrue:
  		[exprs := exprs allButLast].
  	block := constructor codeBlock: exprs returns: lastReturnPc = lastPc.
  	blockStackBase := oldBase.
  	lastReturnPc := -1.  "So as not to mislead outer calls"
  	^block!

Item was changed:
  ----- Method: Decompiler>>doClosureCopy:copiedValues: (in category 'control') -----
  doClosureCopy: aCompiledBlock copiedValues: blockCopiedValues
  	"implementation note: must be invoked on a copy because it modifies states"
  	| savedPC blockArgs blockTemps blockTempsOffset block mark |
  	numLocalTemps := aCompiledBlock numTemps - aCompiledBlock numArgs - blockCopiedValues size.
  	blockTempsOffset := aCompiledBlock numArgs + blockCopiedValues size.
  	(blockStartsToTempVars notNil "implies we were intialized with temp names."
  	 and: [blockStartsToTempVars includesKey: aCompiledBlock])
  		ifTrue:
  			[tempVars := blockStartsToTempVars at: aCompiledBlock]
  		ifFalse:
  			[blockArgs := (1 to: aCompiledBlock numArgs) collect:
  							[:i| (constructor
  									codeTemp: i - 1
  									named: 't', (tempVarCount + i) printString)
  								  beBlockArg].
  			blockTemps := (1 to: numLocalTemps) collect:
  							[:i| constructor
  									codeTemp: i + blockTempsOffset - 1
  									named: 't', (tempVarCount + i + aCompiledBlock numArgs) printString].
  			tempVars := blockArgs, blockCopiedValues, blockTemps].
  	tempVarCount := tempVarCount + aCompiledBlock numArgs + numLocalTemps.
  	lastJumpIfPcStack := OrderedCollection new.
  	caseExits := OrderedCollection new.
  	statements := OrderedCollection new: 20.
  	savedPC := pc.
  	self method: (method := aCompiledBlock) pc: aCompiledBlock initialPC.
  	mark := stack size.
+ 	block := self blockTo: aCompiledBlock endPC + 1.
- 	block := self blockTo: aCompiledBlock endPC.
  	mark = stack size ifFalse: [self error: 'block did alter the stack'].
  	^((constructor
  			codeArguments: (tempVars copyFrom: 1 to: aCompiledBlock numArgs)
  			temps: (tempVars copyFrom: blockTempsOffset + 1 to: blockTempsOffset + numLocalTemps)
  			block: block)
  				pc: aCompiledBlock -> savedPC; "c.f. BytecodeEncoder>>pc"
  				yourself).!



More information about the Squeak-dev mailing list