PreviousUpNext

15.4.701  src/lib/compiler/toplevel/main/compiler-controls.pkg

## compiler-controls.pkg

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



stipulate
    package bc  =  basic_control;                                       # basic_control                 is from   src/lib/compiler/front/basics/main/basic-control.pkg
    package ci  =  global_control_index;                                # global_control_index          is from   src/lib/global-controls/global-control-index.pkg
    package cj  =  global_control_junk;                                 # global_control_junk           is from   src/lib/global-controls/global-control-junk.pkg
    package ctl =  global_control;                                      # global_control                is from   src/lib/global-controls/global-control.pkg
    package fil =  file__premicrothread;                                # file__premicrothread          is from   src/lib/std/src/posix/file--premicrothread.pkg
    package tc  =  typer_control;                                       # typer_control                 is from   src/lib/compiler/front/typer/basics/typer-control.pkg
    package tdc =  typer_data_controls;                                 # typer_data_controls           is from   src/lib/compiler/front/typer-stuff/main/typer-data-controls.pkg
herein

    package   compiler_controls
    : (weak)  Compiler_Controls                                         # Compiler_Controls             is from   src/lib/compiler/toplevel/main/control-apis.api
    {
        menu_slot =  [10, 11, 2];
        obscurity =  6;                                                 # XXX SUCKO FIXME obscurity values should be given intelligible names like "high" "medium" "low". Who knows what 6 means? 
        prefix    =  "compiler";

        registry  =  ci::make { help => "compiler controls" };
                                                                            my _ = 
        bc::note_subindex
            #
            (prefix, registry, menu_slot);              # XXX BUGGO FIXME more stuff which should be part of a state record, not global mutable state.

        b  =  cj::cvt::bool;
        i  =  cj::cvt::int;
        r  =  cj::cvt::float;
        sl =  cj::cvt::string_list;

        next_menu_slot =  REF 0;

        fun make_control (control_type, name, help, initial_value)
            =
            {   val_ref   =  REF  initial_value;
                menu_slot =  *next_menu_slot;

                control
                    =
                    ctl::make_control {         # global_control                is from   src/lib/global-controls/global-control.pkg
                      name,
                      help,
                      menu_slot =>  [menu_slot],
                      obscurity,
                      control   =>  val_ref
                    };

                next_menu_slot :=  menu_slot + 1;

                ci::note_control
                    #
                    registry
                    #
                    { control         =>  ctl::make_string_control  control_type  control,
                      dictionary_name =>  THE (cj::dn::to_upper "CG_" name)
                    };

                val_ref;
            };

        verbose_compile_log             = make_control (b, "verbose_compile_log",       "?", FALSE);    # When compiling foo.pkg, write lots of stuff into foo.pkg.compile.log.  Used (in particular) in   src/app/makelib/compile/compile-in-dependency-order-g.pkg

        trap_int_overflow               = make_control (b, "trap_int_overflow",         "?", FALSE);    # If TRUE, emit code to raise an OVERFLOW exception if fixed-precision int addition (say) overflows available size-in-bits.

        check_vector_index_bounds       = make_control (b, "check_vector_index_bounds", "?", TRUE);     # If TRUE, emit code to raise a  INDEX_OUT_OF_BOUNDS exception if the supplied index for a vector get/set op is out of range.

        compile_in_subprocesses         = make_control (b, "compile_in_subprocesses",   "?", FALSE);    # If TRUE fork() off compiles for parallelism on multicore machines.
                                                                                                        # Used (only) in   src/app/makelib/compile/compile-in-dependency-order-g.pkg
                                                                                                        #
                                                                                                        # I used to do this on the mono-threaded (pre version 7.0) version of Mythryl;
                                                                                                        # it cut "make compiler" from 2.5 to 1.5 minutes on six cores.
                                                                                                        # But with   src/lib/std/src/hostthread/cpu-bound-task-hostthreads.pkg  running five posix threads
                                                                                                        # and with   src/lib/std/src/hostthread/io-bound-task-hostthreads.pkg   running five posix threads more
                                                                                                        # and with   src/lib/std/src/hostthread/io-wait-hostthread.pkg          running one  posix thread more (with a private pipe!)
                                                                                                        # trying to fork() the whole complex sanely seems more trouble than it is worth.  E.g., see:
                                                                                                        #
                                                                                                        #    http://www.linuxprogrammingblog.com/threads-and-fork-think-twice-before-using-them
                                                                                                        #
                                                                                                        # At this point I think it makes more sense to clean up the compiler and make it
                                                                                                        # properly multi-threaded than to spend time trying to maintain multi-process compiles.
                                                                                                        #
                                                                                                        # NB: This is a great example of why we need Software Transactional Memory: Without
                                                                                                        #     it operations like fork() have no way to locate a self-consistent system state.
                                                                                                        #                                                 -- 2012-06-12 CrT

        tailrecur               = make_control (b, "tailrecur", "?", TRUE);
        recordopt               = make_control (b, "recordopt", "?", TRUE);
        tail                    = make_control (b, "tail", "?", TRUE);

        allocprof               = make_control (b, "allocprof", "?", FALSE);
        closureprint            = make_control (b, "closureprint", "?", FALSE);
        closure_strategy        = make_control (i, "closure_strategy", "?", 0);

        lambdaopt               = make_control (b, "lambdaopt", "?", TRUE);

        optional_nextcode_improvers             = make_control (sl, "optional_nextcode_improvers", "nextcode optimizer phases", ["zeroexpand", "last_contract"]);

    #    ["first_contract", "eta", "uncurry", "split_known_escaping_functions",
    #   "cycle_expand", "eta", "last_contract" ]

        rounds                  = make_control (i, "rounds", "max # of optional_nextcode_improvers rounds", 10);
        path                    = make_control (b, "path", "?", FALSE);
        beta_contract           = make_control (b, "beta_contract", "?", TRUE);

        eta                     = make_control (b, "eta", "?", TRUE);
        selectopt               = make_control (b, "selectopt", "?", TRUE);
        dropargs                = make_control (b, "dropargs", "?", TRUE);

        deadvars                = make_control (b, "deadvars", "?", TRUE);
        flattenargs             = make_control (b, "flattenargs", "?", FALSE);
        extraflatten            = make_control (b, "extraflatten", "?", FALSE);

        switchopt               = make_control (b, "switchopt", "?", TRUE);
        handlerfold             = make_control (b, "handlerfold", "?", TRUE);
        branchfold              = make_control (b, "branchfold", "?", FALSE);

        arithopt                = make_control (b, "arithopt", "?", TRUE);
        beta_expand             = make_control (b, "beta_expand", "?", TRUE);
        unroll                  = make_control (b, "unroll", "?", TRUE);

        knownfiddle             = make_control (b, "knownfiddle", "?", FALSE);
        invariant               = make_control (b, "invariant", "?", TRUE);
        targeting               = make_control (i, "targeting", "?", 0);

        lambdaprop              = make_control (b, "lambdaprop", "?", FALSE);
        newconreps              = make_control (b, "newconreps", "?", TRUE);

        boxedconstconreps       = tc::boxedconstconreps;

        unroll_recursion        = make_control (b, "unroll_recursion", "?", TRUE);
        sharepath               = make_control (b, "sharepath", "?", TRUE);

        static_closure_size_profiling   =  make_control (b, "static_closure_size_profiling", "?", FALSE);

        hoistup                 = make_control (b, "hoistup", "?", FALSE);
        hoistdown               = make_control (b, "hoistdown", "?", FALSE);

        recordcopy              = make_control (b, "recordcopy", "?", TRUE);
        recordpath              = make_control (b, "recordpath", "?", TRUE);

        verbose                 = make_control (b, "verbose", "?", FALSE);
        debugnextcode           = make_control (b, "debugnextcode", "?", FALSE);
        misc4                   = make_control (i, "misc4", "?", 0);

        argrep                  = make_control (b, "argrep", "?", TRUE);
        bodysize                = make_control (i, "bodysize", "?", 20);
        reducemore              = make_control (i, "reducemore", "?", 15);

        alphac                          = make_control (b, "alphac", "?", TRUE);
        comment                         = make_control (b, "comment", "?", FALSE);

        known_function                  = make_control (i, "known_function", "?", 0);
        known_cl_function               = make_control (i, "known_cl_function", "?", 0);

        escape_function                 = make_control (i, "escape_function", "?", 0);
        callee_function                 = make_control (i, "callee_function", "?", 0);

        spill_function                  = make_control (i, "spill_function", "?", 0);
        foldconst                       = make_control (b, "foldconst", "?", TRUE);                     # Apparently never used.

        printit                         = make_control (b, "printit", "whether to show nextcode", FALSE);
        printsize                       = make_control (b, "printsize", "?", FALSE);

        scheduling                      = make_control (b, "scheduling", "?", TRUE);
        cse                             = make_control (b, "cse", "?", FALSE);                          # "cse" might be "common subexpression elimination"

        split_known_escaping_functions  = make_control (b, "split_known_escaping_functions", "?", TRUE);
        improve_after_closure           = make_control (b, "improve_after_closure", "?", FALSE);

        uncurry                 = make_control (b, "uncurry", "?", TRUE);
        if_idiom                = make_control (b, "if_idiom", "?", TRUE);
        comparefold             = make_control (b, "comparefold", "?", TRUE);
        csehoist                = make_control (b, "csehoist", "?", FALSE);
        rangeopt                = make_control (b, "rangeopt", "?", FALSE);
        icount                  = make_control (b, "icount", "?", FALSE);

        debug_representation    = make_control (b, "debug_representation", "?", FALSE);

        checklty1               = make_control (b, "checklty1",      "?", FALSE);
        checklty2               = make_control (b, "checklty2",      "?", FALSE);
        checklty3               = make_control (b, "checklty3",      "?", FALSE);
        checknextcode1          = make_control (b, "checknextcode1", "?", FALSE);
        checknextcode2          = make_control (b, "checknextcode2", "?", FALSE);
        checknextcode3          = make_control (b, "checknextcode3", "?", FALSE);
        checknextcode           = make_control (b, "checknextcode",  "?", FALSE);

        flatfblock              = make_control (b, "flatfblock", "?", TRUE);
        deadup                  = make_control (b, "deadup", "?", TRUE);

        poll_checks             = make_control (b, "poll_checks", "?", FALSE);
        poll_ratio_a_to_i       = make_control (r, "poll_ratio_a_to_i", "?", 1.0);

        print_flowgraph_stream = REF fil::stdout;

        disambiguate_memory     =  make_control (b, "disambiguate_memory", "?", FALSE);
        control_dependence      =  make_control (b, "control_dependence", "?", FALSE);
        highcodeon              =  make_control (b, "highcodeon", "?", TRUE);

        comp_debugging                          = make_control (b, "comp_debugging", "?", FALSE);

        module_junk_debugging                   = tdc::module_junk_debugging;
        translate_to_anormcode_debugging        = tdc::translate_to_anormcode_debugging;
        type_junk_debugging                     = tdc::type_junk_debugging;

        types_debugging                         = tdc::types_debugging;
        expand_generics_g_debugging             = tdc::expand_generics_g_debugging;
        typerstore_debugging                    = tdc::typerstore_debugging;

        generics_expansion_junk_debugging       = tc::generics_expansion_junk_debugging;
        api_match_debugging                     = tc::api_match_debugging;
        type_package_language_debugging         = tc::type_package_language_debugging;

        typer_junk_debugging                    = tc::typer_junk_debugging;
        type_api_debugging                      = tc::type_api_debugging;
        typecheck_type_debugging                = tc::typecheck_type_debugging;

        unify_typoids_debugging                 = tc::unify_typoids_debugging;
        expand_oop_syntax_debugging             = tc::expand_oop_syntax_debugging;
        translate_types_debugging               = make_control (b, "translate_types_debugging", "?", FALSE);
    };
end;

## COPYRIGHT (c) 1995 AT&T Bell Laboratories 
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext