[m-dev.] argument packing

Peter Wang novalazy at gmail.com
Tue May 15 23:52:31 AEST 2018


On Tue, 15 May 2018 12:04:09 +0200 (CEST), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> I committed the diff that enabled the packing of sub-word-sized
> integers and dummies in heap cells about a week ago. Have you
> guys tried out those features (after turning them on, since they are
> OFF by default)?
> 
> The reason I ask is that traditionally, we computed the offset of each
> argument into the memory cell when we generated code for a unification.
> Since repeating this work for *every* unification is wasted work, that diff
> added code to compute these offsets just once, when the representation
> of each function symbol is decided, but it also left the old code in place,
> with assertions checking that the new method yields the exact same offset
> as the old method. I would like to delete the code that calculates the offsets
> the old way, along with the assertions, before I start work on my next
> diff involving argument packing. However, I would not want to take
> that step until those assertions have passed your toughest tests.
> 
> So if you have compiled the Mercury programs you are working on
> with an installed compiler which has had its default values of
> allow_packing_ints and allow_packing_dummies set to `yes',
> and had those programs pass all their tests, please tell me.
> If you haven't, then please do so and tell me.
> And if you had any failures, please tell me as well.

Hi Zoltan,

I made a quick modification to one of my programs and found a problem
(not an assertion failure though). When constructing a term of type:

:- type thread
    --->    thread( ... , int32, int32).

the compiler generated this code in hlc.gc:

    MR_hl_field(MR_mktag(0), base, 5) = (((uint32_t) Var_32) | ((((uint32_t) Var_33) << (MR_Integer) 32)));

for which gcc reports:

    warning: left shift count >= width of type [-Wshift-count-overflow]
    warning: assignment makes pointer from integer without a cast [-Wint-conversion]

This is with mmc rotd-2018-05-12. I simply passed --allow-packing-ints
which I realise is wrong.

Peter

PS. YesLogic don't have any code using sub-word-sized integers yet.


More information about the developers mailing list