[erlang-questions] 64-bit erlang

Bjorn Gustavsson <>
Thu Nov 29 15:10:43 CET 2007


jm <> writes:

> Bjorn Gustavsson wrote:
> 
> > It could also be possible to somewhat shrink the Beam code to
> > better use the larger word size (packing more operands into one word).
> > The savings would probably be minor, but could be still be worthwhile
> > as it is relatively straight-forward to do.
> 
> Would this be something like ARM's thumb code 
> (http://en.wikipedia.org/wiki/ARM_architecture#Thumb) or more like lzw 
> compression of blocks of code?

Neither. Here is an example. The follow code sequence

        init {y,0}
        init {y,1}
        init {y,2}
        init {y,5}
        init {y,6}
        init {y,8}

will be rewritten to

        init3 {y,0} {y,1} {y,2}
        init3 {y,5} {y,6} {y,8}

by the current loader. The instruction itself requires one word, and
the operands are all packed into one word. The entire sequence thus
takes four words.

On a 64-bit machine, one instruction would be enough:

        init6 {y,0} {y,1} {y,2} {y,5} {y,6} {y,8}

Only two words would be needed.

(This was only an example. A sequence of 6 init instructions is probably
not that commone, especically not in R12B.)

/Bjorn
-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list