gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] Re: data alignment is now possible


From: Iztok Kobal
Subject: Re: [Gm2] Re: data alignment is now possible
Date: Mon, 21 Jun 2010 14:36:27 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100317 SUSE/2.0.4-3.2 SeaMonkey/2.0.4

Gaius !

I would like to point out again that the things with packed pragma can be very complicated with arm architecture. I would be really happy if the regressions were passed on arm and some other RISC architectures before this stuff has been declared as really working !

I think that the old DrDobbs' article (http://www.drdobbs.com/architecture-and-design/184405435) pointed out clearly to possible issues !

As for the others - I would strongly discourage anybody to use packed structures for implementing e.g. communication protocols or HW accesses since the code in most cases can not be portable to other architectures. Endianness and structure field alignment issues should be solved conservative way - accessing bits of information within LOC (byte) arrays on offset basis. Also, forcing processor to work with unnatural alignment slows the bytecode execution radically.

If I were an advisor for GNUM2, I would never support the structure fields packing and clearly state that it is not supported and not to count on it.

Regards !


Gaius Mulley wrote:
SiTex Graphics<address@hidden>  writes:

Thanks.  That will be handy.

I see now that my original question was poorly worded.  What I was
really after is a way to pack fields in a record as tightly as
possible.  Both XDS and StonyBrook have a global option for that.
Here's a simple example (source code attached).  With the following
type declaration:

   Test = RECORD
     a : CARDINAL8;
     b : CARDINAL32;
     c : CARDINAL8;
   END;

GM2 reports SIZE(Type) as 12, whereas StonyBrook and XDS report 6 with
packed field alignment.  With the other compilers changing the field
alginment does not require modificiation of the source code, and that
would be highly desirable. Maybe there's already a gcc-based
command-line option for field alignment?

In any case the ability to specify variable alignment will be useful
in its own right.

Thanks,
Scott
Hi Scott,

Sure I see no problem adding the __attribute__((packed)) concept that
gcc uses into gm2.  This also provides continuity with the gcc family.
Alas there is no command line option to specify field alignment -
quite a few to warn if (packed) makes no difference.  I guess it is
safer to insist on minor code changes rather than remembering which
module was compiled with which option.  A global ISO Modula-2 comment
directive might be another approach..

regards,
Gaius

_______________________________________________
gm2 mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/gm2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]