[squeak-dev] The Trunk: Compiler-nice.129.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Mar 1 22:24:42 UTC 2010
Nicolas Cellier uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-nice.129.mcz
==================== Summary ====================
Name: Compiler-nice.129
Author: nice
Time: 1 March 2010, 11:24:30.271 pm
UUID: a27b827d-1354-1147-bc1a-edeb6e1f0e97
Ancestors: Compiler-nice.128
Fix Compiler/Decompiler temporary slot mismatch
http://bugs.squeak.org/view.php?id=7467
See also my comments in response to
http://lists.squeakfoundation.org/pipermail/squeak-dev/2010-March/145280.html
Eliot, please check....
=============== Diff against Compiler-nice.128 ===============
Item was changed:
InstructionStream subclass: #Decompiler
instanceVariableNames: 'constructor method instVars tempVars constTable stack statements lastPc exit caseExits lastJumpPc lastReturnPc limit hasValue blockStackBase numLocalTemps blockStartsToTempVars tempVarCount'
classVariableNames: 'ArgumentFlag CascadeFlag CaseFlag IfNilFlag'
poolDictionaries: ''
category: 'Compiler-Kernel'!
+ !Decompiler commentStamp: 'nice 3/1/2010 19:56' prior: 0!
- !Decompiler commentStamp: '<historical>' prior: 0!
I decompile a method in three phases:
Reverser: postfix byte codes -> prefix symbolic codes (nodes and atoms)
Parser: prefix symbolic codes -> node tree (same as the compiler)
Printer: node tree -> text (done by the nodes)
instance vars:
+ constructor <DecompilerConstructor> an auxiliary knowing how to generate Abstract Syntax Tree (node tree)
+ method <CompiledMethod> the method being decompiled
+ instVars <Array of: String> the instance variables of the class implementing method
+ tempVars <String | (OrderedCollection of: String)> hold the names of temporary variables (if known)
+ NOTE: POLYMORPHISM WILL BE RESOLVED IN #initSymbols:
+ constTable <Collection of: ParseNode> parse node associated with byte encoded constants (nil true false 0 1 -1 etc...)
+ stack <OrderedCollection of: (ParseNode | String | Integer) > multipurpose...
+ statements <OrderedCollection of: ParseNode> the statements of the method being decompiled
+ lastPc <Integer>
+ exit <Integer>
+ caseExits <OrderedCollection of: Integer> - stack of exit addresses that have been seen in the branches of caseOf:'s
+ lastJumpPc <Integer>
+ lastReturnPc <Integer>
+ limit <Integer>
+ hasValue <Boolean>
+ blockStackBase <Integer>
+ numLocaltemps <Integer | Symbol> - number of temps local to a block; also a flag indicating decompiling a block
+ blockStartsToTempVars <Dictionary key: Integer value: (OrderedCollection of: String)>
+ tempVarCount <Integer> number of temp vars used by the method!
- constructor
- method
- instVars
- tempVars
- constTable
- stack
- statements
- lastPc
- exit
- caseExits - stack of exit addresses that have been seen in the branches of caseOf:'s
- lastJumpPc
- lastReturnPc
- limit
- hasValue
- blockStackBase
- numLocaltemps - number of temps local to a block; also a flag indicating decompiling a block!
Item was added:
+ ----- Method: BlockNode>>makeTemporariesRemovable (in category 'code generation (closures)') -----
+ makeTemporariesRemovable
+ "Utilities for when we want to remove some temporaries."
+
+ temporaries isArray ifTrue:
+ [temporaries := temporaries asOrderedCollection].!
Item was changed:
----- Method: BlockNode>>addRemoteTemp:rootNode: (in category 'code generation (closures)') -----
addRemoteTemp: aTempVariableNode rootNode: rootNode "<MethodNode>"
"Add aTempVariableNode to my actualScope's sequence of
remote temps. If I am an optimized block then the actual
scope is my actualScopeIfOptimized, otherwise it is myself."
- temporaries isArray ifTrue:
- [temporaries := temporaries asOrderedCollection].
remoteTempNode == nil ifTrue:
[remoteTempNode := RemoteTempVectorNode new
name: self remoteTempNodeName
index: arguments size + temporaries size
type: LdTempType
scope: 0.
actualScopeIfOptimized
ifNil:
+ [self addTempNode: remoteTempNode.
- [temporaries addLast: remoteTempNode.
remoteTempNode definingScope: self]
ifNotNil: [actualScopeIfOptimized addHoistedTemps: { remoteTempNode }]].
remoteTempNode addRemoteTemp: aTempVariableNode encoder: rootNode encoder.
"use remove:ifAbsent: because the deferred analysis for optimized
loops can result in the temp has already been hoised into the root."
+ self actualScope removeTempNode: aTempVariableNode ifAbsent: [].
- temporaries remove: aTempVariableNode ifAbsent: [].
^remoteTempNode!
Item was added:
+ ----- Method: BlockNode>>addTempNode: (in category 'code generation (closures)') -----
+ addTempNode: aTempVariableNode
+ "Utilities for when we want to add some temporaries."
+
+ self makeTemporariesRemovable.
+ ^temporaries add: aTempVariableNode!
Item was added:
+ ----- Method: BlockNode>>removeTempNode:ifAbsent: (in category 'code generation (closures)') -----
+ removeTempNode: aTempVariableNode ifAbsent: aBlock
+ "Utilities for when we want to remove some temporaries."
+
+ self makeTemporariesRemovable.
+ ^temporaries remove: aTempVariableNode ifAbsent: aBlock
+ !
More information about the Squeak-dev
mailing list
|