qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 06/11] qobject: add QBool type
Date: Mon, 19 Oct 2009 09:17:38 -0500	[thread overview]
Message-ID: <4ADC7502.7030903@us.ibm.com> (raw)
In-Reply-To: <20091018195007.4dbaa599@doriath>

Luiz Capitulino wrote:
> On Sat, 17 Oct 2009 08:36:06 -0500
> Anthony Liguori <aliguori@us.ibm.com> wrote:
>
>   
>> We currently model as json bool as an int.  This works fine on the server side
>> but it means we cannot send back proper bools to the client.  Introducing a
>> proper QBool type fixes that.
>>     
>
>  As we talked earlier today, I think it would be simpler to have QTrue,
> QFalse and QNull as static objects.
>
>  We could define that static objects get reference counting disabled, I don't
> see issues in doing that and we get a very simple model.
>
>  The big patch bellow does it, only compiled tested though.
>
>  If you don't agree with this model, we'll have to allocate QNull objects.
> Actually I would suggest a destroy() method which always resets the
> refcount to 1, but then it will have the concurrency problems on threaded
> applications you've mentioned.
>   

A lot of object systems have dealt with this in various ways.  The 
trouble with reference counting is usually thread safety.  CLR goes to 
great lengths to make their objects reference counting thread safe and 
it comes at a cost.  Python doesn't do anything explicit and it's one of 
the reasons that they're stuck with a big lock.

Since I'd like to expose QObject to client libraries, having a single 
static instance would be pretty unfortunate as it would imply a weird 
locking semantics.  Disabling reference counts for QNull/QBool seems 
unfortunate because it suggests that different semantics for certain 
objects.

I think this is a premature optimization.  I don't think we need to try 
and save the memory here.

Regards,

Anthony Liguori

  reply	other threads:[~2009-10-19 14:18 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-17 13:36 [Qemu-devel] [PATCH 0/11] json parser (v2) Anthony Liguori
2009-10-17 13:36 ` [Qemu-devel] [PATCH 01/11] Add append method to qstring and empty constructor Anthony Liguori
2009-10-18 21:36   ` Luiz Capitulino
2009-10-23 19:33     ` Jamie Lokier
2009-10-17 13:36 ` [Qemu-devel] [PATCH 02/11] Add support for qfloat Anthony Liguori
2009-10-18 22:21   ` Luiz Capitulino
2009-10-19 14:18     ` Anthony Liguori
2009-10-22  8:49       ` Amit Shah
2009-10-22 14:01         ` Anthony Liguori
2009-10-22 14:05           ` Amit Shah
2009-10-23 19:25           ` Jamie Lokier
2009-10-23 19:36             ` Daniel P. Berrange
2009-10-17 13:36 ` [Qemu-devel] [PATCH 03/11] Add a test case " Anthony Liguori
2009-10-17 14:00   ` Edgar E. Iglesias
2009-10-17 16:21     ` Anthony Liguori
2009-10-17 13:36 ` [Qemu-devel] [PATCH 04/11] Add json->qobject parser Anthony Liguori
2009-10-23 17:45   ` Luiz Capitulino
2009-10-17 13:36 ` [Qemu-devel] [PATCH 05/11] Add unit test for json parser Anthony Liguori
2009-10-17 13:36 ` [Qemu-devel] [PATCH 06/11] qobject: add QBool type Anthony Liguori
2009-10-18 21:50   ` Luiz Capitulino
2009-10-19 14:17     ` Anthony Liguori [this message]
2009-10-19 14:21       ` Luiz Capitulino
2009-10-17 13:36 ` [Qemu-devel] [PATCH 07/11] qjson: Use QBool for true/false keywords Anthony Liguori
2009-10-17 13:36 ` [Qemu-devel] [PATCH 08/11] qjson: add %i for parsing bools Anthony Liguori
2009-10-17 13:36 ` [Qemu-devel] [PATCH 09/11] qjson: add unit test for varargs bool parsing Anthony Liguori
2009-10-17 13:36 ` [Qemu-devel] [PATCH 10/11] qjson: add vararg format for embedded qobjects Anthony Liguori
2009-10-17 13:36 ` [Qemu-devel] [PATCH 11/11] qjson: add unit test to check %p format Anthony Liguori
2009-10-18 21:34 ` [Qemu-devel] [PATCH 0/11] json parser (v2) Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ADC7502.7030903@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).