genericisation way-point ...

Michael Meeks michael at ximian.com
Mon Apr 19 23:52:57 EST 2004


Hi there,

	So - the attached patch moves dbus some way towards a more generic
approach to marshalling - closer to where I'd like to go to get
recursive types working well.

	The patch is quite large; it essentially re-hashes a chunk of the
[de]marshalling code, and it's hooks into the main dbus-message.c code -
this is mostly because I'd like the 'dbus_marshal_basic_type(...)'
method available from the glib code (eventually) - but also, if we have
the generic code paths live/hot in cache - it prolly makes sense to use
them for everything else [ and looses us a number of relocations etc. ].

	The patch saves ~280 lines, during this process we sacrifice a little
type-safety in favour of reduced code size (cut & paste), more generic
code, easier maintenance etc. IMHO this is a worthwhile win; hopefully
you agree.

	The shrink is slightly larger when we remove the remaining obsoleted
dbus-marshal.[ch] methods:
		+ _dbus_[de]marshal_double[_array]
		+ _dbus_[de]marshal_[u]int64[_array]
		+ _dbus_[de]marshal_[u]int32_array

	And of course, incrementally moving 'string'/'object reference' to be
basic types may further reduce code-size / complexity. ( due in a later
pass ).

	A few points of interest:

	* CORBA defines CORBA_boolean as an unsigned char; this 
	  (perhaps) removes some uncertainty wrt. arrays - it seems
	  Boolean arrays are of type 'byte' but individually are 'int'

	* Also interesting that individual bytes are normalized to 1/0
	  but array contents are not - should they be ?

	* I'm not completely sure what the message builders 
	  align/unalign stuff is all about - nevertheless it shows no
	  signs of stopping working.

	* for types; I've switched from 'int' to 'char' since (I'm 
	  hoping) to have recursive types specified by a (human 
	  readable ) string eventually; is that ok ?

	Regards,

		Michael.

-- 
 michael at ximian.com  <><, Pseudo Engineer, itinerant idiot

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus-shrink7.diff
Type: text/x-diff
Size: 63449 bytes
Desc: not available
Url : http://freedesktop.org/pipermail/dbus/attachments/20040419/2bf64680/dbus-shrink7-0001.bin


More information about the dbus mailing list