From 5484325557ee4201fd04772049145ad95ff7dbc4 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 4 Apr 2018 06:57:04 -0700 Subject: 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. --- share/txr/stdlib/asm.tl | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'share') 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) -- cgit v1.2.3