summaryrefslogtreecommitdiffstats
path: root/genvmop.txr
Commit message (Collapse)AuthorAgeFilesLines
* vm: remove hard-coded constants.Kaz Kylheku2021-02-101-0/+1
| | | | | | | | | | * genvmop.txr: Define VM_LEV_SIZE from %lev-size%. * vm.c (vm_make_desc): Use VM_MAX_LEV and VM_LEV_SIZE instead of incorrect hard-coded values of 256 that were right for an old version of the vm. * vmop.h: Regenerated.
* vm: derive duplicated constants from Lisp origin.Kaz Kylheku2021-01-111-0/+7
| | | | | | | | | | | | | | | | | | | | | Some constnats in vm.c are hand-duplicates of ones in vm-param.tl. Let's put them in vmop.h instead, where they can be generated by the genvmop.txr script. The two new constants are anticipated for some upcoming VM work. * genvmop.txr: Generate the existing VM_LEV_BITS, VM_LEV_MASK, VM_SM_LEV_BITS and VM_SM_LEV_MASK from the Lisp constants. Also, let's add two new ones. * vm.c (VM_LEV_BITS, VM_LEV_MASK, VM_SM_LEV_BITS, VM_SM_LEV_MASK): Preprocessor symbols removed. * vmop.h (VM_LEV_BITS, VM_LEV_MASK, VM_SM_LEV_BITS, VM_SM_LEV_MASK): Preprocessor symbols generated here with identical values. (VM_MAX_LEV, VM_MAX_V_LEV): New constants.
* vm: deprecate move-immediate instructions.Kaz Kylheku2020-10-011-1/+2
| | | | | | | | | | | | | | | | | | | The movrsi, movrmi and movrbi (move immediate {small, medium, big} to register) instructions are becoming deprecated. The reasoning is that character and fixnum operands can just go into a VM descriptor's data vector (D registers). Then they can be referenced directly without wastefully issuing an extra instruction. * genvmop.txr: Add a deprecated comment next to the enum constants of deprecated opcodes. * share/txr/stdlib/asm.tl (oc-base): Add Boolean property which indicates that an opcode is deprecated. This is a static class variable, defaulting to nil in the base class. (op-movrsi, op-movsmi, op-movrbi): Override base class deprecated property with a true value. * vmop.h: Regenerated.
* genvmop.txr: stop using :vars.Kaz Kylheku2020-10-011-1/+1
| | | | | * genvmop.txr: :vars removed from @(repeat) syntax. It is no longer required as of the previous commit's fix.
* genvmop: bugfix: unbound variable.Kaz Kylheku2019-10-251-1/+1
| | | | | | | * genvmop.txr: The supposedly unused %oc-list% symbol macro that was removed from the assembler internals is in fact referenced here, causing a failure. We macro-replace this remaining instance of it by hand.
* genvmop: fix broken script.Kaz Kylheku2018-03-121-1/+1
| | | | | | | | | | | | This broke when I moved asm.tl into the library directory and set it up for auto-load. * genvmop.txr: We must not include "asm" any more. But then there is no auto-load on any other feature of the assembler other than the class name. The @(mdo) directive comes in handy; at expansion time we can trigger auto-load by doing a lookup on the sys:assembler struct name.
* New: virtual machine with assembler.Kaz Kylheku2018-03-101-0/+18
This commit is the start of compiler work to make TXR Lisp execute faster. In six days of part time work, we now have a register-style virtual machine with 32 instructions, handling exceptions, unwind-protect, lexical closures, and global environment access/mutation. We have a complete assembler and disassembler for this machine. The assembler supports labels with forward referencing with backpatching, and features pseudo-ops: for instance the (mov ...) pseudo-instruction chooses one of three kinds of specific move instruction based on the operands. * Makelfile (OBJS): Add vm.o. * eval.c (lookup_sym_lisp1): Static function becomes external; the virtual machine needs to use this to support that style of lookup. * genvmop.txr: New file. This is the generator for the "vmop.h" header. * lib.c (func_vm): New function. (generic_funcall): Handle the FVM function type via new vm_execute_closure function. In the variadic case, we want to avoid the argument copying which we do for the sake of C functions that get their fixed arguments directly, and then just the trailing arguments. Thus the code is restructured a bit in order to switch twice on the function type. (init): Call vm_init. * lib.h (functype_t): New enum member FVM. (struct func): New member in the .f union: vm_desc. (func_vm): Declared. * lisplib.c (set_dlt_entries_impl): New static function, formed from set_dlt_entries. (set_dlt_entries): Reduced to wrapper for set_dlt_entries_impl, passing in the user package. (set_dlt_entries_sys): New static function: like set_dlt_entries but targetting the sys package. (asm_instantiate, asm_set_entries): New static functions. (lisplib_init): Auto-load the sys:assembler class. * share/txr/stdlib/asm.tl: New file. * vm.c, vm.h, vmop.h: New files.