Support building opcode jump tables on host #84
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Right now Musashi builds its opcode handler jump table in RAM, which runs faster (for some reason) but blocks it from running on little memory-constrained microcontrollers. This PR fixes that by allowing this table to be built on the host and stored as a constant in the final executable. Most of this work was done by Sprite_tm in 2018 - I just integrated his changes in with the build system.
If I did things right the current build process should be the same, so no one needs to update their makefiles or scripts or whatever. If you want to use constant jump tables, you can run
make constant
instead ofmake
and it'll tellm68kmake
to generate these tables ahead of time. This also has the effect of splitting up the opcode handler functions and the jump table - the handler functions get prototypes inm68kops.h
and the functions themselves go in a new filem68kinst.c
.summary of changes
m68ki_instruction_jump_call
, that replaces void pointers in the opcode handler jump tablem68k_in.c
so it can generate both the normal dynamic jump tables and the jump table generatorm68kmake
- "--constant" - that generates the jump table generatorm68kinst.c
and added prototypes tom68kops.h
(when building constant tables)constant
target to the makefile that builds all of this automatically