Re: marshalling / demarshalling bug?

Hi Wim,

On Fri, 16 Feb 2001, Michael Meeks wrote:

[Removed some text]

>        This is not possible in a system where doubles need to be aligned
>to 8 byte boundaries, since otherwise the standard code:

>       double *a = malloc (sizeof (double)):
>       *a = 4.5;

>        Would segfault. All allocated memory has to be aligned to the
>largest type.

Yes I understand that.  And I am also terribly confused about 
the details of marshalling / demarshalling.

(1)	Architecture can align everything on 4 bytes boundaries.
(2)	I see that the demarshalling of the
	GIOP message buffer aligns the absolute pointer.

My assumptions are:
(A)	The data in the GIOP message buffer is raw wire data.
(B)	CORBA doubles are ON THE WIRE aligned on 8 byte boundaries.

So therefore I think that:
(C)	Aligning the absolute pointer to an 8 byte boundary
	gives wrong result when the beginning of 
	the raw data is aligned at a multiple of 4 
	and not of 8.

I appreciate all your help and I hope that this
helps to lay bare my stupidity ;-)

Wim Oudshoorn.

PS.:  I probably should take some days to
	really understands the marshalling / demarshalling :-(

PPS.: To make this message somewhat self contained:
	the demarshalling code I refer to in (2) is:

            _ORBIT_curptr = ALIGN_ADDRESS(_ORBIT_curptr, 8);
            num = *((CORBA_double *) _ORBIT_curptr);
	which is a snippet of the code generated by
	orbit-ild-compiler for a method:
	void testdouble (inout double num);

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