[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gm2] packing
From: |
Gaius Mulley |
Subject: |
Re: [Gm2] packing |
Date: |
Sat, 21 Jan 2012 14:42:57 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Dragiša Durić <address@hidden> writes:
> Recently I met a problem with packing order in Modula-3…
>
> Gaius, do you plan to enable full packing control, like - up to and including
> exact bit layout for bit strings?
>
> TIA,
> dd
Hi Dragiša,
ah thanks for the post - this has reminded me to update on the progress
of packing. Currently in my local sandpit of gm2 I have BOOLEAN,
and subrange types which can be declared as packed. As an example here
is my test code which passes:
MODULE align17 ;
FROM libc IMPORT exit ;
TYPE
rec = RECORD
<* bytealignment(0) *>
a: BOOLEAN ; (* only 1 bit used *)
x: [-1..1] ; (* only 2 bits used *)
y: [0..3] ; (* only 2 bits used *)
z: [-4..3] ; (* only 3 bits used *)
END ;
VAR
r: rec ;
BEGIN
IF SIZE(r)=1
THEN
exit(0)
ELSE
exit(1)
END
END align17.
I think gm2 is really close to implementing packed enumerations as well.
However these changes are more complex than I thought - and will require
some changes to the quadruples. Hopefully this will not take too long
as I think much of the code for handling the array designator will be
similar in style (internally). The good news is that the resultant
gcc trees will be more efficient when accessing record fields - so
hopefully we will have faster code as well (for ordinary record accesses).
Initially I don't plan on including bit packing of sets. I dont want to
delay the cvs commit longer than necessary. However it should be very
possible to pack sub word size sets into fields as above. (Sub word
sets are internally just subranges of integer).
I'm not certain whether to implement packing of multiword sets - there
might be too much complexity - so I'd like to review this when we reach
that point!
regards,
Gaius
- [Gm2] packing, Dragiša Durić, 2012/01/21
- Re: [Gm2] packing,
Gaius Mulley <=