#++

Andres Valloud sqrmax at cvtci.com.ar
Sun Jun 13 01:33:27 UTC 1999


Hi.

I've just seen that it takes 4 bytecodes to increment a small integer
by 1, namely:

26 <11> pushTemp: 1
27 <76> pushConstant: 1
28 <B0> send: +
29 <69> popIntoTemp: 1

Wouldn't it be better to have another kind of bytecode, say

26 <F0> incrementTemp: 1 by: 1 "F0 is my guess for an unused bytecode"

It would take two parameters stored in say the next 5 bytes, the first
one the temp number and the second the value of such increment. In
case of failure (overflow into the LargeIntegers), it would execute
<11> <76> <B0> <69>. Note that this bytecode would take care of
incrementing and decrementing SmallIntegers because the second
parameter can be a signed integer. And yes...

<F1> incrementTemp: x byTemp: y "with two extra parameter bytes"

<F0> and <F1> would replace expressions of the kind

x _ x + y

with

x ++ y.

<F2> and <F3> could be #>> and #<<, which in case of failure will rely
on the #bitShift: bytecode. Perhaps the Fx bytecode subset would be
useful.

Is this CISCish or C++-ish??? Or bad? :).
Andres.

PS: The Fx bytecode subset sounds good too!





More information about the Squeak-dev mailing list