Re: Opcode handler dispatch in an interpreter: Implementing switch on OpCode.

Hans-Peter Diettrich <DrDiettrich1@netscape.net>
Wed, 11 Oct 2017 18:12:33 -0400 (EDT)

          From comp.compilers

Related articles
| List of all articles for this month |
From: Hans-Peter Diettrich <DrDiettrich1@netscape.net>
Newsgroups: comp.compilers
Date: Wed, 11 Oct 2017 18:12:33 -0400 (EDT)
Organization: Compilers Central
References: 17-10-001 17-10-004 17-10-009 17-10-011 17-10-014
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="49748"; mail-complaints-to="abuse@iecc.com"
Keywords: optimize, code
Posted-Date: 11 Oct 2017 18:12:33 EDT

Am 08.10.2017 um 20:36 schrieb George Neuner:


> Some of the things to come out of the discussions in c.l.a.x86 were
> that the fastest [simple] JIT sequence for an interpreter is a list of
> explicit call instructions: e.g.,
>
> call <bytecode_function>
> call <bytecode_function>
> :
>
> rather than a list of function addresses with a dispatcher. This is
> because the call leverages the CPU branch predictor rather than
> fighting with it.


I'm not sure about a single common instruction cache and branch
prediction architecture, the behaviour may differ amongst architectures.
The memory bus interface instead should be similar in all architectures,
so that it should speed up execution if function code is aligned to the
machine's data bus width (size of a chache line). This will make
available the highest possible number of sequential instructions after
the first read at a non-sequential (jump/call) address.


Tail threading instead can benefit from micro code, if that instruction
sequence can be implemented in a single dedicated micro code sequence.
Again this behaviour depends heavily on the particular machine
architecture. Perhaps more instruction sequences in the emulator code
can be optimized this way?


DoDi


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.