PreviousUpNext

15.4.597  src/lib/compiler/front/typer-stuff/basics/inlining-data.pkg

## inlining-data.pkg
#
# Framework for passing inlining information around during typechecking.
# (Uses the "exception as universal extensible type"
# hack to avoid being even more backend tophalf specific.)

# Compiled by:
#     src/lib/compiler/front/typer-stuff/typecheckdata.sublib


# Client packages include:
#
#     src/lib/compiler/front/typer-stuff/deep-syntax/variables-and-constructors.pkg
#     src/lib/compiler/front/typer-stuff/modules/module-junk.pkg
#     src/lib/compiler/front/typer-stuff/modules/module-level-declarations.pkg
#     src/lib/compiler/front/typer/main/type-api.pkg
#     src/lib/compiler/front/typer/main/type-core-language.pkg
#     src/lib/compiler/front/typer/main/type-package-language-g.pkg
#     src/lib/compiler/front/typer/modules/api-match-g.pkg
#     src/lib/compiler/front/typer/modules/generics-expansion-junk-g.pkg
#     src/lib/compiler/front/typer/types/type-core-language-declaration-g.pkg
#     src/lib/compiler/front/semantic/basics/inlining-junk.pkg
#     src/lib/compiler/debugging-and-profiling/profiling/tdp-instrument.pkg
#     src/lib/compiler/debugging-and-profiling/profiling/add-per-fun-call-counters-to-deep-syntax.pkg
#

stipulate
#    package hbo =  highcode_baseops;                           # highcode_baseops              is from   src/lib/compiler/back/top/highcode/highcode-baseops.pkg
    package tdt =  type_declaration_types;                      # type_declaration_types        is from   src/lib/compiler/front/typer-stuff/types/type-declaration-types.pkg
herein
    package inlining_data {
        #
        Inlining_Data
          = LEAF  Exception                                     # The "exception hack" allows any desired information to be stored.
          | LIST  List( Inlining_Data )
          | NIL
          ;

        stipulate
            fun bug message
                =
                error_message::impossible ("inlining_data: " + message);
        herein
            fun is_simple (LEAF _) =>   TRUE;
                is_simple _        =>   FALSE;
            end;

            fun select (LIST l, i) =>   (list::nth (l, i)     except INDEX_OUT_OF_BOUNDS =  bug "Wrong field in inlining_data::LIST !");
                select (NIL,    _) =>   NIL;
                select (LEAF _, i) =>   bug "Unexpected selection from inlining_data::LEAF !";
            end;

            ref_get_inlining_data_for_prettyprinting                            # This gets set in   src/lib/compiler/front/semantic/basics/inlining-junk.pkg
                =
                REF ( (\\ _ = ("ref_get_inlining_data_for_prettyprinting uninitialized -- ignore WILDCARD", tdt::WILDCARD_TYPOID))
                      : Inlining_Data -> (String, tdt::Typoid)
                    );

            fun get_inlining_data_for_prettyprinting  inlining_data             # Support for unpacking Inlining_Data even where highcode_baseops package is not visible.
                =                                                               # This is intended for use in   src/lib/compiler/front/typer/print/prettyprint-value.pkg
                *ref_get_inlining_data_for_prettyprinting  inlining_data;       # and                           src/lib/compiler/front/typer/print/latex-print-value.pkg
        end;
    };
end;

## (C) 2001 Lucent Technologies, Bell Labs


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext