1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-11 23:43:19 +00:00
Interlisp.maiko/inc/fast_dsp.h
Bruce Mitchener b7e9529322
Begin to modernize optimized dispatch. (#271)
This feature was controlled by the compilation flag `OPDISP`
which would enable some bits of assembler on the x86 (ISC or DOS)
or some other specialized code on SPARC. On SPARC hardware, there
was a special compilation process that would preprocess the code
and generate dispatch tables.

We do this now when this feature is enabled using gcc's computed
gotos feature. This is available in clang and some other compilers.
Notably, it isn't present in Visual Studio.

This doesn't decrease our portability at all as this feature is
optional and it replaces specialized assembler code with C using
compiler extensions (making it cross-platform).

In doing this, we've removed a bunch of related code, however,
it is likely that other pieces yet remain and will be removed
in subsequent commits as we clean things up and refine them.

This feature remains disabled by default for now.
2021-01-22 12:28:16 -08:00

52 lines
1.7 KiB
C

#ifndef FAST_DSP_H
#define FAST_DSP_H 1
/* $Id: fast_dsp.h,v 1.2 1999/01/03 02:05:59 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* These are the Macros Used to generate fast dispatch inline code.
*/
/************************************************************************/
/* */
/* (C) Copyright 1989, 1990, 1991 Venue. All Rights Reserved. */
/* Manufactured in the United States of America. */
/* */
/************************************************************************/
/************************************************************************/
/* */
/* F A S T O P C O D E D I S P A T C H M A C R O S */
/* */
/* These macros generate better opcode-dispatch code than the */
/* native compiler will. The difference may be only one or */
/* two instructions, but in the inner loop, that's a LOT. */
/* */
/* To add a new architecture, you must define 5 macros: */
/* */
/* nextop0 - for single-byte opcodes */
/* nextop1 - skip a byte and grab an opcode */
/* nextop2 - skip 2 bytes and grab an opcode */
/* nextop3 - skip 3 bytes and grab an opcode */
/* nextop4 - skip 4 bytes and grab an opcode */
/* */
/* (These macros are already defined naively, so undef them.) */
/* */
/* For existing implementations, these often expand out to */
/* calls to inline functions. */
/* */
/* */
/* */
/************************************************************************/
#ifdef OPDISP /* Only do any of this if OPDISP is set. */
/* We only need to redefine nextop0 as the others build upon it. */
#undef nextop0
#define nextop0 goto *optable[Get_BYTE_PCMAC0]
#endif /* OPDISP */
#endif /* FAST_DSP_H */