Previously, we had a global `optable`, an alias to it, `table`,
and code to initialize it within `dispatch()`. This code would
initialize the whole thing to either `op_ufn` or `native_check`
and then fill in the entries for the individual opcodes.
Now, we have a function-static `optable` which is statically
initialized and placed (by the compiler) into read-only storage.
This eliminates having generated code within `dispatch()` that
initializes it.
Additionally, it was previously 512 elements long with the second
half of it being all `native_check` entries. We index it with a
byte though, so we only need 256 entries, and we can lose the
`native_check` stuff.
Without those, it wasn't including `devif.h`, which is where
we define `min` and `max`. I make an assumption here that any
new display would be using the current display device support
code.
This was checking that neither `DOS` nor `XWINDOW` were defined,
but this needs a more specific flag for this feature so that it
doesn't get enabled when `!DOS && !XWINDOW`.
Convert ERROR_EXIT, TIMER_EXIT, and WARN to "do {} while (0)" style and
fix a few usage points that were missing trailing semi-colons.
Remove unused typedef for CFuncPtr.
This code is all currently set up to be used if `COLOR` is
defined.
If we were to start supporting color under X11, this would
have to change, but so would much of the rest of the file.
This no longer had anything to do with profiling and was
only doing some defines for the switch case block addresses,
which we no longer need since there's no longer optional
asm generated for them.
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.
* Use gcc / clang overflow builtins.
This avoids expensive checks for overflow that employ undefined
behavior.
This is a step along the way towards replacing the old hand-written
assembler that did the same thing in terms of using the CPU's
overflow detection.
* Remove unimplemented SPARC asm for multiplication, divide, and remainder.
This wasn't implemented before, and for multiplication, it is now
implemented for gcc and friends using overflow detection.
* Remove USE_INLINE_ARITH.
Now that we have the compiler built-ins for detecting overflow,
we don't need custom assembly for it for each platform.
For now, we keep, but still don't use, the code that do a hot
path through the dispatch loop for some math. This code isn't
actually running or in use, but it is separate from how the
other inline arithmetic was being performed. These are the
`fast_op_*` functions that are implemented in assembler.
In commit 6f7ec059bc763d49c753adea70d5cc337f9e353c, we removed
some dead stores. This broke compilation when `STACKCHECK` was
enabled.
ClosesInterlisp/medley#162.
We now can handle these via `inc/maiko/platform.h` and the
constants defined there.
This doesn't change `OS5` for Solaris yet as that's a much wider
set of changes.
By adding `0.0` and not `0.0f` and by calling `fmod()` rather than
`fmodf()`, we were unintentionally coercing the value from a
`float` to a `double`.
This resulted in x86_64 assembler like this:
```
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
callq 403340 <fmod@plt>
cvtsd2ss %xmm0,%xmm0
```
which is now:
```
callq 403360 <fmodf@plt>
```
And for the `N_OP_equal` change:
```
cvtss2sd %xmm0,%xmm0
xorpd %xmm2,%xmm2
addsd %xmm2,%xmm0
cvtss2sd %xmm1,%xmm1
addsd %xmm2,%xmm1
xor %ecx,%ecx
ucomisd %xmm1,%xmm0
```
is now:
```
xorps %xmm2,%xmm2
addss %xmm2,%xmm0
addss %xmm2,%xmm1
xor %ecx,%ecx
ucomiss %xmm1,%xmm0
```
(Note `ss` rather than `sd`, along with the missing `cvtss2sd` calls.)
This wasn't actually hooked up any more, so it was pretty much
all dead code. The handling of this in the command line options
is gone.
In `bin/makefile-tail`, `DEVFILES` and `LIBFILES` became identical, so
`DEVFILES` went away.
* Delete code related to NATIVETRAN feature.
This was obsolete work that had been done for generating
native code from the bytecode.
ClosesInterlisp/medley#89.
* Remove unused SaveD6.
The predefined cursors (image and mask) are better represented
as arrays of const uint8_t rather than char. Likewise for the
window icon. Track this change in the functions that take the
image and mask as arguments, casting only when we get to the
X library functions that take char*.
* Bit of cleanup for Lisp_Xinitialized.
* Remove the `extern` from `xcursor.c`, where it was not used.
* Move the definition from `main.c` to `xinit.c` as it is
the only file using it.
* Use `stdbool.h` for it rather than an `int` with custom `TRUE`
and `FALSE` values.
* Add some asserts with Lisp_Xinitialized.
The definition of a function was ifdef'd out, making it seem
like perhaps there was an assembly implementation, but there
isn't. That platform support is dead weight also at this point,
so removing this because it isn't something that will come back
is fine.
Like the renaming of NOFORN, this gets rid of some double
negatives. It also removes some patterns where we had:
```
#ifdef NOETHER
#else
...
#endif
```
and replaces them with:
```
#ifdef MAIKO_ENABLE_ETHERNET
...
#endif
```