summaryrefslogtreecommitdiffstats
path: root/vmop.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-01-11 07:47:42 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-01-11 07:47:42 -0800
commite9b3403ca46b64153914695cc3ab3eb6a0e057ac (patch)
tree321f27d7fc72ab524efe4fc33b1b2124c67f728a /vmop.h
parentbaa34c7282046e70dd6c3ca4c63ef865c1b351a0 (diff)
downloadtxr-e9b3403ca46b64153914695cc3ab3eb6a0e057ac.tar.gz
txr-e9b3403ca46b64153914695cc3ab3eb6a0e057ac.tar.bz2
txr-e9b3403ca46b64153914695cc3ab3eb6a0e057ac.zip
vm: derive duplicated constants from Lisp origin.
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.
Diffstat (limited to 'vmop.h')
-rw-r--r--vmop.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/vmop.h b/vmop.h
index 3f2c2f43..aafbe6e5 100644
--- a/vmop.h
+++ b/vmop.h
@@ -70,3 +70,10 @@ typedef enum vm_op {
SETLX = 41,
GETF = 42,
} vm_op_t;
+
+#define VM_LEV_BITS 10
+#define VM_LEV_MASK 0x3FF
+#define VM_SM_LEV_BITS 6
+#define VM_SM_LEV_MASK 0x3F
+#define VM_MAX_LEV 63
+#define VM_MAX_V_LEV 61