[squeak-dev] The Trunk: Compiler-eem.443.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Oct 2 19:25:37 UTC 2020
Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.443.mcz
==================== Summary ====================
Name: Compiler-eem.443
Author: eem
Time: 2 October 2020, 12:25:28.42646 pm
UUID: c0b19571-c72e-4d7e-9081-41b61e767e6b
Ancestors: Compiler-eem.442
Decompiler/CompiledCode: startKeysToBlockExtents has moved from CompiledMethod to DebuggerMethodMap.
=============== Diff against Compiler-eem.442 ===============
Item was removed:
- ----- Method: CompiledBlock>>startKeysToBlockExtents (in category '*Compiler-support') -----
- startKeysToBlockExtents
- ^self homeMethod startKeysToBlockExtents!
Item was removed:
- ----- Method: CompiledMethod>>blockExtentsInto:from:to:method:numberer: (in category '*Compiler-support') -----
- blockExtentsInto: aDictionary from: initialPC to: endPC method: method numberer: numbererBlock
- "Support routine for startpcsToBlockExtents"
- | pcs extentStart locator scanner blockSizeOrMethodOrLocator |
- self flag: 'belongs in DebuggerMethodMap'.
- extentStart := numbererBlock value.
- locator := BlockStartLocator new.
- scanner := InstructionStream new method: method pc: initialPC.
- pcs := OrderedCollection new.
- [pcs addLast: scanner pc.
- scanner pc <= endPC] whileTrue:
- [blockSizeOrMethodOrLocator := scanner interpretNextInstructionFor: locator.
- blockSizeOrMethodOrLocator ~~ locator ifTrue:
- [blockSizeOrMethodOrLocator isInteger
- ifTrue:
- [self
- blockExtentsInto: aDictionary
- from: scanner pc
- to: scanner pc + blockSizeOrMethodOrLocator - 1
- method: method
- numberer: numbererBlock.
- scanner pc: scanner pc + blockSizeOrMethodOrLocator]
- ifFalse:
- [self assert: blockSizeOrMethodOrLocator isCompiledBlock.
- self
- blockExtentsInto: aDictionary
- from: blockSizeOrMethodOrLocator initialPC
- to: blockSizeOrMethodOrLocator endPC
- method: blockSizeOrMethodOrLocator
- numberer: numbererBlock]]].
- aDictionary
- at: (method isCompiledBlock
- ifTrue: [method]
- ifFalse: [initialPC])
- put: (extentStart to: numbererBlock value).
- ^aDictionary!
Item was removed:
- ----- Method: CompiledMethod>>startKeysToBlockExtents (in category '*Compiler-support') -----
- startKeysToBlockExtents
- "Answer a Dictionary of start key to Interval of blockExtent, using the
- identical numbering scheme described in and orchestrated by
- BlockNode>>analyseArguments:temporaries:rootNode:. A start key
- identifies a block within a method and is either the startpc for an
- embedded block or the block method itself for a full block. This is
- used in part to find the temp names for any block in a method, as
- needed by the debugger. The other half is to recompile the method,
- obtaining the temp names for each block extent. By indirecting through
- the blockExtent instead of using the startpc directly we decouple the
- debugger's access to temp names from the exact bytecode; insulating
- debugging from minor changes in the compiler (e.g. changes in literal
- pooling, adding prefix bytecodes, adding inst vars to CompiledMethod
- in literals towards the end of the literal frame, etc). If the recompilation
- doesn't produce exactly the same bytecode at exactly the same offset
- no matter; the blockExtents will be the same."
- | index |
- self flag: 'belongs in DebuggerMethodMap'.
- index := 0.
- ^self
- blockExtentsInto: self newBlockStartMap
- from: self initialPC
- to: self endPC
- method: self
- numberer: [| value | value := index. index := index + 2. value]!
Item was changed:
----- Method: Decompiler>>mapFromBlockKeysIn:toTempVarsFrom:constructor: (in category 'initialize-release') -----
mapFromBlockKeysIn: aMethod toTempVarsFrom: schematicTempNamesString constructor: aDecompilerConstructor
+ "Answer a (n Identity) Dictionary from block start key to sequence of TermpVarNode & RemoteTempVarNode"
| startMap tempMap |
+ "This rather odd construct is to avoid recursion if we used aMethod methodNode startKeysToBlockExtents,
+ which will invoke this Decompiler if a method has no source."
+ startMap := (DebuggerMethodMap
+ forMethod: aMethod
+ methodNode: nil) startKeysToBlockExtents.
- startMap := aMethod startKeysToBlockExtents.
tempMap := aMethod
mapFromBlockKeys: (startMap keys asArray sort: [:a :b| (startMap at: a) first <= (startMap at: b) first])
toSchematicTemps: schematicTempNamesString.
tempMap keysAndValuesDo:
[:startKey :tempNameTupleVector|
tempNameTupleVector isEmpty ifFalse:
[| subMap numTemps tempVector |
subMap := Dictionary new.
"Find how many temp slots there are (direct & indirect temp vectors)
and for each indirect temp vector find how big it is."
tempNameTupleVector do:
[:tuple|
tuple last isArray
ifTrue:
[subMap at: tuple last first put: tuple last last.
numTemps := tuple last first]
ifFalse:
[numTemps := tuple last]].
"create the temp vector for this scope level."
tempVector := Array new: numTemps.
"fill it in with any indirect temp vectors"
subMap keysAndValuesDo:
[:index :size|
tempVector at: index put: (Array new: size)].
"fill it in with temp nodes."
tempNameTupleVector do:
[:tuple| | itv |
tuple last isArray
ifTrue:
[itv := tempVector at: tuple last first.
itv at: tuple last last
put: (aDecompilerConstructor
codeTemp: tuple last last - 1
named: tuple first)]
ifFalse:
[tempVector
at: tuple last
put: (aDecompilerConstructor
codeTemp: tuple last - 1
named: tuple first)]].
"replace any indirect temp vectors with proper RemoteTempVectorNodes"
subMap keysAndValuesDo:
[:index :size|
tempVector
at: index
put: (aDecompilerConstructor
codeRemoteTemp: index
remoteTemps: (tempVector at: index))].
"and update the entry in the map"
tempMap at: startKey put: tempVector]].
^tempMap!
More information about the Squeak-dev
mailing list
|