From patchwork Tue Oct 10 19:30:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 115466 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp4125689qgn; Tue, 10 Oct 2017 12:44:48 -0700 (PDT) X-Received: by 10.55.25.85 with SMTP id k82mr14518863qkh.223.1507664688037; Tue, 10 Oct 2017 12:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507664688; cv=none; d=google.com; s=arc-20160816; b=YMocO6JGp2ZlxyLXGzcPgDcayW4u5n0NNaTyT4D2icRvUWpEoLH8cqg3Uh/UvHDtIK 4bgaWJLmQSn7JwwwYMWomN++Wecj+amyBMrxq98aS0k57QkxuakESicD8QYowPL9DomQ z9Soa0j3zttNZDuB62Z4o/hNoQar4U/Ie1nftjh7EWPQwiimd2tTE3ipKOGjFD6cb1EQ sJ4nKx5SA8o0mTViNblYaTBljI6wnEufA+ghkqyJm+Ml/HioaIf/Mmky7B7AzNXSTKuC ShQ+uawtpT5bOfDEP83EnQ7/v6PtN+zGoOOGp7zxRoKUGh3YukKJOuM442i/CZ5BHl+J j+DA== 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=b/+Xyu2lnxxT0rSWF9pFLv3qBMitdDxSqiZfbBLSpEBjlwZkttFmYJVtjdPRmB1Y+Z oQNbuqrtVWxclaUxSFnr82G4upPtVCBEegZaglTbfl/gDezYGeOcIoyuVM6uUsEwUBXp /xfVyPVHX5Kt/Euo/rOE2KCGo+PToKshpyW1DJ4MdNPBhA6nfSeNujm4cUdyKwZMP7dj vLzqUgjCV/j+by5LMmMWLdDSk2np/0/HWyjnnOsAF6XPMxfOcqL9yuKUFjnxJZ1nKPDo B0/Mm1zXbNWpiIjrmtbj1+i9nIMLpQnc+YRSxFkiaJPxNW9Tx0AiOYntMpmS9AJo2cru esOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=aCkGXzcp; 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 g48si200925qtk.317.2017.10.10.12.44.47 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 10 Oct 2017 12:44:48 -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=aCkGXzcp; 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]:36856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e20SL-0003SX-Te for patch@linaro.org; Tue, 10 Oct 2017 15:44:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58953) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e20Eb-0000pa-W3 for qemu-devel@nongnu.org; Tue, 10 Oct 2017 15:30:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e20EY-00057b-GV for qemu-devel@nongnu.org; Tue, 10 Oct 2017 15:30:33 -0400 Received: from mail-pf0-x22a.google.com ([2607:f8b0:400e:c00::22a]:43070) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e20EY-00057H-BH for qemu-devel@nongnu.org; Tue, 10 Oct 2017 15:30:30 -0400 Received: by mail-pf0-x22a.google.com with SMTP id d2so15081441pfh.0 for ; Tue, 10 Oct 2017 12:30:30 -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=aCkGXzcplSjdonFm/EZPN8Lq7JM1BQ35PjWcZAlS09l/dpxNGP37KJqXqE93sVo5fT UU/2QcVRalUe2jpBAb/jUSvZfGT048tEIyEUQTScPNbUQG0Lfl1SASANkSm9BRqAiNBl 8Ntt5DmjIT8LYHkc23vTCyHuz2Amz94ZyN/qo= 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=MYYzdjnpBAg02mDXjiOmQSQ7ml5vqmNYaDa/vvLZ321SvTuLtBRLpY2JgGv2ez2HYF oQkHzqoQU009qN3UCl4wHsem3cbWeT4trr7NC9IhzyAOmIb2zQlCIvWSrA0EU+cGWGt3 6CMk90c7cs8gZaoWLpWIVN+Gm/glXciKPjbPObtpSHeK89d3LaMrh3BrM2uhUsXjHGFN +gsMii1fU3D+8puI5Fp8cmHnqHV0pXHbmXacFXT5mjzs+1HF0KJpf98ap1oEW8MvYPoY q4YXNTAkG7P7zg6mmqF4hZMr1FDaeaOtzZJTBGiweg2UfeB//buKqJHhiNkszRbAYy8R lxJQ== X-Gm-Message-State: AMCzsaU+BoUtEGRWDe85rbWZ8bmA0ZosbX9/aSESMtOWKkQevQ80GlCs IJvvvbC/g1lNQMfLlWH8+STqHA/udWI= X-Google-Smtp-Source: AOwi7QBe0l4rXy7RQSmf4Dv58RXAUj5bYDVeG7wS9pEvgltS03wvqEPHDP8KB+qbdMQitZ0Ok1+kjw== X-Received: by 10.98.185.10 with SMTP id z10mr127287pfe.8.1507663829171; Tue, 10 Oct 2017 12:30:29 -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 r22sm19859788pfl.15.2017.10.10.12.30.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Oct 2017 12:30:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Tue, 10 Oct 2017 12:30:00 -0700 Message-Id: <20171010193003.28857-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171010193003.28857-1-richard.henderson@linaro.org> References: <20171010193003.28857-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::22a Subject: [Qemu-devel] [PULL v2 17/20] 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; }