[squeak-dev] The Trunk: Kernel-nice.1447.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Mar 10 09:17:32 UTC 2022
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.1447.mcz
==================== Summary ====================
Name: Kernel-nice.1447
Author: nice
Time: 10 March 2022, 10:17:27.088899 am
UUID: 2d34a5d9-c171-c04b-8e95-8f97913fdeef
Ancestors: Kernel-mt.1446
Fix interpretation of push character literal bytecode (233)
See https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/618.
Since character have unsigned values, the extend B bytecode (225) value must be interpreted unsigned.
We do this with bitAnd: 16rFF because it restores unsignedness of a single byte:
(0 to: 255) allSatisfy: [:extB | ((extB > 127 ifTrue: [extB - 256] ifFalse: [extB]) bitAnd: 16rFF) = extB].
and because we assume that extB is a single byte. This would be untrue if we would use multiple consecutive extend B bytecode to encode character value > 16rFFFF, but until now we don't - see EncoderForSistaV1>>#genPushCharacter:
=============== Diff against Kernel-mt.1446 ===============
Item was changed:
----- Method: InstructionStream>>interpretNext2ByteSistaV1Instruction:for:extA:extB:startPC: (in category 'decoding - private - sista v1') -----
interpretNext2ByteSistaV1Instruction: bytecode for: client extA: extA extB: extB startPC: startPC
"Send to the argument, client, a message that specifies the next instruction.
This method handles the two-byte codes.
For a table of the bytecode set, see EncoderForV1's class comment."
| byte method |
method := self method.
byte := self method at: pc.
pc := pc + 1.
"We do an inline quasi-binary search on bytecode"
bytecode < 234 ifTrue: "pushes"
[bytecode < 231 ifTrue:
[bytecode < 229 ifTrue:
[| literal |
bytecode = 226 ifTrue:
[^client pushReceiverVariable: (extA bitShift: 8) + byte].
literal := method literalAt: (extA bitShift: 8) + byte + 1.
bytecode = 227 ifTrue:
[^client pushLiteralVariable: literal].
^client pushConstant: literal].
bytecode = 229 ifTrue:
[^client pushTemporaryVariable: byte].
^self unusedBytecode: client at: startPC].
bytecode = 231 ifTrue:
[^byte < 128
ifTrue: [client pushNewArrayOfSize: byte]
ifFalse: [client pushConsArrayWithElements: byte - 128]].
bytecode = 232 ifTrue:
[^client pushSpecialConstant: ((extB < 128 ifTrue: [extB] ifFalse: [extB - 256]) bitShift: 8) + byte].
+ ^client pushSpecialConstant: (Character value: ((extB bitAnd: 16rFF) bitShift: 8) + byte)].
- ^client pushSpecialConstant: (Character value: (extB bitShift: 8) + byte)].
bytecode < 240 ifTrue: "sends, trap and jump"
[bytecode < 236 ifTrue: "sends"
[(bytecode = 235 and: [extB >= 64]) ifTrue:
[^client
directedSuperSend: (method literalAt: (extA bitShift: 5) + (byte // 8) + 1)
numArgs: (extB - 64 bitShift: 3) + (byte \\ 8)].
^client
send: (method literalAt: (extA bitShift: 5) + (byte // 8) + 1)
super: bytecode = 235
numArgs: (extB bitShift: 3) + (byte \\ 8)].
bytecode = 236 ifTrue:
[^client callMappedInlinedPrimitive: byte].
bytecode = 237 ifTrue:
[^client jump: (extB bitShift: 8) + byte].
^client jump: (extB bitShift: 8) + byte if: bytecode = 238].
bytecode < 243 ifTrue:
[bytecode = 240 ifTrue:
[^client popIntoReceiverVariable: (extA bitShift: 8) + byte].
bytecode = 241 ifTrue:
[^client popIntoLiteralVariable: (method literalAt: (extA bitShift: 8) + byte + 1)].
^client popIntoTemporaryVariable: byte].
bytecode = 243 ifTrue:
[^client storeIntoReceiverVariable: (extA bitShift: 8) + byte].
bytecode = 244 ifTrue:
[^client storeIntoLiteralVariable: (method literalAt: (extA bitShift: 8) + byte + 1)].
bytecode = 245 ifTrue:
[^client storeIntoTemporaryVariable: byte].
"246-247 1111011 i xxxxxxxx UNASSIGNED"
^self unusedBytecode: client at: startPC!
More information about the Squeak-dev
mailing list
|