On Mon, Jul 17, 2017 at 17:53:33 -1000, Richard Henderson wrote: > On 07/16/2017 10:04 AM, Emilio G. Cota wrote: > >Groundwork for supporting multiple TCG contexts. (snip) > > struct TCGContext { > > uint8_t *pool_cur, *pool_end; > > TCGPool *pool_first, *pool_current, *pool_first_large; > >@@ -717,6 +725,10 @@ struct TCGContext { > > TCGTempSet free_temps[TCG_TYPE_COUNT * 2]; > > TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */ > >+ /* optimizer */ > >+ struct tcg_temp_info *opt_temps; > >+ TCGTempSet opt_temps_used; > > I would prefer either > > (1) Dynamic allocation. I know we eschew that most places during, > but surely this is the exact situation for which it's handy. > > (2) Make opt_temps an array of TCG_MAX_TEMPS and drop the pointer.
Originally I implemented (2). But the array is pretty large and realised that the init ctx doesn't use it at all. So I made the allocation dynamic, i.e. tcg_optimize will allocate the array if the ctx doesn't have it yet. But I guess that's not what you mean with (1)? You mean to allocate every single time we call tcg_optimize, allocating only the space we need on each call? > I think the TCGTempSet should be a local within tcg_optimize. Will do. E.