[squeak-dev] The Inbox: Kernel-mha.499.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Sep 22 09:50:51 UTC 2010
A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-mha.499.mcz
==================== Summary ====================
Name: Kernel-mha.499
Author: mha
Time: 22 September 2010, 11:50:33.68 am
UUID: 87e9fb72-b8b1-4541-86fb-2a0b72723fed
Ancestors: Kernel-mha.498
CompiledMethod closure protocol cleanup attempt 2:
* support for BlockClosure size extraction
* check whether an executing context is at its end (preliminary)
* incorporated Eliot's cleanup of some block extent methods
* moved block extent methods to accessing and private protocols
=============== Diff against Kernel-mha.498 ===============
Item was added:
+ ----- Method: BlockClosure>>size (in category 'accessing') -----
+ size
+ "Extract this closure's bytecode size (number of bytes) by accessing the closure
+ creation bytecode in the enclosing method."
+
+ ^ ((self method at: self startpc - 2) bitShift: 8) + (self method at: self startpc - 1)!
Item was changed:
+ ----- Method: CompiledMethod>>blockExtentsInto:from:to:scanner:numberer: (in category 'private') -----
- ----- Method: CompiledMethod>>blockExtentsInto:from:to:scanner:numberer: (in category 'debugger support') -----
blockExtentsInto: aDictionary from: initialPC to: endPC scanner: scanner numberer: numbererBlock
"Support routine for startpcsToBlockExtents"
+ | blockStartLocator extentStart blockSizeOrLocator |
- | extentStart blockSizeOrLocator |
self flag: 'belongs in DebuggerMethodMap'.
+ blockStartLocator := BlockStartLocator new.
extentStart := numbererBlock value.
[scanner pc <= endPC] whileTrue:
+ [blockSizeOrLocator := scanner interpretNextInstructionFor: blockStartLocator.
- [blockSizeOrLocator := scanner interpretNextInstructionFor: BlockStartLocator new.
blockSizeOrLocator isInteger ifTrue:
[self
blockExtentsInto: aDictionary
from: scanner pc
to: scanner pc + blockSizeOrLocator - 1
scanner: scanner
numberer: numbererBlock]].
aDictionary at: initialPC put: (extentStart to: numbererBlock value).
^aDictionary!
Item was added:
+ ----- Method: CompiledMethod>>blockRangesAndExtentsInto:from:to:scanner:numberer: (in category 'debugger support') -----
+ blockRangesAndExtentsInto: aDictionary from: initialPC to: endPC scanner: scanner numberer: numbererBlock
+ "Support routine for blockpcsToBlockExtents"
+ | blockStartLocator extentStart blockSizeOrLocator |
+ self flag: 'belongs in DebuggerMethodMap'.
+ blockStartLocator := BlockStartLocator new.
+ extentStart := numbererBlock value.
+ [scanner pc <= endPC] whileTrue:
+ [blockSizeOrLocator := scanner interpretNextInstructionFor: blockStartLocator.
+ blockSizeOrLocator isInteger ifTrue:
+ [self
+ blockRangesAndExtentsInto: aDictionary
+ from: scanner pc
+ to: scanner pc + blockSizeOrLocator - 1
+ scanner: scanner
+ numberer: numbererBlock]].
+ aDictionary at: (initialPC to: endPC) put: (extentStart to: numbererBlock value).
+ ^aDictionary!
Item was added:
+ ----- Method: CompiledMethod>>blockpcsToBlockExtents (in category 'debugger support') -----
+ blockpcsToBlockExtents
+ "Answer a Dictionary of (Interval from startpc to lastpc) to (Interval of blockExtent),
+ for the method and any blocks within it, using the identical numbering scheme described
+ in and orchestrated by BlockNode>>analyseArguments:temporaries:rootNode:.
+ This is a variation on startpcsToBlockExtents which only answers startpc to interval."
+ | index |
+ self flag: 'arguably belongs in DebuggerMethodMap'.
+ index := 0.
+ ^self
+ blockRangesAndExtentsInto: Dictionary new
+ from: self initialPC
+ to: self endPC
+ scanner: (InstructionStream on: self)
+ numberer: [| value | value := index. index := index + 2. value]!
Item was changed:
----- Method: CompiledMethod>>embeddedBlockMethods (in category 'closures') -----
embeddedBlockMethods
| bms extractor scanner |
bms := OrderedCollection new.
+ scanner := self scanner.
- scanner := InstructionStream on: self.
extractor := ClosureExtractor withAction: [ :c | bms add: c ] andScanner: scanner.
[ scanner pc <= self endPC ] whileTrue: [ scanner interpretNextInstructionFor: extractor ].
^ bms!
Item was changed:
+ ----- Method: CompiledMethod>>startpcsToBlockExtents (in category 'accessing') -----
- ----- Method: CompiledMethod>>startpcsToBlockExtents (in category 'debugger support') -----
startpcsToBlockExtents
"Answer a Dictionary of startpc to Interval of blockExtent, using the
identical numbering scheme described in and orchestrated by
BlockNode>>analyseArguments:temporaries:rootNode:. 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: Dictionary new
from: self initialPC
to: self endPC
scanner: (InstructionStream on: self)
numberer: [| value | value := index. index := index + 2. value]!
Item was added:
+ ----- Method: MethodContext>>atEnd (in category 'testing') -----
+ atEnd
+ ^ self isExecutingBlock
+ ifTrue: [ self closure startpc + self closure size - 1 = self pc ]
+ ifFalse: [ self pc >= self method endPC ]!
More information about the Squeak-dev
mailing list
|