aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2021-07-07 20:01:54 +0100
committerIain Sandoe <iain@sandoe.co.uk>2021-09-14 16:55:37 +0100
commitc5a735fa9df7eca4666c8da5e51ed9c5ab7cc81a (patch)
tree87ad38cdd386dfe7e74c9ee171f0bbf21f8cc6a6 /gcc/fortran/resolve.c
parentde07cff96abd43f6f65dcf333958899c2ec42598 (diff)
downloadgcc-c5a735fa9df7eca4666c8da5e51ed9c5ab7cc81a.zip
gcc-c5a735fa9df7eca4666c8da5e51ed9c5ab7cc81a.tar.gz
gcc-c5a735fa9df7eca4666c8da5e51ed9c5ab7cc81a.tar.bz2
coroutines: Expose implementation state to the debugger.
In the process of transforming a coroutine into the separate representation as the ramp function and a state machine, we generate some variables that are of interest to a user during debugging. Any variable that is persistent for the execution of the coroutine is placed into the coroutine frame. In particular: The promise object. The function pointers for the resumer and destroyer. The current resume index (suspend point). The handle that represents this coroutine 'self handle'. Any handle provided for a continuation coroutine. Whether the coroutine frame is allocated and needs to be freed. Visibility of some of these has already been requested by end users. This patch ensures that such variables have names that are usable in a debugger, but are in the reserved namespace for the implementation (they all begin with _Coro_). The identifiers are generated lazily when the first coroutine is encountered. We place the variables into the outermost bind expression and then add a DECL_VALUE_EXPR to each that points to the frame entry. These changes simplify the handling of the variables in the body of the function (in particular, the use of the DECL_VALUE_EXPR means that we now no longer need to rewrite proxies for the promise and coroutine handles into the frame->offset form). Partial improvement to debugging (PR c++/99215). Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> gcc/cp/ChangeLog: * coroutines.cc (coro_resume_fn_id, coro_destroy_fn_id, coro_promise_id, coro_frame_needs_free_id, coro_resume_index_id, coro_self_handle_id, coro_actor_continue_id, coro_frame_i_a_r_c_id): New. (coro_init_identifiers): Initialize new name identifiers. (coro_promise_type_found_p): Use pre-built identifiers. (struct await_xform_data): Remove unused fields. (transform_await_expr): Delete code that is now unused. (build_actor_fn): Simplify interface, use pre-built identifiers and remove transforms that are no longer needed. (build_destroy_fn): Use revised field names. (register_local_var_uses): Use pre-built identifiers. (coro_rewrite_function_body): Simplify interface, use pre-built identifiers. Generate proxy vars in the outer bind expr scope for the implementation state that we wish to expose. (morph_fn_to_coro): Adjust comments for new variable names, use pre- built identifiers. Remove unused code to generate frame entries for the implementation state. Adjust call for build_actor_fn.
Diffstat (limited to 'gcc/fortran/resolve.c')
0 files changed, 0 insertions, 0 deletions