PreviousUpNext

15.3.246  src/lib/compiler/front/semantic/pickle/pickler-junk.api

## pickler-junk.api
#
# The revised pickler using the new "generic" pickling facility.
#
# March 2000, Matthias Blume

# Compiled by:
#     src/lib/compiler/core.sublib

stipulate
    package acf =  anormcode_form;                                                      # anormcode_form                is from   src/lib/compiler/back/top/anormcode/anormcode-form.pkg
    package tmp =  highcode_codetemp;                                                   # highcode_codetemp             is from   src/lib/compiler/back/top/highcode/highcode-codetemp.pkg
    package ix  =  inlining_mapstack;                                                   # inlining_mapstack             is from   src/lib/compiler/toplevel/compiler-state/inlining-mapstack.pkg
    package ph  =  picklehash;                                                          # picklehash                    is from   src/lib/compiler/front/basics/map/picklehash.pkg
    package pkr =  pickler;                                                             # pickler                       is from   src/lib/compiler/src/library/pickler.pkg
    package sta =  stamp;                                                               # stamp                         is from   src/lib/compiler/front/typer-stuff/basics/stamp.pkg
    package stx =  stampmapstack;                                                       # stampmapstack                 is from   src/lib/compiler/front/typer-stuff/modules/stampmapstack.pkg
    package syx =  symbolmapstack;                                                      # symbolmapstack                is from   src/lib/compiler/front/typer-stuff/symbolmapstack/symbolmapstack.pkg
    package sy  =  symbol;                                                              # symbol                        is from   src/lib/compiler/front/basics/map/symbol.pkg
    package vh  =  varhome;                                                             # varhome                       is from   src/lib/compiler/front/typer-stuff/basics/varhome.pkg
herein

    # This api is implemented in:
    #
    #     src/lib/compiler/front/semantic/pickle/pickler-junk.pkg
    #
    api Pickler_Junk {

        # There are three situations in which we run the pickler.
        #  Each form of Pickling_Context (see below) corresponds to one of them:
        #
        #  1. The initial pickle.  This is done right after a new symbol
        #     table has been constructed by the typer.  The pickle_context
        #     is used to identify those identifiers (stampmapstack.<xxx>Id) that
        #     correspond to stubs.  Only the domain of the given map is relevant
        #     here, but since we (usually) need the full map right afterwards
        #     for unpickling, there is no gain in using a set.
        #
        #  2. Pickling a previously pickled-and-unpickled dictionary from
        #     which some parts may have been pruned.  This is used to calculate
        #     a new hash value that is equal to the hash obtained from an initial
        #     pickle (1.) of the dictionary if it had been pruned earlier.
        #     (This is used by makelib's cutoff recompilation system.
        #     Pickles obtained here are never unpickled.)
        #     No actual context is necessary because stubification info is
        #     fully embedded in the dictionary to be pickled.  However, we
        #     must provide the original picklehash obtained from the first
        #     pickling because occurrences of that picklehash have to be
        #     treated the same way their "not-yet-occurrences" had been
        #     treated in step 1.
        #
        #  3. A set of dictionaries that have already gone through an initial
        #     pickling-and-unpickling is pickled as part of a freezefile.
        #     The context is a sequence of maps together with information
        #     on how to get hold of the same map later during unpickling.
        #     (The full context of a freezefile is a set of other frozen
        #     libraries, but during unpickling we want to avoid unpickling
        #     all of these other libraries in full.)
        #
        Pickling_Context
          = INITIAL_PICKLING     stx::Stampmapstack
          | REPICKLING           ph::Picklehash
          | FREEZEFILE_PICKLING  List( (Null_Or( (Int, sy::Symbol) ), stx::Stampmapstack))
          ;

        Map;

        empty_map:  Map;

        make_symbolmapstack_funtree:  (tmp::Codetemp -> Void)
                              -> Pickling_Context
                              -> pkr::To_Funtree( Map, syx::Symbolmapstack );

        make_inlining_mapstack_funtree:  pkr::To_Funtree( Map, ix::Picklehash_To_Anormcode_Mapstack );

        pickle_symbolmapstack:  Pickling_Context
                            ->  syx::Symbolmapstack
                            ->  {  picklehash:  ph::Picklehash,
                                   pickle:      vector_of_one_byte_unts::Vector, 
                                   exported_highcode_variables: List( tmp::Codetemp )
                                };

        pickle_highcode_program:  Null_Or( acf::Function )
                                  ->
                                  { picklehash: ph::Picklehash,
                                    pickle:     vector_of_one_byte_unts::Vector
                                  };

        hash_pickle: vector_of_one_byte_unts::Vector -> ph::Picklehash;

        dont_pickle:  { symbolmapstack:  syx::Symbolmapstack,
                        count:        Int
                      }
                     ->
                      {   new_symbolmapstack:                   syx::Symbolmapstack,
                          picklehash:                           ph::Picklehash,
                          exported_highcode_variables:          List( tmp::Codetemp )
                      };
    };
end;







Comments and suggestions to: bugs@mythryl.org

PreviousUpNext