type, public :: prif_team_type
private
type(c_ptr) :: gex_team
type(c_ptr) :: heap_mspace
integer(c_intptr_t) :: heap_start
type(prif_team_type), pointer :: parent_team
type(handle_data), pointer :: coarrays
end type
This "unboxed" implementation of prif_team_type contains several mutable fields, and the WIP teams branch adds even more.
As such, I believe this is an unsuitable representation for prif_team_type: because it fails to provide the handle-like semantics of ISO_FORTRAN_ENV::TEAM_TYPE. IOW the client is free to make copies of TEAM_TYPE/prif_team_type variables, and all copies of the same prif_team_type value need to consistently reference the same abstract team, even after operations like CHANGE TEAM and prif_allocate_coarray that mutate the team's internal state.
The solution is to add a level of indirection, similar to what we already have prif_coarray_handle (for some of the same reasons). Eg:
type, public :: prif_team_type
private
type(team_data), pointer :: info
end type
...
type, private :: team_data
private
type(c_ptr) :: gex_team
type(c_ptr) :: heap_mspace
integer(c_intptr_t) :: heap_start
type(team_data), pointer :: parent_team
type(handle_data), pointer :: coarrays
end type
Along with updates to all the code that accesses prif_team_type components.
Currently in prif.f90:
This "unboxed" implementation of
prif_team_type
contains several mutable fields, and the WIP teams branch adds even more.As such, I believe this is an unsuitable representation for
prif_team_type
: because it fails to provide the handle-like semantics ofISO_FORTRAN_ENV::TEAM_TYPE
. IOW the client is free to make copies ofTEAM_TYPE
/prif_team_type
variables, and all copies of the sameprif_team_type
value need to consistently reference the same abstract team, even after operations likeCHANGE TEAM
andprif_allocate_coarray
that mutate the team's internal state.The solution is to add a level of indirection, similar to what we already have
prif_coarray_handle
(for some of the same reasons). Eg:Along with updates to all the code that accesses
prif_team_type
components.