## backend-index.pkg
# Compiled by:
#
src/app/makelib/makelib.sublib# In
# src/lib/core/mythryl-compiler-compiler
#
# we have one compiler-compiler defined for each
# platform (==architecture+os) supported:
#
# mythryl-compiler-compiler-for-pwrpc32-macos.lib
# mythryl-compiler-compiler-for-pwrpc32-posix.lib
# mythryl-compiler-compiler-for-sparc32-posix.lib
# mythryl-compiler-compiler-for-intel32-posix.lib
# mythryl-compiler-compiler-for-intel32-win32.lib
#
# Rather than have all backends loaded into memory at all times,
# we dynamically load backends only in response to
# explicit requests.
#
# The process of loading them on demand is taken care of in
#
#
src/app/makelib/mythryl-compiler-compiler/backend-per-platform.pkg#
# Here we just track currently loaded backends
# and invoke them on request.
#
# The net result of this chicanery is that backend compilitions
# get invoked by the sequence (essentially)
#
# backend_per_platform::invoke which calls # backend_per_platform is from
src/app/makelib/mythryl-compiler-compiler/backend-per-platform.pkg# backend_index::invoke which calls #
# mythryl_compiler_compiler_g::make_mythryl_compiler # mythryl_compiler_compiler_g is from
src/app/makelib/mythryl-compiler-compiler/mythryl-compiler-compiler-g.pkg#
stipulate
package lg = inter_library_dependency_graph; # inter_library_dependency_graph is from
src/app/makelib/depend/inter-library-dependency-graph.pkg package sg = intra_library_dependency_graph; # intra_library_dependency_graph is from
src/app/makelib/depend/intra-library-dependency-graph.pkg package ad = anchor_dictionary; # anchor_dictionary is from
src/app/makelib/paths/anchor-dictionary.pkg package sm = string_map; # string_map is from
src/lib/src/string-map.pkgherein
package backend_index {
# =============
stipulate
# Compile servers send us two kinds of
# requests for forwarding to the backend:
#
# NULL
# THE (generated_filename_infix, libfile)
#
# The first means to do a state reset.
#
# The second means to compile .lib file 'libfile'.
#
Backend_Request
=
Null_Or ( ( String, # generated_filename_infix, usually "", if this is ".pwrpc32-macos", instead of "foo.pkg.compiled" we'll generate "foo.pkg.pwrpc32-macos.compiled".
String # 'makefile' string is .lib file to compile, say "src/etc/mythryl-compiler-root.lib" or "$ROOT/src/etc/mythryl-compiler-root.lib".
) )
;
Platform_Specific_Make_Function
=
Backend_Request
->
Null_Or ( ( lg::Inter_Library_Dependency_Graph,
(sg::Tome_Tin -> Bool), # Compile dagwalker.
ad::Anchor_Dictionary
)
);
per_platform_backend_function_map
=
REF (string_map::empty: string_map::Map( Platform_Specific_Make_Function ));
herein
# This function is invoked (only)
# by the init-time code in
#
src/app/makelib/mythryl-compiler-compiler/mythryl-compiler-compiler-g.pkg #
fun register_per_platform_backend_function
platform # 'platform' string is architecture plus OS, e.g. "intel32-linux"
backend_function # Fn which returns closure to do one compile for server.
=
per_platform_backend_function_map
:=
string_map::set (
*per_platform_backend_function_map,
platform,
backend_function
);
# This function is invoked (only) by 'invoke' in
#
#
src/app/makelib/mythryl-compiler-compiler/backend-per-platform.pkg #
fun invoke
platform # 'platform' string is architecture plus OS, e.g. "intel32-linux"
backend_request # See above comments on Backend_Request.
=
case (string_map::get (*per_platform_backend_function_map, platform))
#
THE backend_function => backend_function backend_request;
NULL => NULL;
esac;
end;
};
end;