## mythryl-compiler-g.pkg
# Compiled by:
#
src/lib/compiler/core.sublib# Here we define the mythryl_compiler package as
# seen by higher software layers. In particular,
# we generate the mythryl_compiler value used in:
#
#
src/app/makelib/main/makelib-g.pkg#
src/app/makelib/compile/compile-in-dependency-order-g.pkg#
# We actually provide two compilation interfaces:
#
# interact,
# for interactive use compiling direct from
# the user's commandline into memory,
#
# translate_raw_syntax_to_execode
# for batch use compiling sourcefiles
# on disk to .compiled object files on disk.
#
# Our generic is invoked in
#
#
src/lib/compiler/toplevel/compiler/mythryl-compiler-for-pwrpc32.pkg#
src/lib/compiler/toplevel/compiler/mythryl-compiler-for-sparc32.pkg#
src/lib/compiler/toplevel/compiler/mythryl-compiler-for-intel32-posix.pkg#
src/lib/compiler/toplevel/compiler/mythryl-compiler-for-intel32-win32.pkg#
# to produce the corresponding platform-specific compilers
#
# mythryl_compiler_for_pwrpc32
# mythryl_compiler_for_sparc32
# mythryl_compiler_for_intel32_posix
# mythryl_compiler_for_intel32_win32
#
# one of which is then annointed to be the default "backend" by
#
#
src/lib/core/mythryl-compiler-compiler/mythryl-compiler-compiler-for-this-platform.lib#
# Generic argument "package backend" is the machine-dependent
# appropriate code generator for our platform.
#
#
# Our api Mythryl_Compiler is defined in
#
#
src/lib/compiler/toplevel/compiler/mythryl-compiler.api#
# in terms of the
#
# Profiling_Control
# Translate_Raw_Syntax_To_Execode
# Read_Eval_Print_Loops
# Backend_Lowhalf_Core
#
# apis defined in (respectively):
#
#
src/lib/compiler/debugging-and-profiling/profiling/profiling-control.api#
src/lib/compiler/toplevel/main/translate-raw-syntax-to-execode.api#
src/lib/compiler/toplevel/interact/read-eval-print-loops.api#
src/lib/compiler/back/low/main/main/backend-lowhalf-core.apistipulate
package cms = compiler_mapstack_set; # compiler_mapstack_set is from
src/lib/compiler/toplevel/compiler-state/compiler-mapstack-set.pkg package cps = compiler_state; # compiler_state is from
src/lib/compiler/toplevel/interact/compiler-state.pkg package fil = file__premicrothread; # file__premicrothread is from
src/lib/std/src/posix/file--premicrothread.pkg package ph = picklehash; # picklehash is from
src/lib/compiler/front/basics/map/picklehash.pkg package pkj = pickler_junk; # pickler_junk is from
src/lib/compiler/front/semantic/pickle/pickler-junk.pkg package s2m = collect_all_modtrees_in_symbolmapstack; # collect_all_modtrees_in_symbolmapstack is from
src/lib/compiler/front/typer-stuff/symbolmapstack/collect-all-modtrees-in-symbolmapstack.pkg package sta = stamp; # stamp is from
src/lib/compiler/front/typer-stuff/basics/stamp.pkgherein
generic package mythryl_compiler_g ( # mythryl_compiler_g is from
src/lib/compiler/toplevel/compiler/mythryl-compiler-g.pkg # ==================
#
package bak: Backend; # Backend is from
src/lib/compiler/toplevel/main/backend.api # #
# # backend can be backend_pwrpc32 from
src/lib/compiler/back/low/main/pwrpc32/backend-pwrpc32.pkg # # backend can be backend_sparc32 from
src/lib/compiler/back/low/main/sparc32/backend-sparc32.pkg # # backend can be backend_intel32_g call from
src/lib/compiler/toplevel/compiler/mythryl-compiler-for-intel32-posix.pkg # # backend can be backend_intel32_g call from
src/lib/compiler/toplevel/compiler/mythryl-compiler-for-intel32-win32.pkg #
ansi_c_prototype_convention: String; # "unix_convention", "windows_convention" or "unimplemented".
)
: (weak) Mythryl_Compiler # Mythryl_Compiler is from
src/lib/compiler/toplevel/compiler/mythryl-compiler.api {
# This is actually a full backend_lowhalf, but
# we export it as just a backend_lowhalf_core:
#
package backend_lowhalf_core = bak::blh; # Backend_Lowhalf is a superset of Backend_Lowhalf_Core -- see
src/lib/compiler/back/low/main/main/backend-lowhalf-core.api target_architecture = bak::target_architecture; # PWRPC32/SPARC32/INTEL32.
abi_variant = bak::abi_variant;
package unparse_compiler_state
= unparse_compiler_state;
package translate_raw_syntax_to_execode
=
translate_raw_syntax_to_execode_g ( # translate_raw_syntax_to_execode_g is from
src/lib/compiler/toplevel/main/translate-raw-syntax-to-execode-g.pkg #
my ansi_c_prototype_convention
= ansi_c_prototype_convention;
package backend = bak; # "bak" == "backend".
package compiler_configuration: (weak) Compiler_Configuration { # Compiler_Configuration is from
src/lib/compiler/toplevel/main/compiler-configuration.api #
# Compiler configuration for batch compilation
# (under control of Makelib); real pickling, unpickling,
# and pid-generation:
Pickle = vector_of_one_byte_unts::Vector;
Hash = ph::Picklehash;
Picklehash = Hash;
Compiledfile_Version = String;
fun pickle_unpickle
{ context, # Combined symbol tables of all .compiled files upon which our sourcefile depends.
compiledfile_version,
symbolmapstack => new_symbolmapstack # Symbol table containing (only) result of compiling our sourcefile.
}
=
{ m = s2m::collect_all_modtrees_in_symbolmapstack context;
fun up_context _ = m;
(pkj::pickle_symbolmapstack (pkj::INITIAL_PICKLING m) new_symbolmapstack)
->
{ picklehash, pickle, exported_highcode_variables };
picklehash
=
rehash_module::add_compiledfile_version { picklehash, compiledfile_version };
new_symbolmapstack' # The unpickler adds modtree entries to the symbol table per
src/lib/compiler/front/typer-stuff/modules/module-level-declarations.pkg =
unpickler_junk::unpickle_symbolmapstack up_context (picklehash, pickle);
{ picklehash,
pickle,
new_symbolmapstack => new_symbolmapstack',
exported_highcode_variables,
export_picklehash => case exported_highcode_variables [] => NULL;
_ => THE picklehash;
esac
};
};
make_fresh_stamp_maker
=
sta::make_fresh_stamp_maker;
};
);
package rpl # "rpl" == "read_eval_print_loops".
=
read_eval_print_loops_g ( # read_eval_print_loops_g def in
src/lib/compiler/toplevel/interact/read-eval-print-loops-g.pkg #
read_eval_print_loop_g ( # read_eval_print_loop_g def in
src/lib/compiler/toplevel/interact/read-eval-print-loop-g.pkg #
translate_raw_syntax_to_execode_g ( # translate_raw_syntax_to_execode_g def in
src/lib/compiler/toplevel/main/translate-raw-syntax-to-execode-g.pkg #
ansi_c_prototype_convention =
ansi_c_prototype_convention;
package backend = bak; # "bak" == "backend".
package compiler_configuration: (weak) Compiler_Configuration { # Compiler_Configuration is from
src/lib/compiler/toplevel/main/compiler-configuration.api #
# Compiler configuration for interactive toplevel:
# No real pickling/unpickling;
# picklehashes are assigned randomly.
Pickle = Void;
Hash = Void;
Picklehash = ph::Picklehash;
Compiledfile_Version = Void;
stipulate
top_count = REF 0;
herein
fun pickle_unpickle { context, symbolmapstack => new_symbolmapstack, compiledfile_version }
=
{
top_count := *top_count + 1;
(pkj::dont_pickle
{
symbolmapstack => new_symbolmapstack,
count => *top_count
})
->
{ new_symbolmapstack,
picklehash,
exported_highcode_variables
};
# pickler_junk is from
src/lib/compiler/front/semantic/pickle/pickler-junk.pkg { picklehash => (),
pickle => (),
exported_highcode_variables,
new_symbolmapstack,
export_picklehash => case exported_highcode_variables [] => NULL;
_ => THE picklehash;
esac
};
};
end;
stipulate
stamp_fn = sta::make_fresh_stamp_maker ();
herein
fun make_fresh_stamp_maker ()
=
stamp_fn; # Always the same.
end;
};
)
)
);
package profiling_control
=
profiling_control_g ( # profiling_control_g is from
src/lib/compiler/debugging-and-profiling/profiling/profiling-control-g.pkg #
package pd # "pd" == "profiling_dictionary".
=
profiling_dictionary_g # profiling_dictionary_g is from
src/lib/compiler/debugging-and-profiling/profiling/profiling-dictionary-g.pkg (
Dictionary = cms::Compiler_Mapstack_Set;
symbolmapstack_part = cms::symbolmapstack_part;
layer = cms::concatenate_compiler_mapstack_sets;
fun evaluate (s, e)
=
rpl::evaluate_stream (fil::open_string s, e);
);
pervasive_fun_etc_defs_jar
=
cps::pervasive_fun_etc_defs_jar;
);
};
end;
## (C) 2001 Lucent Technologies, Bell Labs
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.