"Stephen J. Turnbull" <turnbull(a)sk.tsukuba.ac.jp> writes:
>>>>> "Hrvoje" == Hrvoje Niksic
<hniksic(a)arsdigita.com> writes:
Hrvoje> So you plan to disallow any bignums smaller or equal to
Hrvoje> most-positive-fixnum? That never crossed my mind,
Hrvoje> probably due to exposure to Python.
I don't think he'd necessarily want to _disallow_ them.
Internally, why not? The user will never see the difference, and it
allows us to retain the simple XINT interface whenever we're dealing
with fixnums.
Hrvoje> Here it would be nice to have compiler support for
that,
Hrvoje> so that the compiler can generate fixnum-only opcodes
Hrvoje> where it can prove that fixnums are used. But that's not
Hrvoje> really possible without lexical scoping, so we can forget
Hrvoje> it.
Way ahead of me, I see. But you could go the declaration route.
The declarations might work in some cases, but the speed win would be
questionable. Declarations win in CL because once you declare A and B
as fixnums, the compiler has the license compile (+ A B) into a
machine integer addition. XEmacs interpreter is in a very different
position, which is not made any easier by the fact that due to dynamic
scoping anyone and anything can access the values of the variables and
make XEmacs crash.
Hrvoje> With a little cleverness, the all-fixnum case might
remain
Hrvoje> as fast as it is now.
I don't see why would have to be clever
Well, maybe it's trivial for you. :-) The cleverness I was referring
to would extend the "check that all arguments are numbers logic":
for (i = 0; i < nargs; i++)
CHECK_NUMBER (arg[i]);
into something like:
for (i = 0, have_bignums = 0; i < nargs; i++)
have_bignums += CHECK_NUMBER_OR_BIGNUM_AND_BY_THE_WAY_IF_ITS_A_BIGNUM_RETURN_ONE
(arg[i]);
if (!have_bignums)
... do the all-fixnum thing ...
May I provisionally put "experimental bignum support by Yoshiki
Hayashi" in the proposal I'm drafting for the next release? That
would mean that you'd like to try to have it ready for a September
release. It doesn't mean you promise (I know about the time
constraints of first year grad students), you can always withdraw the
proposal if you decide it's not feasible. And of course the board
would decide whether to accept the proposal, I can't promise it would
be in. But it looks very good so far. (N.B. "Experimental" refers to
"builder must explicitly configure", not my estimate of quality /
stability of the code.)
I assume the status of "experimentalness" can be revised if the code
proves to be stable and reliable?