From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org
Subject: [Qemu-devel] [PULL 1/6] tcg: Use tcg_malloc to allocate TCGLabelQemuLdst
Date: Fri, 13 Mar 2015 13:23:08 -0700 [thread overview]
Message-ID: <1426278193-15317-2-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1426278193-15317-1-git-send-email-rth@twiddle.net>
Pre-allocating 640 of them per TB is a waste.
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
tcg/tcg-be-ldst.h | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/tcg/tcg-be-ldst.h b/tcg/tcg-be-ldst.h
index 429cba2..4a45102 100644
--- a/tcg/tcg-be-ldst.h
+++ b/tcg/tcg-be-ldst.h
@@ -21,7 +21,6 @@
*/
#ifdef CONFIG_SOFTMMU
-#define TCG_MAX_QEMU_LDST 640
typedef struct TCGLabelQemuLdst {
bool is_ld; /* qemu_ld: true, qemu_st: false */
@@ -34,11 +33,11 @@ typedef struct TCGLabelQemuLdst {
int mem_index; /* soft MMU memory index */
tcg_insn_unit *raddr; /* gen code addr of the next IR of qemu_ld/st IR */
tcg_insn_unit *label_ptr[2]; /* label pointers to be updated */
+ struct TCGLabelQemuLdst *next;
} TCGLabelQemuLdst;
typedef struct TCGBackendData {
- int nb_ldst_labels;
- TCGLabelQemuLdst ldst_labels[TCG_MAX_QEMU_LDST];
+ TCGLabelQemuLdst *labels;
} TCGBackendData;
@@ -48,7 +47,7 @@ typedef struct TCGBackendData {
static inline void tcg_out_tb_init(TCGContext *s)
{
- s->be->nb_ldst_labels = 0;
+ s->be->labels = NULL;
}
/*
@@ -60,15 +59,14 @@ static void tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l);
static void tcg_out_tb_finalize(TCGContext *s)
{
- TCGLabelQemuLdst *lb = s->be->ldst_labels;
- int i, n = s->be->nb_ldst_labels;
+ TCGLabelQemuLdst *lb;
/* qemu_ld/st slow paths */
- for (i = 0; i < n; i++) {
- if (lb[i].is_ld) {
- tcg_out_qemu_ld_slow_path(s, lb + i);
+ for (lb = s->be->labels; lb != NULL; lb = lb->next) {
+ if (lb->is_ld) {
+ tcg_out_qemu_ld_slow_path(s, lb);
} else {
- tcg_out_qemu_st_slow_path(s, lb + i);
+ tcg_out_qemu_st_slow_path(s, lb);
}
}
}
@@ -80,11 +78,11 @@ static void tcg_out_tb_finalize(TCGContext *s)
static inline TCGLabelQemuLdst *new_ldst_label(TCGContext *s)
{
TCGBackendData *be = s->be;
- int n = be->nb_ldst_labels;
+ TCGLabelQemuLdst *l = tcg_malloc(sizeof(*l));
- assert(n < TCG_MAX_QEMU_LDST);
- be->nb_ldst_labels = n + 1;
- return &be->ldst_labels[n];
+ l->next = be->labels;
+ be->labels = l;
+ return l;
}
#else
#include "tcg-be-null.h"
--
2.1.0
next prev parent reply other threads:[~2015-03-13 20:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-13 20:23 [Qemu-devel] [PULL 0/6] Use tcg_malloc more; tcg_cond_always fix Richard Henderson
2015-03-13 20:23 ` Richard Henderson [this message]
2015-03-13 20:23 ` [Qemu-devel] [PULL 2/6] tcg-ia64: Use tcg_malloc to allocate TCGLabelQemuLdst Richard Henderson
2015-03-13 20:23 ` [Qemu-devel] [PULL 3/6] tcg: Change translator-side labels to a pointer Richard Henderson
2015-03-13 20:23 ` [Qemu-devel] [PULL 4/6] tcg: Change generator-side " Richard Henderson
2015-03-13 20:23 ` [Qemu-devel] [PULL 5/6] tcg: Use tcg_malloc to allocate TCGLabel Richard Henderson
2015-03-13 20:23 ` [Qemu-devel] [PULL 6/6] tcg: Complete handling of ALWAYS and NEVER Richard Henderson
2015-03-13 20:50 ` [Qemu-devel] [PULL 0/6] Use tcg_malloc more; tcg_cond_always fix Patchew Tool
2015-03-16 9:53 ` Peter Maydell
2015-03-16 10:57 ` Peter Maydell
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=1426278193-15317-2-git-send-email-rth@twiddle.net \
--to=rth@twiddle.net \
--cc=peter.maydell@linaro.org \
--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).