[MLton] Re: PackWord to/from nonsense
Wesley W. Terpstra
wesley at terpstra.ca
Fri Jul 10 04:06:57 PDT 2009
On Fri, Jul 10, 2009 at 2:37 AM, Matthew Fluet <fluet at tti-c.org> wrote:
> On Wed, 8 Jul 2009, Wesley W. Terpstra wrote:
>
>> It would be ideal if I could get this conversion code to work also on
>> Int.{to,from}Large, but there are two problems: 1) packing an IntInf
>> involves shifting and tagging 2) FixedInt doesn't fit into IntInf without
>> using GMP's representation.
>>
>
> Another option is to make the (unsafe) IntInf conversions into primitives:
> IntInf_truncToWord of WordSize.t
> | Word_extdToIntInf of WordSize.t * {signed: bool}
That's a great idea! Most conversions done in existing code are
IntX.{to/from}Large so I expect this would improve the performance of the
patch a lot.
> The downside of this implementation is that the shifting and tagging (small
> int inf) or vector creation (big int inf) for extending to an int inf and
> untagging and shifting or vector extraction for truncating an int inf that
> currently resides in basis-library/integer/int-inf0.sml would need to be
> implemented in the compiler (perhaps expanding the IntInf_truncToWord and
> IntInf_extdToWord in the combine conversions pass, since they wouldn't be
> needed after). It isn't terribly complicated code, but it is a little more
> verbose to write in SSA, rather than in SML.
>
Would there be a negative performance impact since this code would not be
inlined any more? I am not concerned with "verbose" typing on my part. ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mlton.org/pipermail/mlton/attachments/20090710/a98d8918/attachment.htm
More information about the MLton
mailing list