[Openmcl-devel] A little more LAP stuff...
R. Matthew Emerson
rme at clozure.com
Tue Feb 16 14:33:36 PST 2010
On Feb 16, 2010, at 2:18 PM, Jon S. Anthony wrote:
> Looking over some LAP functions and disassembling some user level lisp
> functions, my question(s) is what (or whether) there is any difference
> between the two approaches used in these for the X86 register toggle
> tagging between immediate/node indications.
>
> In user level lisp, this typically seems to use btrl to reset bit
> indicating immediate and btsl to set bit indicating node. For example:
>
>
> [13] (btrl ($ 1) (@ (% fs) 8)) ; indicate immo is immediate
> [23] (movl (@ -2 (% arg_z)) (% imm0)) ; load it up...
> ...
> [46] (btsl ($ 1) (@ (% fs) 8)) ; indicate immo is node
>
>
> This same thing in LAP functions where (mark-as-imm ...) and
> (mark-as-node ...) are used is:
>
> ;; (mark-as-imm immo)
> [30] (andb ($ 254) (@ (% fs) 8)) ; indicate immo is immediate
> ...
> ;; (mark-as-node imm0)
> [84] (xorl (% imm0) (% imm0)) ; always there, but unclear about it
> [86] (orb ($ 1) (@ (% fs) 8)) ; indicate immo is node
>
> Is there any real difference between these for the intended task?
They do the same thing (set/clear a bit in the node-regs-mask word stored in the TCR).
I'm not sure why they're different. I like the btr/bts for clarity, though I think it may be the case that the btr/bts instructions are a byte longer than equivalent logical operations would be. I think the lap macro uses logical operations because I had a sort of vague intention to make it support reclassifying the category of multiple registers at once, i.e., I thought that one might say
(mark-as-imm temp0 temp1)
...
(mark-as-node temp0 temp1)
and have that expand to
(andb ($ 249) (@ (% fs) 8))
...
(xorl (% temp0) (% temp0))
(xorl (% temp1) (% temp1))
(orb ($ 6) (@ (% fs) 8))
but I never got around to doing that.
More information about the Openmcl-devel
mailing list