## codetemps-with-heapcleaner-info-g.pkg
#
# Here we basically wrap
#
# rgk::make_codetemp_info_of_kind
#
# in a little function which automatically annotates
# the new code temp with some info for the heapcleaner.
#
# This appears to be another project started but never finished;
# activation is controlled by the always-FALSE
#
# lowhalf_track_heapcleaner_type_info
#
# flag in
#
#
src/lib/compiler/back/low/main/main/translate-nextcode-to-treecode-g.pkg#
# The other relevant files are:
#
#
src/lib/compiler/back/low/heapcleaner-safety/per-codetemp-heapcleaner-info-template.api#
src/lib/compiler/back/low/main/nextcode/per-codetemp-heapcleaner-info.api#
src/lib/compiler/back/low/main/nextcode/per-codetemp-heapcleaner-info.pkg#
src/lib/compiler/back/low/heapcleaner-safety/codetemps-with-heapcleaner-info.api#
src/lib/compiler/back/low/heapcleaner-safety/codetemps-with-heapcleaner-info-g.pkg# Compiled by:
#
src/lib/compiler/back/low/lib/lowhalf.libstipulate
package nt = note; # note is from
src/lib/src/note.pkg package rkj = registerkinds_junk; # registerkinds_junk is from
src/lib/compiler/back/low/code/registerkinds-junk.pkgherein
# This generic is invoked (only) in:
#
#
src/lib/compiler/back/low/main/main/translate-nextcode-to-treecode-g.pkg #
generic package codetemps_with_heapcleaner_info_g (
# =================================
#
package rgk: Registerkinds; # Registerkinds is from
src/lib/compiler/back/low/code/registerkinds.api package chi: Per_Codetemp_Heapcleaner_Info_Template; # Per_Codetemp_Heapcleaner_Info_Template is from
src/lib/compiler/back/low/heapcleaner-safety/per-codetemp-heapcleaner-info-template.api # Currently chi is always
src/lib/compiler/back/low/main/nextcode/per-codetemp-heapcleaner-info.pkg )
: (weak) Codetemps_With_Heapcleaner_Info # Codetemps_With_Heapcleaner_Info is from
src/lib/compiler/back/low/heapcleaner-safety/codetemps-with-heapcleaner-info.api {
# Export to client packages:
#
package rgk = rgk; # "rgk" == "registerkinds".
package chi = chi; # "chi" == "(per) codetemp heapcleaner info".
# Generate a new codetemp and update the
# heapcleaner information at the same time:
#
fun make_codetemp_info_of_kind kind # (kind: rkj::Registerkind) is typically rkj::INT_REGISTER or rkj::FLOAT_REGISTER
=
make_codetemp_info'
where
make_codetemp_info = rgk::make_codetemp_info_of_kind kind; # NB: This call is slow, but calls to 'make_codetemp_info' are fast -- See comment in
src/lib/compiler/back/low/code/registerkinds.api set = chi::cleaner_type.set;
fun make_codetemp_info' heapcleaner_info
=
{ (make_codetemp_info ()) -> codetemp_info as rkj::CODETEMP_INFO { notes, ... };
notes := set (heapcleaner_info, *notes);
codetemp_info;
};
end;
fun get_heapcleaner_info_from_codetemp_info (rkj::CODETEMP_INFO { notes, ... } )
=
chi::cleaner_type.lookup *notes;
fun set_heapcleaner_info_on_codetemp_info (rkj::CODETEMP_INFO { notes, ... }, heapcleaner_info)
=
notes := chi::cleaner_type.set (heapcleaner_info, *notes);
fun codetemp_info_to_string (rkj::CODETEMP_INFO { notes, ... } )
=
case (chi::cleaner_type.get *notes)
#
THE type => ":" + chi::to_string type;
NULL => ":?";
esac;
heapcleaner_liveout = nt::make_notekind (THE (\\ _ = "HCLIVEOUT"))
: nt::Notekind( List( (rkj::Codetemp_Info, chi::Heapcleaner_Info) ) );
};
end;