Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!rutgers!sri-spam!ames!lll-tis!ptsfa!ihnp4!homxb!mhuxt!mhuxm!mhuxo!ulysses!allegra!alice!ark
From: ark@alice.UUCP
Newsgroups: comp.lang.c,comp.lang.forth,comp.lang.misc
Subject: Re: The winner!
Message-ID: <7098@alice.UUCP>
Date: Sun, 19-Jul-87 01:03:28 EDT
Article-I.D.: alice.7098
Posted: Sun Jul 19 01:03:28 1987
Date-Received: Wed, 22-Jul-87 06:26:02 EDT
References: <398@sugar.UUCP>
Organization: AT&T Bell Laboratories, Liberty Corner NJ
Lines: 21
Keywords: ; anybody recognise this piece of code?
Xref: mnetor comp.lang.c:3186 comp.lang.forth:104 comp.lang.misc:557

In article <398@sugar.UUCP>, peter@sugar.UUCP writes:
> I challenge anyone to come up with a faster interpreter anywhere (how can
> you beat one instruction?). This is actually what the threaded interpreter
> for the threaded version of DEC fortran-IV used, with R4==IP.

How about zero instructions?

Here's how.  As in ordinary threaded code, the "program" is
a string of addresses of subroutines, and the IP register
points to the spot in the "program" that contains the address
of the next thing to do.

However, at the end of each subroutine, instead of a return
instruction, you just say

	jmp	*(IP)+

That is, jump to the location addressed by the contents of the
word addressed by the contents of IP, and bump IP by one word.

Presto -- a zero-instruction interpreter loop!