On 11 December 2015 at 03:43, Valerón JC <bandinfin...@hotmail.com> wrote: > I want to trace a bug in tcg, which for me, at some point, generate infinite > loop TB chains, that's unexpected. and I've found the final TB(head, since > they're chaining) which run in an infinite loop, and I know a very weird > trick to 'disable' this bug, so I would like to track the tcg-ops for the > TB, hope that I can figure what's wrong.
If the guest code is an infinite loop then we will generate a chain of TBs which goes round in a loop too. (Execution will escape from the loop via longjmp when there is a guest interrupt or other exception.) > but when I read the tcg_gen_code(), I'm confused... > how does tcg_gen_code() generate codes for one TB? if I read the code > correctly, gen_intermediate_code() will not flush the > tcg_ctx->gen_opc_buf[], codes for previous TB are mixed together... and > tcg_gen_code() will start gen from index 0 of gen_opc_buf, how does it > generate codes for the TB just created? This code has changed, and tcg_ctx->gen_opc_buf doesn't exist any more. We store ops in a linked list now rather than an array. The answer to your question in general is still the same, though: before calling gen_intermediate_code() we call tcg_func_start(), which resets the TCGContext to a clean state, including "no temporaries allocated", "no labels" and "no ops". thanks -- PMM