Re: ALIGNOF_CORBA_* defines

You wrote:
> Hi Wim,

> > ...

> These alignment constants are those used internaly by the compiler
> to layout C structures, they differ per architecture so - for example for
> the following structure:
> typedef struct {
> char   a;
> double b;
> int    c;
> } MyStruct;

That means that if I picture marshalling as:

C - struct:      --(1)---->  Independent  ------(2)-->  GIOP message
    char a;                  a char `a'                 GIOP message
    double b;                and a double `b'           laying out the
  }                                                     struct.

The ALIGNOF_CORBA_* are only used in step (1).
And a different set of ALIGNMENT numbers, namely the
GIOP specification alignment, is used for step (2).

Now I have two questions:
(I do not understand the ORBit code very well,
So am I probably just confused).

	The function

	static guint8
	oidl_get_tree_alignment (IDL_tree tree)

	in the file orbit-idl-passes.c  (in orbit-idl-compiler)
	uses the #define ALIGNOF_CORBA.
	And at first glance it seems that this is used in
	and I think that the data computed in this function
	is used for the alignment in the GIOPMessage.
	But I would be happy if I am wrong on this.

	It seems that marshalling and demarshalling code is
	Here follow two excerpts from the IDL generated code;
	First the marshalling code in the skeleton
	and than the corresponding demarshalling code in the stub.

	The call I am talking about is defined by:

-------- IDL file ----------------
	interface Echo {
       		 Echo echoString(in string astring, out double anum);

	The incompatibility I see is the following:
	the alignment of double that get marshalled
	is done in the send_buffer.  If you examine
	the function
	you will see that it will align the data
	with respect to the begining of the

	However the demarshalling code
	uses ALING_ADRESS on the pointer _ORBIT_curptr,
	which does not align with respect to the
	GIOPMessage, but aligns the absolute adress.

	This seems to go wrong when a
	double is demarshalled in the case that
	the GIOPMessage buffer itself is not
	aligned on a 8 byte boundary.

--------------- Marshalling --------------------
/* this is an exceprt from a skeleton, it
   follows almost directly the actual call into
   user code
if (ev->_major == CORBA_NO_EXCEPTION)
	ORBit_marshal_object(_ORBIT_send_buffer, _ORBIT_retval);
		(GIOP_MESSAGE_BUFFER(_ORBIT_send_buffer), 8);
	} else

--------------- Demarshalling ----------------------
/* This is the corresponding demarshalling in the
   calling stub.
	GIOP_RECV_BUFFER(_ORBIT_recv_buffer)->cur = _ORBIT_curptr;
	_ORBIT_retval = ORBit_demarshal_object

	_ORBIT_curptr = GIOP_RECV_BUFFER(_ORBIT_recv_buffer)->cur;
	_ORBIT_curptr = ALIGN_ADDRESS(_ORBIT_curptr, 8);
	(*anum) = *((CORBA_double*)_ORBIT_curptr);


Wim Oudshoorn.

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