[LispM-Hackers] Reading the dumped code

Nyef nyef@softhome.net
Mon, 7 Jan 2002 22:27:24 -0500 (EST)


On 7 Jan 2002, James A. Crippen wrote:

> I'm reading the dumped code.  Not for the first time, but I think the
> first time while thinking about what it's doing.
>
>  pc=0000 b BR_NOT_NIL disp=#o1
>  pc=0001   PLUSP PDL|#o77
>
> Isn't that first instruction basically a noop?  I mean, if what's on
> the stack is NIL then will go on to the next insn, pc=0001.  If the
> top of stack *is* NIL then it will branch ... to pc=0001.  Or am I out
> of my mind?  Or is this a sign that we're not processing all the bits
> right in this case?  It just seems odd to have a branch to the next
> insn...

Nope. Offsets are relative to the _next_ instruction, so that branch
points to the instruction at pc=0002. See SSDN2, section 20.3.

Branches to the next instruction are sometimes used in systems with
branch-delay slots such as the MIPS r3000 and similar chips, as a way to
conditionally execute the following instruction _twice_ (once as branch
delay, once as branch target). The same trick might also be used in
microcode that has similar branch semantics.

> 'james

---------------------------
All programming can be viewed as an exercise.
---------------------------
Alastair Bridgewater
e-mail: nyef@softhome.net