On 24 June 2011 11:08, Max Filippov <jcmvb...@gmail.com> wrote:
>> Here are my rules of thumb for generating code where the code
>> generated might change based on some bit of CPU state:
>>
>> When you are generating code, if the code you generate will
>> change based on the contents of something in the CPUState struct,
>> then the bit of CPUState you are looking at has to be one of:
>>  (1) encoded in the TB flags (or tb->pc or tb->cs_base)
>>      (and gen_intermediate_code_internal() must read and
>>      use the value in tb->tb_flags, not the one in env)
>
> So if changing a bit of context does not cause TB invalidation then it
> must be captured in cpu_get_tb_cpu_state and
> gen_intermediate_code_internal must use that captured value?

Yes. (The other option is to arrange to not change the code you
generate based on that bit of context, for instance you can generate
code which loads an env field and passes it to a helper function.)

-- PMM

Reply via email to