1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-10 10:10:21 +00:00

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.
This commit is contained in:
Bruce Mitchener
2021-01-23 03:28:16 +07:00
committed by GitHub
parent 61a0c02681
commit b7e9529322
18 changed files with 514 additions and 1607 deletions

View File

@@ -78,59 +78,6 @@ done: ! else done;
.end
/* inline dispatching support */
/* Thanks to Russ Atkinson, December 29, 1987 */
/* To use in compiling XXX, cc -O2 XXX.c dispatch.il */
/* The qdisp* routines depend on pc being in %o0 and table being in %o1 */
.inline _qdisp0,8
! qdisp0 - %o0: pc, %o1: table
ldub [%o0+0],%o2 ! temp = *pc
sll %o2,2,%o2 ! temp = temp * 4
ld [%o2+%o1],%o2 ! temp = table[temp]
jmp %o2 ! dispatch
nop
.end
.inline _qdisp1,8
! qdisp1 - %o0: pc, %o1: table
ldub [%o0+1],%o2 ! temp = *pc
sll %o2,2,%o2 ! temp = temp * 4
ld [%o2+%o1],%o2 ! temp = table[temp]
jmp %o2 ! dispatch
add %o0,1,%o0 ! update the pc
.end
.inline _qdisp2,8
! qdisp2 - %o0: pc, %o1: table
ldub [%o0+2],%o2 ! temp = *pc
sll %o2,2,%o2 ! temp = temp * 4
ld [%o2+%o1],%o2 ! temp = table[temp]
jmp %o2 ! dispatch
add %o0,2,%o0 ! update the pc
.end
.inline _qdisp3,8
! qdisp3 - %o0: pc, %o1: table
ldub [%o0+3],%o2 ! temp = *pc
sll %o2,2,%o2 ! temp = temp * 4
ld [%o2+%o1],%o2 ! temp = table[temp]
jmp %o2 ! dispatch
add %o0,3,%o0 ! update the pc
.end
.inline _fast_dispatcher,8
! - %o0: table, %o1: pc
ldub [%o1+0],%o1 ! fetch inst byte
sll %o1,2,%o1
ld [%o1+%o0],%o1
jmp %o1 ! dispatch
nop
.end
/*
***************************************************************
Inline Assembly help for dispatcher.