> On 10 Dec 2024, at 01:02, Jason Merrill <ja...@redhat.com> wrote:
> 
> On 12/9/24 2:39 PM, Iain Sandoe wrote:
>>> On 9 Dec 2024, at 19:34, Jason Merrill <ja...@redhat.com> wrote:
>>> 
>>> On 12/9/24 2:00 PM, Iain Sandoe wrote:
>>>>> On 9 Dec 2024, at 18:56, Jason Merrill <ja...@redhat.com> wrote:
>>>>> 
>>>>> On 11/29/24 8:47 AM, Iain Sandoe wrote:
>>>>>> Tested on x86_64-darwin, x86_64-linux,
>>>>>> OK for trunk?
>>>>>> thanks
>>>>>> Iain
>>>>>> --- 8< ---
>>>>>> At present, we only update the suspend index when we actually are
>>>>>> at the stage that the coroutine is considered suspended. This is
>>>>>> on the basis that it is UB to resume or destroy a coroutines that
>>>>>> is not suspended (and therefore we never need to access this value
>>>>>> otherwise).  However, it is possible that someone could set a debug
>>>>>> breakpoint on the resume which can be reached without suspending
>>>>>> if await_ready() returns true.
>>>>> 
>>>>> Hmm, https://eel.is/c++draft/expr#await-5 reads to me like there's only a 
>>>>> suspend point if await_ready() returns false?
>>>> yes, exactly.
>>>> which would mean that we only updated the suspend index in that case 
>>>> (which is fine if the only observer of the index is the coroutines code).
>>>> This change is entirely to cater for the fact that a debugger can observe 
>>>> the coroutine in states other than those that can be reached from  
>>>> resume() or destroy().
>>> 
>>> I guess I'm getting confused by the comment referring to a suspend point, 
>>> where actually we're dealing with the resume index, which is independent of 
>>> the suspend point?
>> Yes - although the coroutines code only ever inspects it after a suspension 
>> - a debugger could inspect it at any time and, logically, it should icrement 
>> as we pass each  “if (awaiter.await_ready())” independent of whether that 
>> results in a suspension.
> 
> So can we change the comment and variable name to refer to resume index 
> instead of suspend?  OK with that adjustment.

Yes, that makes more sense, pushed as attached.
thanks
Iain

Attachment: 0001-c-coroutines-Make-the-resume-index-consistent-for-de.patch
Description: Binary data

Reply via email to