[m-rev.] for review: encode invariants in types when creating constant structures

Julien Fischer jfischer at opturion.com
Tue Mar 13 20:12:41 AEDT 2018


On Tue, 13 Mar 2018, Zoltan Somogyi wrote:

>
> On Tue, 13 Mar 2018 05:22:50 +1100 (AEDT), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
>
>> For review by anyone.
>> 
>> The main thing requiring review is the abort in the packing code
>> when it finds a double-word argument.
>
> I forgot to mention that beside doing a bootcheck in hlc.gc (which passed),
> I also tried a bootcheck in grade hlc.pregen.gc, which had an interesting
> result, as shown by these extracts from the output:
>
> building of stage 3 compiler successful
> --- stage2/library/int64.c  2018-03-12 16:34:56.531794275 +1100
> +++ stage3/library/int64.c  2018-03-12 16:52:14.278866410 +1100
> @@ -768,7 +768,7 @@
>   int64_t HeadVar__1_1)
> {
>   {
> -    int64_t HeadVar__2_2 = (INT64_C(0) - HeadVar__1_1);
> +    int64_t HeadVar__2_2 = (INT64_C(12794624) - HeadVar__1_1);
>
>     return HeadVar__2_2;
>   }
> @@ -830,7 +830,7 @@
>
>     succeeded = (Num_3 > Var_4);
>     if (succeeded)
> -      HeadVar__2_2 = (INT64_C(0) - Num_3);
> +      HeadVar__2_2 = (INT64_C(12794624) - Num_3);
>     else
>       HeadVar__2_2 = Num_3;
>     return HeadVar__2_2;
> ** error - stage 2 and stage 3 differ!
>
> -----------------------------------------------------------------------
> ERROR EXIT: stages 2 and 3 differ
> ERROR EXIT: some tests failed
> 10 unexpected test case failures:
>
>    hard_coded/arith_int64
>    hard_coded/arith_uint64
>    hard_coded/bitwise_int64
>    hard_coded/bitwise_uint64
>    hard_coded/cmp_int64
>    hard_coded/cmp_uint64
>    hard_coded/constant_prop_1
>    hard_coded/integer_int64_conv
>    hard_coded/integer_uint64_conv
>    hard_coded/uint64_switch_test
>
> -----------------------------------------------------------------------
>
> The test failures were due to incorrect output, not compiler aborts,
> so the new abort described in the log message was NOT triggered
> at any time during the bootcheck.

Peter's change earlier today should have fixed this;
hard_coded/constant_prop_1 will still fail in pregen grades since that
grade component disables that optimization for integer operations.
(I think it's behaviour with floats is wrong too, but that's another
matter.)

Julien.


More information about the reviews mailing list