[erlang-questions] How small could an Erlang emulator be?

Bjorn Gustavsson bjorn@REDACTED
Tue Mar 13 09:36:31 CET 2007


ok <ok@REDACTED> writes:

> On 13 Mar 2007, at 2:38 am, Bjorn Gustavsson wrote:
> 
> > The Beam code is quite compact before it is loaded. It would be
> > possible
> > to implement an alternate loader that would load the code in more
> > compact
> > way (at the expense of speed).
> 
> The point was not "how small could  compiled Erlang code be",
> but "how small could the EMULATOR be".  On these network processors,
> there could be up to 8MB to hold the compiled Erlang code, but only
> 2 k-instructions for the EMULATOR.

OK.

The Beam loader now does a lot of instruction combining and instruction
specialing. An alternate loader wouldn't need to do that, so that the
the emulator would have a lot fewer instructions. I have no idea if that
would be enough to fit the emulator into the required space.

> In particular, a "very compact object code" would make the compiled
> code smaller
> (which wouldn't help) at the expense of making the EMULATOR much more
> complex
> (which would hurt a lot).  In fact, I was thinking that Quintus-style
> 16-bit threaded code
> would probably be a good idea, requiring a minimum of decoding.

Beam uses 32-bit threaded code; it might be possible to adapt it to use
16-bit threaded code.

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




More information about the erlang-questions mailing list