[m-rev.] for possible post-commit review: mlds_env_defn
Julien Fischer
jfischer at opturion.com
Fri Jul 14 11:13:12 AEST 2023
On Fri, 14 Jul 2023, Zoltan Somogyi wrote:
> Since this diff deletes the only use of the put_nondet_env_on_heap
> option, would anyone object if I deleted it? It is not publicly documented.
No, go ahead and delete it.
> Represent environments using a bespoke type.
...
> diff --git a/compiler/mlds.m b/compiler/mlds.m
> index 9bd675bec..2a8de1a7a 100644
> --- a/compiler/mlds.m
> +++ b/compiler/mlds.m
> @@ -667,6 +668,51 @@
> mecd_ctors :: list(mlds_function_defn)
> ).
>
> + % The environment structure we use to package up the local variables
> + % needed by model_non continuations.
> + %
> +:- type mlds_env_defn
> + ---> mlds_env_defn(
> + med_env_name :: string,
> + med_context :: prog_context,
> +
> + med_field_vars :: list(mlds_field_var_defn)
> + % The field vars, both those representing HLDS variables
> + % and those implementing accurate gc. Both kind will
s/kind/kinds/
> + % always have flags per_instance, modifiable.
> +
> + % The following comments specify the relationship between
> + % this type and mlds_class_defn (from which mlds_env_defn
> + % was derived).
> + %
> + % Environment structures never have any type parameters.
> + % This means that their "arity" is always zero.
> + % (We do include the _0 suffix in their names in the
> + % C/C#/Java code we generate, at least for now.)
> + %
> + % We treat environment structures as structs when targeting C,
> + % and as classes when targeting C# or Java.
> + %
> + % Environments structures inherit nothing when targeting C,
> + % but inherit the generic env_ptr type when targeting C# or
> + % Java.
> + %
> + % Environment structures are always class_private,
> + % overridable, and modifiable.
> + % XXX The overridable part is probably just an accident.
> + % It is certainly irrelevant, because (a) users cannot create
> + % references to environment structures, so they cannot possibly
> + % inherit from it, and (b) the compiler itself never tries
> + % to inherit from them either.
Agreed.
That's fine otherwise.
Julien.
More information about the reviews
mailing list