From patchwork Tue Oct 10 00:55:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 115314 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3168983qgn; Mon, 9 Oct 2017 18:01:27 -0700 (PDT) X-Received: by 10.200.33.186 with SMTP id 55mr16986623qty.300.1507597287234; Mon, 09 Oct 2017 18:01:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507597287; cv=none; d=google.com; s=arc-20160816; b=Zxxos5Lykvay5A+W01NZeVIZVaYWV1Wpp+OVfH19FIubIygzpV0YPS4zWeoJQPRwuH 4D0r4hnvb5hSmnA8Jd1Z2Okv4MYnGhmzqH4aHxSWd72ern10foa3XNgNeb03jubMr947 mc+Lqm5idzgHFnBpCgjtsV46mNV3QNEJihgxJckqS1Gmzw8OBwl/cV7jVWR8S1KbAjxd LOEOBcew64/gYCfFf+zFTBjVrQx7Bzgh2IrmQ8nMe+4b9Sh8DZFpmzg/H8/6OPhlNyc+ Yx1Epl50FScKRYFwlIvagOjsJS97ScDu9fgdl6nIc57hzs5WDr6Tat0eyoUgaWNWDPHJ m6FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=ebVXYo9xSf9+M5MN2bcKmd/IRQv/NN06okyxN5KTf2Q=; b=QnpI/PyHWlHbtOkB/b0KZOTFaprqvNf1rM3llvkqfNXuMUqy4mXrStYg6kKPkXRgYn 806QZHf5TSdNPWJe5TdIMri4Jx7lNBNpPqw0KdbaNv8KkPFOZJCrWwuDk3SJtT/99VPw S+u4JJbIRdKIQ0sWdTyH0LM2NMdCjCkdkID9BiBixjgy4jpWXDm12a1YIM9SVb1Fj1D2 MKKoLPk0xq0rbaPbRABLbzQEy5i8vRN2ZCR1ogMLWo/nTV4Y2bzmpZHjSzbsRE5tmgIJ gATL6RjKPXQA0wuxyueuRR/O2ZU/MOjL4SR0A84a883yN79w1jU3VU2QDuv/KRX//a+n 3vOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Rx9Gg+gH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id e1si3690795qkd.373.2017.10.09.18.01.26 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 09 Oct 2017 18:01:27 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Rx9Gg+gH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60504 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1ivF-0005rs-43 for patch@linaro.org; Mon, 09 Oct 2017 21:01:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1iqR-0002Ph-Bi for qemu-devel@nongnu.org; Mon, 09 Oct 2017 20:56:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1iqQ-0004YJ-Ek for qemu-devel@nongnu.org; Mon, 09 Oct 2017 20:56:27 -0400 Received: from mail-pf0-x22c.google.com ([2607:f8b0:400e:c00::22c]:44482) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e1iqQ-0004Xw-90 for qemu-devel@nongnu.org; Mon, 09 Oct 2017 20:56:26 -0400 Received: by mail-pf0-x22c.google.com with SMTP id x7so5175683pfa.1 for ; Mon, 09 Oct 2017 17:56:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ebVXYo9xSf9+M5MN2bcKmd/IRQv/NN06okyxN5KTf2Q=; b=Rx9Gg+gHm5fUUbxGnguP9K9kvJJJs0WrqRDTdNeIAZAuQQ+RuT9DKxQxiIZ6yiTEdg 2fGubB9ikZ9kBdEBjcq1tP7BvzaQUMR+tNymEa7aw0CZ3+2x1WVzwtPd23xqRWikqWer +jmxzljZKxV6kWHrIbj0mVkgUlELqK8mJSr1Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ebVXYo9xSf9+M5MN2bcKmd/IRQv/NN06okyxN5KTf2Q=; b=Fohp+VXMVIyysCLfGFnZ05U5o69j3PjKzc4hEw8wf6hEmzoDjYWs+5VD6z6MC7FFE6 77QfchX+e9vZV1l+sR9eCBhwsLPeqcvfIVtsX/U7jZIYdiYPC8TPLmutWxdDv2ZmfK7v z8u7qvLTz+gp5mA6Oc5avBIQAzr4ITwmQur0xORjDQWq1MxjVRenrT/gfKtEJDxLq+8a usIcFsDL3d41GCBq1V9+rFMgLkRiLiDxopLqPdH1e905N695S3WjCT+P4/yg0OJL8XhQ 7AKL6L0n7XecURuncoZFdnP0+z9O5hfx8drZp01UzZqGCgQ1pdOBtVpaP+EERxuMbPQz Sp/w== X-Gm-Message-State: AMCzsaVV/RllWfXV4/mTo2QIGRz39BQPsr/Ju3UapYkRiSDitN3k4wfD I338J8cdbF2Tk7LdTmV7ivu5f5uTLco= X-Google-Smtp-Source: AOwi7QAduQX2n7bwzRifV+U0PWE1DxBu47h0//ZQDwtNs/+cbaE+RA2oIqhIE00UaISPkVg2Gp+VoQ== X-Received: by 10.99.127.78 with SMTP id p14mr10348896pgn.176.1507596984980; Mon, 09 Oct 2017 17:56:24 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-104-76.tukw.qwest.net. [97.126.104.76]) by smtp.gmail.com with ESMTPSA id n19sm17121368pfj.52.2017.10.09.17.56.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Oct 2017 17:56:24 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 9 Oct 2017 17:55:54 -0700 Message-Id: <20171010005600.28735-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171010005600.28735-1-richard.henderson@linaro.org> References: <20171010005600.28735-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::22c Subject: [Qemu-devel] [PULL 17/23] tcg: take .helpers out of TCGContext X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, "Emilio G. Cota" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Groundwork for supporting multiple TCG contexts. The hash table becomes read-only after it is filled in, so we can save space by keeping just a global pointer to it. Reviewed-by: Richard Henderson Reviewed-by: Alex Bennée Signed-off-by: Emilio G. Cota Signed-off-by: Richard Henderson --- tcg/tcg.h | 2 -- tcg/tcg.c | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) -- 2.13.6 diff --git a/tcg/tcg.h b/tcg/tcg.h index 25662c36d4..b2d42e3136 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -656,8 +656,6 @@ struct TCGContext { tcg_insn_unit *code_ptr; - GHashTable *helpers; - #ifdef CONFIG_PROFILER /* profiling info */ int64_t tb_count1; diff --git a/tcg/tcg.c b/tcg/tcg.c index a874bdd41f..ee60798438 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -318,6 +318,7 @@ typedef struct TCGHelperInfo { static const TCGHelperInfo all_helpers[] = { #include "exec/helper-tcg.h" }; +static GHashTable *helper_table; static int indirect_reg_alloc_order[ARRAY_SIZE(tcg_target_reg_alloc_order)]; static void process_op_defs(TCGContext *s); @@ -328,7 +329,6 @@ void tcg_context_init(TCGContext *s) TCGOpDef *def; TCGArgConstraint *args_ct; int *sorted_args; - GHashTable *helper_table; memset(s, 0, sizeof(*s)); s->nb_globals = 0; @@ -356,7 +356,7 @@ void tcg_context_init(TCGContext *s) /* Register helpers. */ /* Use g_direct_hash/equal for direct pointer comparisons on func. */ - s->helpers = helper_table = g_hash_table_new(NULL, NULL); + helper_table = g_hash_table_new(NULL, NULL); for (i = 0; i < ARRAY_SIZE(all_helpers); ++i) { g_hash_table_insert(helper_table, (gpointer)all_helpers[i].func, @@ -982,7 +982,7 @@ void tcg_gen_callN(TCGContext *s, void *func, TCGArg ret, unsigned sizemask, flags; TCGHelperInfo *info; - info = g_hash_table_lookup(s->helpers, (gpointer)func); + info = g_hash_table_lookup(helper_table, (gpointer)func); flags = info->flags; sizemask = info->sizemask; @@ -1211,8 +1211,8 @@ static char *tcg_get_arg_str_idx(TCGContext *s, char *buf, static inline const char *tcg_find_helper(TCGContext *s, uintptr_t val) { const char *ret = NULL; - if (s->helpers) { - TCGHelperInfo *info = g_hash_table_lookup(s->helpers, (gpointer)val); + if (helper_table) { + TCGHelperInfo *info = g_hash_table_lookup(helper_table, (gpointer)val); if (info) { ret = info->name; }