At 03:00 AM 8/7/2001 +0200, Bart Lateur wrote:
>On Mon, 6 Aug 2001 15:41:59 -0700 , Hong Zhang wrote:
>
> >>Branches should work from
> >> both constants and registers.
> >
> >Even so, the "branch #num" should have better performance, and
> >it is part of any machine language. Since we already have jump
> >instruction, do we really need the "branch %r", which can be
> >simulated by "add %r, %pc, #num; jump %r".
>
>In a way, I feel like agreeing. Isn't branch #num the normal case?
>Should you waste time on the normal case because you want to be able to
>do exceptional stuff too?

I think I need to go make some preliminary sections of the document clearer.

In all the cases where an opcode can take different types, there are 
actually different opcodes. So in this case the "branch by integer 
constant" opcode is different than the "branch by integer register" opcode. 
No conditional code there.

>And don't calculated jumps kill caching efficiency? (Or is this "old
>CPU" wisdom?)

It's new CPU wisdom, and dead on. (And getting deader as time goes on) 
However... this applies more to the instruction stream fed to the CPU 
rather than the one fed to the interpreter. Yes, we want to avoid branches 
where we can, but you can't really write code without making at least some 
decision or other. (Well, OK, there's SelfGOL, but we don't like to think 
about that)

>But I do not agree that calculated jumps should be done in such a hard
>way.

Nothing hard about it, really. We'll see either:

   branch $10

or

   store I12, $10
   branch I12

Not that tricky. (And no, those aren't regex variables. I'm having LSI-11 
Macro flashbacks here)

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to