• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisão6001f7729e12dd1d810291e4cbf83cee8e07441d (tree)
Hora2018-05-02 03:56:55
AutorLaurent Vivier <lvivier@redh...>
CommiterRichard Henderson

Mensagem de Log

tcg: workaround branch instruction overflow in tcg_out_qemu_ld/st

ppc64 uses a BC instruction to call the tcg_out_qemu_ld/st
slow path. BC instruction uses a relative address encoded
on 14 bits.

The slow path functions are added at the end of the generated
instructions buffer, in the reverse order of the callers.
So more we have slow path functions more the distance between
the caller (BC) and the function increases.

This patch changes the behavior to generate the functions in
the same order of the callers.

Cc: qemu-stable@nongnu.org
Fixes: 15fa08f845 ("tcg: Dynamically allocate TCGOps")
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Message-Id: <20180429235840.16659-1-lvivier@redhat.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Mudança Sumário

Diff

--- a/tcg/tcg-ldst.inc.c
+++ b/tcg/tcg-ldst.inc.c
@@ -30,7 +30,7 @@ typedef struct TCGLabelQemuLdst {
3030 TCGReg datahi_reg; /* reg index for high word to be loaded or stored */
3131 tcg_insn_unit *raddr; /* gen code addr of the next IR of qemu_ld/st IR */
3232 tcg_insn_unit *label_ptr[2]; /* label pointers to be updated */
33- struct TCGLabelQemuLdst *next;
33+ QSIMPLEQ_ENTRY(TCGLabelQemuLdst) next;
3434 } TCGLabelQemuLdst;
3535
3636
@@ -46,7 +46,7 @@ static bool tcg_out_ldst_finalize(TCGContext *s)
4646 TCGLabelQemuLdst *lb;
4747
4848 /* qemu_ld/st slow paths */
49- for (lb = s->ldst_labels; lb != NULL; lb = lb->next) {
49+ QSIMPLEQ_FOREACH(lb, &s->ldst_labels, next) {
5050 if (lb->is_ld) {
5151 tcg_out_qemu_ld_slow_path(s, lb);
5252 } else {
@@ -72,7 +72,7 @@ static inline TCGLabelQemuLdst *new_ldst_label(TCGContext *s)
7272 {
7373 TCGLabelQemuLdst *l = tcg_malloc(sizeof(*l));
7474
75- l->next = s->ldst_labels;
76- s->ldst_labels = l;
75+ QSIMPLEQ_INSERT_TAIL(&s->ldst_labels, l, next);
76+
7777 return l;
7878 }
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -3297,7 +3297,7 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb)
32973297 s->code_ptr = tb->tc.ptr;
32983298
32993299 #ifdef TCG_TARGET_NEED_LDST_LABELS
3300- s->ldst_labels = NULL;
3300+ QSIMPLEQ_INIT(&s->ldst_labels);
33013301 #endif
33023302 #ifdef TCG_TARGET_NEED_POOL_LABELS
33033303 s->pool_labels = NULL;
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -699,7 +699,7 @@ struct TCGContext {
699699
700700 /* These structures are private to tcg-target.inc.c. */
701701 #ifdef TCG_TARGET_NEED_LDST_LABELS
702- struct TCGLabelQemuLdst *ldst_labels;
702+ QSIMPLEQ_HEAD(ldst_labels, TCGLabelQemuLdst) ldst_labels;
703703 #endif
704704 #ifdef TCG_TARGET_NEED_POOL_LABELS
705705 struct TCGLabelPoolData *pool_labels;