[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] algebra cycles again (was: Left shifts of negative
From: |
root |
Subject: |
Re: [Axiom-developer] algebra cycles again (was: Left shifts of negative numbers) |
Date: |
Tue, 14 Oct 2003 22:02:49 -0400 |
I'm buried on three other paths so I can't research this at the moment.
Things to know:
1 QSLEFTSHIFT is a lisp macro (vmlisp.lisp) so it won't show up in
open code and is only used during compile time. The QS* functions
are heavily type-specified so that the lisp compiler can generate
optimal code.
2 The shift function in SingleInteger has the SPADreplace property
(see SINT.NRLIB/code.lsp). That means that algebra code that uses
shift will be replaced by a call to QSLEFTSHIFT at compile time.
The line you are looking for reads:
(PUT (QUOTE |SINT;shift;3$;44|) (QUOTE |SPADreplace|) (QUOTE QSLEFTSHIFT))
In the interpreter you'll find the symbol |SINT;shift;3$;44|
has the property |SPADreplace| on the property list
with the value QSLEFTSHIFT
which the compiler uses to open-code the shift function.
3 Bootstrap issues make the change harder. You have to be sure that
algebra code has not compiled the previous macro definition of
QSLEFTSHIFT inline (and there is no indication if it has that
you will be able to see without reading the generated code).
4 shift is HIGHLY optimized. if you change it you need to use lisp
disassemble to examine the code generated by the compiler. The
SINT domain is on the critical path for nearly everything.
The moral is to change it carefully, optimize the hell out of it,
and test it heavily.
Tim