On Sun, Jul 09, 2017 at 10:48:27 -1000, Richard Henderson wrote: > On 07/08/2017 09:50 PM, Emilio G. Cota wrote: > >@@ -409,6 +411,18 @@ void tcg_context_init(TCGContext *s) > > } > > /* > >+ * Clone the initial TCGContext. Used by TCG threads to copy the TCGContext > >+ * set up by their parent thread via tcg_context_init(). > >+ */ > >+void tcg_context_clone(TCGContext *s) > >+{ > >+ if (unlikely(tcg_init_ctx == NULL || tcg_init_ctx == s)) { > >+ tcg_abort(); > >+ } > >+ memcpy(s, tcg_init_ctx, sizeof(*s)); > >+} > > Under what conditions will this be called? How much of this might you need > to zero out again after the fact?
I checked the profile/tb counts and all of them are zero when this is called, which is right after the thread has been created. But it is conceivable that those counts might be !0 for some targets, so yes it'd be better to actively zero out those. I don't think there are any other fields that would have to be zeroed out. E.