summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-02-14 10:25:57 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-02-14 10:25:57 -0800
commitb35ef92dd374d8cf6123ca0b13ee8cad1ecc50c6 (patch)
treef8ce4acce9591d9b06b83e675e573145b799b9be
parentdb7998e7114be768dcf7524b80c2e1557c153fbf (diff)
downloadtxr-b35ef92dd374d8cf6123ca0b13ee8cad1ecc50c6.tar.gz
txr-b35ef92dd374d8cf6123ca0b13ee8cad1ecc50c6.tar.bz2
txr-b35ef92dd374d8cf6123ca0b13ee8cad1ecc50c6.zip
asm/vm/compiler: introduce jend pseudo-instruction.
The jend pseudo-instruction is a simple alias for end. It indicates a jumping end: an end that does not fall through to the next instruction but could go somewhere else. This is for "future correctness" as well as clarity. The
-rw-r--r--share/txr/stdlib/asm.tl7
-rw-r--r--share/txr/stdlib/compiler.tl8
2 files changed, 10 insertions, 5 deletions
diff --git a/share/txr/stdlib/asm.tl b/share/txr/stdlib/asm.tl
index 8b63a557..89ad4b3a 100644
--- a/share/txr/stdlib/asm.tl
+++ b/share/txr/stdlib/asm.tl
@@ -343,7 +343,11 @@
(defstruct ,class ,orig-class
(:static symbol ',symbol)
(:static code ,code))
- (register-opcode (new ,class)))))
+ (register-opcode (new ,class))))
+
+ (defmacro defopcode-alias (alias-symbol orig-symbol)
+ ^(let ((oc [%oc-hash% ',orig-symbol]))
+ (set [%oc-hash% ',alias-symbol] oc))))
(defopcode op-label label nil
(:method asm (me asm syntax)
@@ -387,6 +391,7 @@
(:method dis (me asm extension res)
^(,me.symbol ,(operand-to-sym res))))
+(defopcode-alias jend end)
(defopcode-derived op-prof prof auto op-end)
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index a735739b..d034ab21 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -693,7 +693,7 @@
(t (new (frag pfrag.oreg
^((uwprot ,lclean)
,*pfrag.code
- (end nil)
+ (jend nil)
,lclean
,*cfrag.code
(end nil))
@@ -807,7 +807,7 @@
,lhand
,*(mappend .code cfrags)
,lhend
- (end ,tfrag.oreg)
+ (jend ,tfrag.oreg)
(end ,tfrag.oreg))
(uni tfrag.fvars [reduce-left uni cfrags nil .fvars])
(uni tfrag.ffuns [reduce-left uni cfrags nil .ffuns])))))))
@@ -1050,7 +1050,7 @@
,*(if need-dframe
^((end ,boreg)))
,*me.(maybe-mov boreg bfrag.oreg)
- (end ,boreg)
+ (jend ,boreg)
,lskip)
(uni fvars (diff bfrag.fvars lexsyms))
(uni [reduce-left uni ifrags nil .ffuns]
@@ -1819,7 +1819,7 @@
co.(check-treg-leak)
as.(asm co.(optimize ^(,*(mappend .code (nreverse co.lt-frags))
,*frag.code
- (end ,frag.oreg))))
+ (jend ,frag.oreg))))
(vm-make-desc co.nlev (succ as.max-treg) as.buf co.(get-datavec) co.(get-symvec)))))
(defun compiler-emit-warnings ()