get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/811207/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 811207,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/811207/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170907224051.21518-4-richard.henderson@linaro.org/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170907224051.21518-4-richard.henderson@linaro.org>",
    "list_archive_url": null,
    "date": "2017-09-07T22:40:31",
    "name": "[PULL,03/23] tcg: Infrastructure for managing constant pools",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "8c6b1237717697671e5c698d12aff08d32586162",
    "submitter": {
        "id": 72104,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/72104/?format=api",
        "name": "Richard Henderson",
        "email": "richard.henderson@linaro.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170907224051.21518-4-richard.henderson@linaro.org/mbox/",
    "series": [
        {
            "id": 2073,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/2073/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2073",
            "date": "2017-09-07T22:40:28",
            "name": "[PULL,01/23] tcg: Move USE_DIRECT_JUMP discriminator to tcg/cpu/tcg-target.h",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/2073/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/811207/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/811207/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"Bm3Z35X0\"; dkim-atps=neutral"
        ],
        "Received": [
            "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xpFrl3nj8z9sDB\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  8 Sep 2017 08:44:55 +1000 (AEST)",
            "from localhost ([::1]:42524 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dq5XZ-0005fO-I0\n\tfor incoming@patchwork.ozlabs.org; Thu, 07 Sep 2017 18:44:53 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:51955)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <richard.henderson@linaro.org>) id 1dq5Tt-0002xX-Da\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 18:41:10 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <richard.henderson@linaro.org>) id 1dq5To-00082x-89\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 18:41:05 -0400",
            "from mail-pf0-x234.google.com ([2607:f8b0:400e:c00::234]:36486)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <richard.henderson@linaro.org>)\n\tid 1dq5Tn-00081G-VM\n\tfor qemu-devel@nongnu.org; Thu, 07 Sep 2017 18:41:00 -0400",
            "by mail-pf0-x234.google.com with SMTP id e199so1621728pfh.3\n\tfor <qemu-devel@nongnu.org>; Thu, 07 Sep 2017 15:40:59 -0700 (PDT)",
            "from bigtime.twiddle.net (97-126-108-236.tukw.qwest.net.\n\t[97.126.108.236]) by smtp.gmail.com with ESMTPSA id\n\th19sm770678pfh.142.2017.09.07.15.40.57\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tThu, 07 Sep 2017 15:40:57 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=G9JuhqRkFFcCCYIIM7arlN45+QOyUMSOUNFmUZiEKSo=;\n\tb=Bm3Z35X0TtXRp7MNlpEI/V45co6dea/IhIds3XiRuLV2COlaclxL6tZG/WofgIWzvS\n\tTDSuqaDqy5pa0FeCclgPE+8y0KTlW4vKJYmOCi0E5XEygEmuCvyx5dGxu9l2WvahvVJH\n\tWZewjlzg+GT6gU1tTxtfvB/AwQjYlFVP+VmTc=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=G9JuhqRkFFcCCYIIM7arlN45+QOyUMSOUNFmUZiEKSo=;\n\tb=f3DzXIEteqBis0mbK03RlumfAnQj/aF4/jHX0h5IUeLOqhn5Mqhg/HGCwsBYMmLxPS\n\t1Yo+CaZ9oo3mytoDFkeqchaaDxiGWlIoy8eUCo/wSIzzGFFhoKuTg9Gs1TBry38klGp/\n\t+45hwroZo1DDDGcm4xsfiG/J4o+URIKNsGflyXAEHxW+PkuXwobwAGsQdM+JxSUmTNVv\n\tL4TmzaFult30joj16SbN06N7eBp9ZQL1vHc8I+BhZm0c9lD2NxBkpkt0Yh0Utw+m8fYH\n\tpiupP8AsSk6Cl1TD3/ffmOip+eykuN9wFyQvt5J2qatjKHtfJ7kmQ0NSV0F1opwbEi8X\n\tfpSw==",
        "X-Gm-Message-State": "AHPjjUgHCa7yp15+htjvvpKzqsRXPGFYCEixywOJNV/+DQR1qcMIJHP9\n\tN6mOEUBnodGyDg7PbPDPZA==",
        "X-Google-Smtp-Source": "ADKCNb6P9LnCmgh7AThbKNM6ZYG0wgtvwGkZl8hufr/Yze7IUFpsgKtqDUfYIKkx7hxKQ+DyRast/w==",
        "X-Received": "by 10.99.171.73 with SMTP id k9mr961814pgp.196.1504824058584;\n\tThu, 07 Sep 2017 15:40:58 -0700 (PDT)",
        "From": "Richard Henderson <richard.henderson@linaro.org>",
        "To": "qemu-devel@nongnu.org",
        "Date": "Thu,  7 Sep 2017 15:40:31 -0700",
        "Message-Id": "<20170907224051.21518-4-richard.henderson@linaro.org>",
        "X-Mailer": "git-send-email 2.13.5",
        "In-Reply-To": "<20170907224051.21518-1-richard.henderson@linaro.org>",
        "References": "<20170907224051.21518-1-richard.henderson@linaro.org>",
        "X-detected-operating-system": "by eggs.gnu.org: Genre and OS details not\n\trecognized.",
        "X-Received-From": "2607:f8b0:400e:c00::234",
        "Subject": "[Qemu-devel] [PULL 03/23] tcg: Infrastructure for managing constant\n\tpools",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Cc": "peter.maydell@linaro.org, Richard Henderson <rth@twiddle.net>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "From: Richard Henderson <rth@twiddle.net>\n\nA new shared header tcg-pool.inc.c adds new_pool_label,\nfor registering a tcg_target_ulong to be emitted after\nthe generated code, plus relocation data to install a\npointer to the data.\n\nA new pointer is added to the TCGContext, so that we\ndump the constant pool as data, not code.\n\nSigned-off-by: Richard Henderson <rth@twiddle.net>\n---\n tcg/tcg.h                 |  4 +++\n accel/tcg/translate-all.c | 22 +++++++++++-\n tcg/tcg-pool.inc.c        | 85 +++++++++++++++++++++++++++++++++++++++++++++++\n tcg/tcg.c                 |  9 +++++\n 4 files changed, 119 insertions(+), 1 deletion(-)\n create mode 100644 tcg/tcg-pool.inc.c",
    "diff": "diff --git a/tcg/tcg.h b/tcg/tcg.h\nindex b0e00e744e..ac94133870 100644\n--- a/tcg/tcg.h\n+++ b/tcg/tcg.h\n@@ -702,6 +702,7 @@ struct TCGContext {\n     void *code_gen_buffer;\n     size_t code_gen_buffer_size;\n     void *code_gen_ptr;\n+    void *data_gen_ptr;\n \n     /* Threshold to flush the translated code buffer.  */\n     void *code_gen_highwater;\n@@ -716,6 +717,9 @@ struct TCGContext {\n #ifdef TCG_TARGET_NEED_LDST_LABELS\n     struct TCGLabelQemuLdst *ldst_labels;\n #endif\n+#ifdef TCG_TARGET_NEED_POOL_LABELS\n+    struct TCGLabelPoolData *pool_labels;\n+#endif\n \n     TCGTempSet free_temps[TCG_TYPE_COUNT * 2];\n     TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */\ndiff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c\nindex 93a1cf2ba8..2d1ed06065 100644\n--- a/accel/tcg/translate-all.c\n+++ b/accel/tcg/translate-all.c\n@@ -1329,7 +1329,27 @@ TranslationBlock *tb_gen_code(CPUState *cpu,\n         qemu_log_in_addr_range(tb->pc)) {\n         qemu_log_lock();\n         qemu_log(\"OUT: [size=%d]\\n\", gen_code_size);\n-        log_disas(tb->tc_ptr, gen_code_size);\n+        if (tcg_ctx.data_gen_ptr) {\n+            size_t code_size = tcg_ctx.data_gen_ptr - tb->tc_ptr;\n+            size_t data_size = gen_code_size - code_size;\n+            size_t i;\n+\n+            log_disas(tb->tc_ptr, code_size);\n+\n+            for (i = 0; i < data_size; i += sizeof(tcg_target_ulong)) {\n+                if (sizeof(tcg_target_ulong) == 8) {\n+                    qemu_log(\"0x%08\" PRIxPTR \":  .quad  0x%016\" PRIx64 \"\\n\",\n+                             (uintptr_t)tcg_ctx.data_gen_ptr + i,\n+                             *(uint64_t *)(tcg_ctx.data_gen_ptr + i));\n+                } else {\n+                    qemu_log(\"0x%08\" PRIxPTR \":  .long  0x%08x\\n\",\n+                             (uintptr_t)tcg_ctx.data_gen_ptr + i,\n+                             *(uint32_t *)(tcg_ctx.data_gen_ptr + i));\n+                }\n+            }\n+        } else {\n+            log_disas(tb->tc_ptr, gen_code_size);\n+        }\n         qemu_log(\"\\n\");\n         qemu_log_flush();\n         qemu_log_unlock();\ndiff --git a/tcg/tcg-pool.inc.c b/tcg/tcg-pool.inc.c\nnew file mode 100644\nindex 0000000000..8a85131405\n--- /dev/null\n+++ b/tcg/tcg-pool.inc.c\n@@ -0,0 +1,85 @@\n+/*\n+ * TCG Backend Data: constant pool.\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\n+ * of this software and associated documentation files (the \"Software\"), to deal\n+ * in the Software without restriction, including without limitation the rights\n+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ * copies of the Software, and to permit persons to whom the Software is\n+ * furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included in\n+ * all copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+ * THE SOFTWARE.\n+ */\n+\n+typedef struct TCGLabelPoolData {\n+    struct TCGLabelPoolData *next;\n+    tcg_target_ulong data;\n+    tcg_insn_unit *label;\n+    intptr_t addend;\n+    int type;\n+} TCGLabelPoolData;\n+\n+\n+static void new_pool_label(TCGContext *s, tcg_target_ulong data, int type,\n+                           tcg_insn_unit *label, intptr_t addend)\n+{\n+    TCGLabelPoolData *n = tcg_malloc(sizeof(*n));\n+    TCGLabelPoolData *i, **pp;\n+\n+    n->data = data;\n+    n->label = label;\n+    n->type = type;\n+    n->addend = addend;\n+\n+    /* Insertion sort on the pool.  */\n+    for (pp = &s->pool_labels; (i = *pp) && i->data < data; pp = &i->next) {\n+        continue;\n+    }\n+    n->next = *pp;\n+    *pp = n;\n+}\n+\n+/* To be provided by cpu/tcg-target.inc.c.  */\n+static void tcg_out_nop_fill(tcg_insn_unit *p, int count);\n+\n+static bool tcg_out_pool_finalize(TCGContext *s)\n+{\n+    TCGLabelPoolData *p = s->pool_labels;\n+    tcg_target_ulong d, *a;\n+\n+    if (p == NULL) {\n+        return true;\n+    }\n+\n+    /* ??? Round up to qemu_icache_linesize, but then do not round\n+       again when allocating the next TranslationBlock structure.  */\n+    a = (void *)ROUND_UP((uintptr_t)s->code_ptr, sizeof(tcg_target_ulong));\n+    tcg_out_nop_fill(s->code_ptr, (tcg_insn_unit *)a - s->code_ptr);\n+    s->data_gen_ptr = a;\n+\n+    /* Ensure the first comparison fails.  */\n+    d = p->data + 1;\n+\n+    for (; p != NULL; p = p->next) {\n+        if (p->data != d) {\n+            d = p->data;\n+            if (unlikely((void *)a > s->code_gen_highwater)) {\n+                return false;\n+            }\n+            *a++ = d;\n+        }\n+        patch_reloc(p->label, p->type, (intptr_t)(a - 1), p->addend);\n+    }\n+\n+    s->code_ptr = (void *)a;\n+    return true;\n+}\ndiff --git a/tcg/tcg.c b/tcg/tcg.c\nindex dd74eabb0a..fd8a3dfe93 100644\n--- a/tcg/tcg.c\n+++ b/tcg/tcg.c\n@@ -399,6 +399,7 @@ TranslationBlock *tcg_tb_alloc(TCGContext *s)\n         return NULL;\n     }\n     s->code_gen_ptr = next;\n+    s->data_gen_ptr = NULL;\n     return tb;\n }\n \n@@ -2619,6 +2620,9 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb)\n #ifdef TCG_TARGET_NEED_LDST_LABELS\n     s->ldst_labels = NULL;\n #endif\n+#ifdef TCG_TARGET_NEED_POOL_LABELS\n+    s->pool_labels = NULL;\n+#endif\n \n     num_insns = -1;\n     for (oi = s->gen_op_buf[0].next; oi != 0; oi = oi_next) {\n@@ -2698,6 +2702,11 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb)\n         return -1;\n     }\n #endif\n+#ifdef TCG_TARGET_NEED_POOL_LABELS\n+    if (!tcg_out_pool_finalize(s)) {\n+        return -1;\n+    }\n+#endif\n \n     /* flush instruction cache */\n     flush_icache_range((uintptr_t)s->code_buf, (uintptr_t)s->code_ptr);\n",
    "prefixes": [
        "PULL",
        "03/23"
    ]
}