diff options
author | Richard Henderson <rth@twiddle.net> | 2015-02-13 18:51:05 -0800 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2015-03-13 12:28:18 -0700 |
commit | 51e3972c41598adc91fe3f4767057f5198dcc15c (patch) | |
tree | bb1e33739384cf31f98979006d020a52d57a4aaf /tcg/tcg.h | |
parent | bec1631100323fac0900aea71043d5c4e22fc2fa (diff) |
tcg: Use tcg_malloc to allocate TCGLabel
Pre-allocating 512 of them per TB is a waste.
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tcg/tcg.h')
-rw-r--r-- | tcg/tcg.h | 16 |
1 files changed, 5 insertions, 11 deletions
@@ -167,7 +167,8 @@ typedef struct TCGRelocation { } TCGRelocation; typedef struct TCGLabel { - int has_value; + unsigned has_value : 1; + unsigned id : 31; union { uintptr_t value; tcg_insn_unit *value_ptr; @@ -183,8 +184,6 @@ typedef struct TCGPool { #define TCG_POOL_CHUNK_SIZE 32768 -#define TCG_MAX_LABELS 512 - #define TCG_MAX_TEMPS 512 /* when the size of the arguments of a called function is smaller than @@ -556,8 +555,6 @@ struct TCGContext { target_ulong gen_opc_pc[OPC_BUF_SIZE]; uint16_t gen_opc_icount[OPC_BUF_SIZE]; uint8_t gen_opc_instr_start[OPC_BUF_SIZE]; - - TCGLabel labels[TCG_MAX_LABELS]; }; extern TCGContext tcg_ctx; @@ -766,9 +763,7 @@ TCGLabel *gen_new_label(void); static inline TCGArg label_arg(TCGLabel *l) { - ptrdiff_t idx = l - tcg_ctx.labels; - tcg_debug_assert(idx >= 0 && idx < tcg_ctx.nb_labels); - return idx; + return (uintptr_t)l; } /** @@ -779,10 +774,9 @@ static inline TCGArg label_arg(TCGLabel *l) * encoding of the TCG opcode stream. */ -static inline TCGLabel *arg_label(TCGArg idx) +static inline TCGLabel *arg_label(TCGArg i) { - tcg_debug_assert(idx < tcg_ctx.nb_labels); - return &tcg_ctx.labels[idx]; + return (TCGLabel *)(uintptr_t)i; } /** |