summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-04 06:57:04 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-04 06:57:04 -0700
commit5484325557ee4201fd04772049145ad95ff7dbc4 (patch)
tree0bd7ef83c4ca2c2915739190c71372e0bb834a59 /share
parenteb10286190b64ecbcf023760ce01f1a8ce77ac86 (diff)
downloadtxr-5484325557ee4201fd04772049145ad95ff7dbc4.tar.gz
txr-5484325557ee4201fd04772049145ad95ff7dbc4.tar.bz2
txr-5484325557ee4201fd04772049145ad95ff7dbc4.zip
asm: changes for compiling.
* share/txr/stdlib/asm.tl (assembler): Wrap with compile-only so we don't redefine this struct while we are compiling the assembler. (%oc-code%): Use defparml so this is reset to zero, so that the opcodes are numbered from zero instead of the most recent value left in the variable.
Diffstat (limited to 'share')
-rw-r--r--share/txr/stdlib/asm.tl39
1 files changed, 20 insertions, 19 deletions
diff --git a/share/txr/stdlib/asm.tl b/share/txr/stdlib/asm.tl
index 24a6ac8c..da456654 100644
--- a/share/txr/stdlib/asm.tl
+++ b/share/txr/stdlib/asm.tl
@@ -43,24 +43,25 @@
(:method backpatch (me asm at offs)
(error `assembler: @{me.symbol} doesn't backpatch`)))
-(defstruct assembler nil
- buf
- bstr
- (labdef (hash))
- (labref (hash))
- (:static imm-width (relate '(si mi bi) '(10 16 32)))
- (:static sign-bits (relate '(fixnum bignum chr) '(1 1 0)))
- (:static operand-name (relate '(si mi bi l r rs d ds n o)
- '("small immediate"
- "medium immediate"
- "big immediate"
- "label"
- "register operand"
- "register small operand"
- "register destination operand"
- "register small destination operand"
- "integer"
- "any object"))))
+(compile-only
+ (defstruct assembler nil
+ buf
+ bstr
+ (labdef (hash))
+ (labref (hash))
+ (:static imm-width (relate '(si mi bi) '(10 16 32)))
+ (:static sign-bits (relate '(fixnum bignum chr) '(1 1 0)))
+ (:static operand-name (relate '(si mi bi l r rs d ds n o)
+ '("small immediate"
+ "medium immediate"
+ "big immediate"
+ "label"
+ "register operand"
+ "register small operand"
+ "register destination operand"
+ "register small destination operand"
+ "integer"
+ "any object")))))
(defmeth assembler :postinit (me)
(cond
@@ -225,7 +226,7 @@
(defvarl %oc-hash% (hash))
-(defvarl %oc-code% 0)
+(defparml %oc-code% 0)
(defun register-opcode (oc)
%oc-list-builder%.(add oc)