<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Thu, 10 Jun 1993 18:34:31 +0200
From   : stjohn@...
Subject: Small-C optimisation?

>Consider the code that Small C can produce - absolutly everything has to be a  
>subroutine right down to add and subtract, hence the code becomes 
>
>JSR push
>JSR push
>JSR add
>JSR store
>etc..
>
>particularly as the 6502 stack is inadaquate for this sort of stuff.
>
>With byte codes we can write
>push;push;add;store;
>where each is only a single byte - a three fold improvement in
>memory usage (OK I've neglected operands, but the idea holds).

Okay, well how many codes do we need? I would have thought that
operands would do even better from a bytecode interpreter.

From every example I could think of, the bytecode version was smaller
than the threaded version:
16 bit loads only take 3 bytes instead of 4(?) LDX n;LDY n
16 bit branches only take 3 bytes instead of 5(?) Bcc L0;JMP nn;.L0
....

And who's got the spare couple of weeks to do it?

But then you could just go the whole hog and implement a Z80 emulator
:) :) :) :) :) tee hee

       Chris.


PS: there is no real limitation on just 16 bit words either... and
the helpful abstraction of an interpreted system would allow for
an interpreted MMU and paging to/from disk. The thought of running
GCC in 32kb plus 2x720kb drives does make me smile though.

32016 emulator? one to avoid I think ;-)

I digress.
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>