Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.477.mcz==================== Summary ====================
Name: Kernel-eem.477
Author: eem
Time: 14 August 2010, 7:05:27.885 pm
UUID: 56dc3c2a-e134-4477-98c4-653096627951
Ancestors: Kernel-dtl.476
Add a followingBytecode to InstructionStream, e.g.
SystemNavigation default browseAllSelect:
[:m| | is |
m isQuick not
and: [is := InstructionStream on: m.
is scanFor: [:b| b = 16r8F
and: [is secondByte ~= 0
and: [is followingBytecode = 115]]]]]
=============== Diff against Kernel-dtl.476 ===============
Item was added:
+ ----- Method: InstructionStream>>nextPc: (in category 'private') -----
+ nextPc: currentByte
+ "Answer the pc of the next bytecode following the current one, given the current bytecode.."
+
+ | type |
+ type := currentByte // 16.
+ ^type = 8 "extensions"
+ ifTrue: [pc + (#(2 2 2 2 3 2 2 1 1 1 2 1 3 3 3 4) at: currentByte \\ 16 + 1)]
+ ifFalse: [type = 10 "long jumps"
+ ifTrue: [pc + 2]
+ ifFalse: [pc + 1]]!
Item was changed:
----- Method: InstructionStream>>scanFor: (in category 'scanning') -----
scanFor: scanBlock
+ "Answer the index of the first bytecode for which scanBlock
+ answers true when supplied with that bytecode."
- "Answer the index of the first bytecode for which scanBlock answer true
- when supplied with that bytecode."
+ | method end byte |
- | method end byte type |
method := self method.
end := method endPC.
[pc <= end] whileTrue:
[(scanBlock value: (byte := method at: pc)) ifTrue:
[^true].
+ pc := self nextPc: byte].
- type := byte // 16.
- pc := type = 8 "extensions"
- ifTrue: [pc + (#(2 2 2 2 3 2 2 1 1 1 2 1 3 3 3 4) at: byte \\ 16 + 1)]
- ifFalse: [type = 10 "long jumps"
- ifTrue: [pc + 2]
- ifFalse: [pc + 1]]].
^false!
Item was added:
+ ----- Method: InstructionStream>>followingBytecode (in category 'scanning') -----
+ followingBytecode
+ "Answer the bytecode of the following bytecode (different to nextByte)."
+
+ ^self method at: self followingPc!
Item was added:
+ ----- Method: InstructionStream>>followingPc (in category 'scanning') -----
+ followingPc
+ "Answer the pc of the following bytecode."
+
+ ^self nextPc: (self method at: pc)!