|
From: | Charlie Shepherd |
Subject: | Re: [Qemu-devel] [PATCH 2/5] qemu_coroutine_self should not be marked coroutine_fn as it cannot yield |
Date: | Thu, 08 Aug 2013 02:29:39 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 |
On 07/08/2013 23:13, Gabriel Kerneis wrote:
On Wed, Aug 07, 2013 at 09:18:05PM +0200, Stefan Hajnoczi wrote:I guess the practical problem is that CPC will get upset that it's being called by the coroutine implementation from non-coroutine contexts.But is it really the case? If Charlie added an annotation, it probably means that in practice it was only called from coroutine context anyway.
It was also called from coroutine implementation in functions that weren't annotated coroutine_fn (qemu_coroutine_switch() and friends).
The only downside from CPC's point of view is that there is a cost to making a coroutine_fn, and it's a pity to pay it when it's useless (ie. when the function never yields anyway).
Yes although in this case it won't be too high as the function will simply be
Coroutine *internal_qemu_coroutine_self(void); coroutine_fn Coroutine *qemu_coroutine_self(void) { return internal_qemu_coroutine_self(); }and the original qemu_coroutine_self couldn't be inlined, so I don't think it is too prohibitive. Besides, I doubt qemu_coroutine_self() is called in many fast-paths.
Charlie
[Prev in Thread] | Current Thread | [Next in Thread] |