DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: B T

⟦e8e7fdcaa⟧ TextFile

    Length: 2929 (0xb71)
    Types: TextFile
    Names: »B«

Derivation

└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
    └─⟦5cb1d1d7f⟧ »DATA« 
        └─⟦3b1ee7bd8⟧ 
            └─⟦this⟧ 

TextFile

with Instrument;
use Instrument;

-------------------------
-- Function Call Elimination
-------------------------

--  This test evaluates a code  improvement  potential  that  results
--  from the reduction of context operations when the opportunity  is
--  offered to eliminate a redundant call to a function.

--  The test procedures contain explicit  redefinitions  of  Global_1
--  and  Global_2.   A  conditional statement is used to perform only
--  the execution of the redefinition of Global_1.  In  the optimized
--  test  procedure  the  redefinition  includes the evaluation of an
--  expression that contains two calls to the same function,  whereas
--  in  the  nonoptimized  test  procedure the redefinition evaluates
--  an expression that calls different functions.

--  Because the test procedures are identical except for the branches
--  of  the  conditional  statement, no difference is expected in the
--  space requirements for the two procedures.   The  effect  of  the
--  improved  code  should  be  evident  from  the  difference in the
--  execution time of the two procedures since the elimination of the
--  common  function  call  collapses  the expression evaluation to a
--  simple assignment.

--  The two functions enclosed in  each  procedure  are  semantically
--  equivalent  and  have  no side-effects.  Each function contains a
--  recursive call  to  avoid  in-line  expansion  of  the  function.
--  Camouflaging the conditional expression prevents other unexpected
--  optimizations that would invalidate the benchmark.

procedure Opcea1 is

    package New_Procs is new Procs (Integer);
    use New_Procs;

    Global_1 : T;
    Global_2 : T;
    Global_3 : T;
    Global_4 : T;

    function Function_1 (Input : T) return T is

    begin

        if Input = Init then
            return Init / Init;
        end if;
        return Function_1 (Init);

    end Function_1;

    function Function_2 (Input : T) return T is

    begin

        if Input /= Init then
            return Function_2 (Init);
        end if;
        return Init / Init;

    end Function_2;

begin

    Start ("OPCEA1", "Optimization Perf., Call Elim. (control)");
    for I in 1 .. 1000 loop

        Let (Global_1, Ident (Init));
        Let (Global_2, Ident (Init));
        Let (Global_3, Ident (Init));
        Let (Global_4, Ident (Init));

        if Ident (Init) = Init then

            Global_1 := T (T (Function_2 (Init) * Global_4) /
                           Function_1 (Init));
            -- included in control version
        else

            Global_2 := T (T (Function_1 (Init) * Global_3) /
                           Function_1 (Init));
            -- included in control version

        end if;

        Let (Global_1, Ident (Init));
        Let (Global_2, Ident (Init));
        Let (Global_3, Ident (Init));
        Let (Global_4, Ident (Init));

    end loop;
    Stop;

end Opcea1;