On 19.01.2014, at 21:52, Peter Maydell <peter.mayd...@linaro.org> wrote:

> On 19 January 2014 20:15, Alexander Graf <ag...@suse.de> wrote:
>> On 19.01.2014, at 17:51, Peter Maydell <peter.mayd...@linaro.org> wrote:
>>> Exiting is pretty harsh; ARM just warns and continues.
> 
>> Well, the check only ever happens when QEMU gets compiled
>> with --enable-debug-tcg, so I figured it's easier for me to catch
>> new problems or problems with unit tests if we get a harsh abort :).
> 
> Well, you're the one that gets to field the bug reports for PPC so
> it's your call :-)
> 
> Longer term I was wondering if we should define the concept
> of a 'scope object' for TCG temporaries, so you create a scope
> object and then we have versions of tcg_temp_new_*() that
> take a scope object to effectively define the lifetime of that
> temp. Destroying the scope object frees every TCG temp in it.
> Then we could just have the target frontends create a scope
> for each instruction, and they wouldn't need to worry about
> manually freeing TCG temporaries within it at all. That seems
> better than the current approach where every frontend rolls
> its own auto-free mechanism, and would render this sort of
> "check for bugs in manual temp freeing" unnecessary too.
> 
> (We could also make the tcg_gen_brcond* functions do a
> "free all temps in all scope objects" and then we'd catch
> use-of-temp-after-branch bugs, especially if we also got
> TCG to assert on use of a dead temporary rather than only
> later when it was doing regalloc on it...)

I agree - that would be awesome :). We could even go as far as defining a 
"fallback scope" that's instruction wide.


Alex


Reply via email to