On 8/22/24 12:35 PM, Iain Sandoe wrote:
Hi Jason,
Firstly, Arsen has WIP to revise the allocation / deallocation to deal with
coroutine frames that are more aligned than 2 * sizeof (pointer). We will also
be considering Lewis' P2014 (use of the aligned allocator). So this patch is
very much a staging point.
operator new for the params provided. Extract a simplified version
+ of the machinery from build_operator_new_call.
This seems like a call to that function, not a simplified version of it?
Fixed the comment.
+ NOTE: This can update the frame size so we need to account for that
+ when building the IFN_CO_FRAME later. */
I don't think it can when cookie and size_check are both NULL, as they are here.
That is good to know and I think we can factor in a change to the revisions we
are making for more aligned frames (since we will need to intercept and change
the frame allocation size to deal with those).
+build_coroutine_frame_delete_expr (tree coro_fp, tree orig, tree frame_size,
+ tree promise_type, location_t loc)
+{
Here it seems like you could already use build_op_delete_call for all of this,
just by converting coro_fp to pointer-to-promise_type instead of to
ptr_type_node?
I am missing something - the frame pointer is not a pointer to a promise object
it is a pointer to the whole coroutine state?
Yes, but you could lie about that; build_op_delete_call only uses the
type for lookup (which we want to do in the promise type), then converts
to void*.
+ location_t save_input_loc = input_location;
+ location_t loc = fn_start;
+ input_location = loc;
Here using iloc_sentinel is simple.
now using it.
+ /* The decl_expr for the coro frame pointer, initialize to zero so that we
+ can pass it to the IFN_CO_FRAME (since there's no way to pass a type,
+ directly apparently). This avoids a "used uninitialized" warning. */
You could pass build_zero_cst (frame_ptr_type) instead of the variable?
changed to do that.
I meant pass the zero_cst to IFN_CO_FRAME, so you don't need to
initialize coro_fp until after that call.
Jason