[M3commit] CVS Update: cm3
Jay Krell
jkrell at elego.de
Thu Apr 1 17:56:37 CEST 2010
CVSROOT: /usr/cvs
Changes by: jkrell at birch. 10/04/01 17:56:37
Modified files:
cm3/m3-sys/m3middle/src/: Target.i3 Target.m3
Log message:
leave max_align = 64 for all platforms
this effects:
I386_FREEBSD / FreeBSD4
I386_LINUX / LINUXLIBC6
NetBSD2_i386
It does not affect any others -- not PPC, not Darwin, not 64bit, not Solaris, not NT.
I admit I didn't test the affected platforms.
This is at times overkill, but has some nice properties:
64bit doubles will be 64 aligned, which is nice, even if not required
LONGINT will be 64 aligned, which *might* be required for some atomics
Given that LONGINT is generally implemented as a pair of 32bit integers, this is overkill.
all platforms have the same alignments
Note, it is tempting to think we can just these values arbitrarily high,
but we cannot. These values affect interfacing with C.
If one has
TYPE A = RECORD
a: INTEGER;
b: LONGINT;
END;
on a 32bit system, there may or may not be 4 bytes of padding between
a and b.
When interfacing with C, it behooves one to always put
larger fields first, which I believe always avoids/resolves the problem.
Or if smaller fields precede larger fields, they should be in multiples
that equal in size what follows them, something like that.
Our interfacing with C is in a few places.
- m3core/src/unix
In this case we interface with our own C and put larger fields first
- m3core/src/win32
not affected here, merits some review anyway
- X Windows, merits review
Basically, assuming LONGINT and LONGREAL are absent in any C interfaces,
i.e. only 32bit types on 32bit platforms,
this is a no-op. LONGINT is present in m3core/src/unix, but it should be ok.
LONGINT is "new" so generally absent.
LONGREAL is a more realistic concern.
To whatever extent Modula-3 is interfaced with Modula-3, we can
actually set the values arbitrarily high (but it wastes space).
More information about the M3commit
mailing list