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

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Thu Mar 26 17:13:19 UTC 2020


Don't we have a test for this at the moment?

<http://www.hpi.de/>
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Donnerstag, 26. März 2020 17:20:00
An: squeak-dev at lists.squeakfoundation.org
Betreff: [squeak-dev] The Inbox: Compiler-ct.424.mcz

Christoph Thiede uploaded a new version of Compiler to project The Inbox:
http://source.squeak.org/inbox/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).!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200326/5b5b6f8f/attachment.html>


More information about the Squeak-dev mailing list