[m-rev.] for review: enable the use of unboxed 64-bit integers
Peter Wang
novalazy at gmail.com
Sat Feb 17 17:09:47 AEDT 2018
On Fri, 16 Feb 2018 03:59:46 -0500 (EST), Julien Fischer <jfischer at opturion.com> wrote:
>
> For review by anyone.
>
> This replaces part of an earlier uncommitted change. I don't think
> we actually need to bump the binary grade compatibility number here
> (as I did in th previous version).
>
> -----------------------------
>
> Enable the use of unboxed 64-bit integers.
>
> Enable the use of unboxed 64-bit integers in C grades on 64-bit
> machines.
>
> Add a new internal grade component corresponding to the use of 64-bit
> integers.
>
> configure.ac:
> Test whether we can use unboxed 64-bit integers.
>
> Extend the check for whether previously built C files are compatible with
> configure determined settings to cover whether 64-bit integer are boxed
> or not.
>
> scripts/Mercury.config.boostrap.in:
> scripts/Mercury.config.in:
> Set the compiler flag for unboxed 64-bit integers if configure determines
> they can be used.
>
> runtime/mercury_grade.h:
> Add the "ubi64" grade component
>
> diff --git a/configure.ac b/configure.ac
> index a47734d..f53b58d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2329,11 +2329,28 @@ AC_SUBST(MR_LONG_DOUBLE_IS_64_BIT)
>
> #-----------------------------------------------------------------------------#
>
> -# XXX INT64 -- while we are boostrapping the changes that introduce int64
> -# and uint64, we always box them. Support for unboxed 64-bit integer types
> -# will be enabled later.
> -
> -AC_DEFINE(MR_BOXED_INT64S)
> +AC_MSG_CHECKING([whether we can use unboxed 64-bit integers])
> +AC_CACHE_VAL([mercury_cv_unboxed_int64s],
> + AC_TRY_RUN([
Run-time tests don't work when cross compiling. We should be able to use
a compile-time test, e.g. the trick in MR_STATIC_ASSERT.
> + #include <stdint.h>
> + int main() {
> + if (sizeof(uint64_t) == sizeof(void *))
> + exit(0);
> + else
> + exit(1);
> + }],
> + [mercury_cv_unboxed_int64s=yes],
> + [mercury_cv_unboxed_int64s=no],
> + [mercury_cv_unboxed_int64s=no])
> +)
> +AC_MSG_RESULT($mercury_cv_unbxed_int64s)
unboxed
> +if test "$mercury_cv_unboxed_int64s" = yes; then
> + HAVE_BOXED_INT64S="--unboxed-int64s"
> +else
> + AC_DEFINE(MR_BOXED_INT64S)
> + HAVE_BOXED_INT64S="--no-unboxed-int64s"
> +fi
> +AC_SUBST([HAVE_BOXED_INT64S])
>
> #-----------------------------------------------------------------------------#
>
Peter
More information about the reviews
mailing list