Re: bignums and native back end

Top Pagina
Bijlagen:
Bericht als e-mail
+ (text/plain)
Delete this message
Reply to this message
Auteur: Henry Cejtin
Datum:  
Aan: MLton
Onderwerp: Re: bignums and native back end
I'm slightly confused how the cps phase can do this optimization. In int-inf.h
the function InfInt_areSmall is defined (it is a primitive) which checks if
its two arguments are both small (by anding them together with 1 and seeing if
it is 0).  Since it is in a primitive, no higher levels see this and.
Did you just instruct the shrinker that
    IntInf_areSmall(x, small-constant) = IntInf_isSmall(x)
and similarly for the reverse order?
Also just how much do the upper levels know about small things?
Any way, all of this (and the re-associating so that
    x + constant + constant
turns into `x + (constant + constant)') is very fine.  I suspect that the
biggest win is just noting that
    if x = 0 ...
for x an IntInf.int is a simple pointer comparison instead of going through
IntInf_compare.