REBOL3 tracker
  0.9.12 beta
Ticket #0001727 User: anonymous

Project:



rss
TypeBug Statusbuilt Date28-Oct-2010 03:40
Versionalpha 109 CategoryHost-Kit Submitted byssolie
PlatformAll Severitymajor Prioritynormal

Summary Suboptimal packing of GCC-based host-kit structures
Description The current GCC compilation uses the -fpack-struct option to pack the REBOL structures.

The following warning attached to the use of this option from the GCC docs:
"Warning: the -fpack-struct switch causes GCC to generate code that is not binary compatible with code generated without that switch. Additionally, it makes the code suboptimal. Use it to conform to a non-default application binary interface."

Since the AmigaOS uses both 32-bit (4 byte) and 16-bit (2 byte) structure alignments, this is of course causing major issues for any mixed Amiga/REBOL code.

I would like to suggest the use of the #pragma pack() feature instead at least for any GCC-based platforms. That way REBOL can specific the packing it requires in the header file as follows and not disturb mixed source files.

For example,
#pragma pack(4) // 32bit alignment for vectors
typedef struct REBOL_Host_Lib {
    int size;
    REBINT (*os_wait)(REBCNT millisec, REBCNT res);
} REBOL_HOST_LIB;
#pragma pack() // return to default platform alignment

The REBOL ABI can use whatever packing it wants as long as we match them up in the host-kit.
Example code

			

Assigned ton/a Fixed inalpha 110 Last Update1-Nov-2010 05:45


Comments
(0002696)
Carl
29-Oct-2010 01:21

Good one, Steve.
(0002726)
Carl
1-Nov-2010 05:45

A110 takes a crack at this. May require a few adjustments.

Date User Field Action Change
1-Nov-2010 05:45 carl Fixedin Modified => alpha 110
1-Nov-2010 05:45 carl Status Modified reviewed => built
1-Nov-2010 05:45 carl Comment : 0002726 Added -
29-Oct-2010 01:21 carl Comment : 0002696 Added -
29-Oct-2010 01:20 carl Description Modified -
29-Oct-2010 01:20 carl Status Modified submitted => reviewed
28-Oct-2010 03:40 ssolie Ticket Added -