Re: [Qemu-devel] [PATCH for-1.5] qom: optimize casting to leaf class and parent class

2013-05-11 Thread Anthony Liguori
Paolo Bonzini writes: > Il 11/05/2013 00:58, Anthony Liguori ha scritto: >> Aurelien Jarno writes: >> >>> On Fri, May 10, 2013 at 01:47:55PM -0500, Anthony Liguori wrote: Most QOM types use type_register_static but we still strdup the passed data. However, the original pointers are u

Re: [Qemu-devel] [PATCH for-1.5] qom: optimize casting to leaf class and parent class

2013-05-11 Thread Paolo Bonzini
Il 11/05/2013 00:58, Anthony Liguori ha scritto: > Aurelien Jarno writes: > >> On Fri, May 10, 2013 at 01:47:55PM -0500, Anthony Liguori wrote: >>> Most QOM types use type_register_static but we still strdup the >>> passed data. However, the original pointers are useful because >>> GCC is pretty

Re: [Qemu-devel] [PATCH for-1.5] qom: optimize casting to leaf class and parent class

2013-05-11 Thread Aurelien Jarno
On Fri, May 10, 2013 at 05:58:23PM -0500, Anthony Liguori wrote: > Aurelien Jarno writes: > > > On Fri, May 10, 2013 at 01:47:55PM -0500, Anthony Liguori wrote: > >> Most QOM types use type_register_static but we still strdup the > >> passed data. However, the original pointers are useful becaus

Re: [Qemu-devel] [PATCH for-1.5] qom: optimize casting to leaf class and parent class

2013-05-10 Thread Anthony Liguori
Aurelien Jarno writes: > On Fri, May 10, 2013 at 01:47:55PM -0500, Anthony Liguori wrote: >> Most QOM types use type_register_static but we still strdup the >> passed data. However, the original pointers are useful because >> GCC is pretty good about collapsing strings so its very likely any >>

Re: [Qemu-devel] [PATCH for-1.5] qom: optimize casting to leaf class and parent class

2013-05-10 Thread Aurelien Jarno
On Fri, May 10, 2013 at 01:47:55PM -0500, Anthony Liguori wrote: > Most QOM types use type_register_static but we still strdup the > passed data. However, the original pointers are useful because > GCC is pretty good about collapsing strings so its very likely any > use of the pointer will end up

[Qemu-devel] [PATCH for-1.5] qom: optimize casting to leaf class and parent class

2013-05-10 Thread Anthony Liguori
Most QOM types use type_register_static but we still strdup the passed data. However, the original pointers are useful because GCC is pretty good about collapsing strings so its very likely any use of the pointer will end up being that same address. IOW, with a little trickery, we can compare typ