qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 37/45] tcg: introduce **tcg_ctxs to keep trac


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v2 37/45] tcg: introduce **tcg_ctxs to keep track of all TCGContext's
Date: Mon, 17 Jul 2017 18:17:21 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/16/2017 10:04 AM, Emilio G. Cota wrote:
Groundwork for supporting multiple TCG contexts.

Note that having n_tcg_ctxs is unnecessary. However, it is
convenient to have it, since it will simplify iterating over the
array: we'll have just a for loop instead of having to iterate
over a NULL-terminated array (which would require n+1 elems)
or having to check with ifdef's for usermode/softmmu.

Signed-off-by: Emilio G. Cota <address@hidden>
---
  tcg/tcg.c | 10 ++++++++++
  1 file changed, 10 insertions(+)

diff --git a/tcg/tcg.c b/tcg/tcg.c
index f907c47..8094278 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -115,6 +115,8 @@ static int tcg_target_const_match(tcg_target_long val, 
TCGType type,
  static void tcg_out_tb_init(TCGContext *s);
  static bool tcg_out_tb_finalize(TCGContext *s);
+static TCGContext **tcg_ctxs;
+static unsigned int n_tcg_ctxs;

I'm perfectly happy introducing these now, and converting stuff to use them.

+static void tcg_ctxs_init(TCGContext *s)
+{
+    tcg_ctxs = g_new(TCGContext *, 1);
+    tcg_ctxs[0] = s;
+    n_tcg_ctxs = 1;
+}

This was confusing to me, trying to figure out how this function would be extended for multi-threading. But it turns out it isn't -- it just goes away.

@@ -381,6 +390,7 @@ void tcg_context_init(TCGContext *s)
          indirect_reg_alloc_order[i] = tcg_target_reg_alloc_order[i];
      }
+ tcg_ctxs_init(s);
      tcg_ctx = s;
  }

Thus I think it would be simpler for the interim to do

    tcg_ctx = s;
    tcg_ctxs = &tcg_ctx;
    n_tcg_ctxs = 1;


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]