Kaz Kylheku
7/28/2015 5:45:00 PM
On 2015-07-28, Pascal J. Bourguignon <pjb@informatimago.com> wrote:
> But on more modern processors, such as RISC, immediate values are even
> more restricted, often there's no whole word immediate values, so to
> load a register with a constant value you have to use several
> instructions loading different parts of the registers.
That depends on the value! Loading a small integer value can be more efficient.
Anyway, that isn't the point. The point is that these instructions don't need
any context to retrieve the value, other than the instruction pointer.
A dynamic variable has context. Its value depends on which scope you are
in, in what thread.
> So this is really not useful; it's easier to just store those literal
> value in the memory, at a given address, and to load them by derefering
> this address.
If it is understood that this memory will not change, then it is effectively
a constant, and defconstant could use this mechanism.
Do not confuse "literal constant" with "machine language immediate operand".