qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/2] PPC: Fail on leaking temporaries


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH 2/2] PPC: Fail on leaking temporaries
Date: Sun, 19 Jan 2014 22:17:55 +0100

On 19.01.2014, at 22:04, Peter Maydell <address@hidden> wrote:

> On 19 January 2014 20:55, Alexander Graf <address@hidden> wrote:
>> On 19.01.2014, at 21:52, Peter Maydell <address@hidden> wrote:
>>> 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
> 
> I was thinking the fallback scope would have to be 'whole
> basic block' (both because that makes more sense as a TCG
> API and to avoid having to fix every frontend at once), though
> you're right that this sits a bit awkwardly with the fact that in
> practice the scope you want 99% of the time is going to be
> "single guest insn".

Well, we could have each target define the "default scope" itself. On systems 
where you know that previous instructions may leak into the next (I don't know 
of any, but who knows) you could then make the TB the default scope.


Alex




reply via email to

[Prev in Thread] Current Thread [Next in Thread]