[m-rev.] for post-commit review: group *int_least* types together

Zoltan Somogyi zoltan.somogyi at runbox.com
Tue Feb 20 15:39:33 AEDT 2018



On Sun, 18 Feb 2018 04:40:18 -0500 (EST), Julien Fischer <jfischer at opturion.com> wrote:

> 
> Hi,
> 
> On Sun, 18 Feb 2018, Zoltan Somogyi wrote:
> 
> > Julien, can you please have a look at the parts of the diff
> > to llds_out_global.m that are marked by XXX BUG?
> > I am not sure how I can write tests for the bounds of
> > {u,}int_least32 that will work on both 32 and 64 machines,
> > given the current state of bootstrapping 64 bit integers.
> 
> What's the issue with the current state of 64-bit integers?  Bootstrap
> compilers have been required to support them since the beginning of this
> month.  (Indeed, the Mercury compiler itself has been using them since
> then as well.)
> 
> The last major** uncommitted piece of work for 64-bit integers, is
> enabling unboxed 64-bit integers on 64-bit machines, but that only
> affect performance.  (I'll be committing the chnage that enables that
> tomorrow.)
> 
> Have I missed something here?

I phrased myself badly. What I want to do is to commit the following
diff:

--- a/compiler/llds_out_global.m
+++ b/compiler/llds_out_global.m
@@ -743,10 +743,11 @@ ok_int_const(N, LLDSType) :-
             IntLeastType = uint_least16,
             0 =< N, N < 65536
         ;
-            ( IntLeastType = int_least32
-            ; IntLeastType = uint_least32
-            )
-            % XXX BUG: The type int may be 64 bit.
+            IntLeastType = int_least32,
+            -2147483647 =< N, N < 2147483647
+        ;
+            IntLeastType = uint_least32,
+            0 =< N, N < 4294967295
         )
     ;
         LLDSType = lt_int(IntType),
@@ -764,10 +765,11 @@ ok_int_const(N, LLDSType) :-
             IntType = int_type_uint16,
             0 =< N, N < 65536
         ;
-            ( IntType = int_type_int32
-            ; IntType = int_type_uint32
-            )
-            % XXX BUG: The type int may be 64 bit.
+            IntType = int_type_int32,
+            -2147483647 =< N, N < 214748364
+        ;
+            IntType = int_type_uint32,
+            0 =< N, N < 4294967295
         ;
             ( IntType = int_type_int64
             ; IntType = int_type_uint64

I know that the references to 4294967295 will work
on 64 bit machines. What I want to know is: will they work
on 32 bit machines as well? (Where, ironically, they are
not needed.) I cannot test it, since I don't have
any 32 bit machines. I asked you because you were
the one to last touch the relevant parts of the compiler,
as part of adding support for 64 bit unboxed integers.

Zoltan.


More information about the reviews mailing list