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

⟦b1558e4f8⟧ TextFile

    Length: 2439 (0x987)
    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;

---------------------
-- Direct Recursive Call
---------------------

-- This test evaluates the code efficiency of a recursive call to a
-- procedure that has no formal parameters.

-- The parameterless procedure Recursive_Procedure is used to make a
-- recursive call.  This procedure uses two Boolean variables, Recursion
-- and Test, declared in its enclosing scope to control its execution.
-- The variable Recursion is initialized to the value of Test, which is
-- initialized to TRUE for the test version and FALSE for the noise
-- version.  When Recursion is TRUE, it is assigned the value FALSE and
-- a recursive call is executed in the test version.  This permits the
-- test version to make a single recursive call and then return.  The
-- remaining text is not executed in the test version because it depends
-- upon the value of Test being FALSE.  The noise version text, which
-- is executed when Test is FALSE, assigns to Test the value FALSE and
-- returns since the remaining text can never be executed.  The presence
-- of this nonexecuted text ensures that when the recursive call is
-- removed from the noise version, the compiler must still assume the
-- potential for a recursive call and not perform any optimization that
-- would compromise the code efficiency metrics.  In addition, the
-- evaluation of the conditional ensures that the same number of
-- if statements are executed in both the test and noise version.

procedure Drpca1 is
    package B is new Procs (Boolean);
    use B;

    Ttrue : T := T (True);
    Tfalse : T := T (False);
    --  Test      : T := Ident(TTRUE);  -- included in test version
    Test : T := Ident (Tfalse); -- included in control version
    Recursion : T := Ident (Test);

    procedure Recursive_Procedure is
    begin

        if Boolean (Recursion) then
            Let (Recursion, Ident (Tfalse));
            --      Recursive_Procedure;               -- included in test version
        elsif not Boolean (Test) then
            Let (Test, Ident (Tfalse));
            if Test = Ttrue then
                -- Always FALSE
                Recursive_Procedure;
            end if;
        end if;

    end Recursive_Procedure;

begin
    Start ("DRPCA1", "Direct Recursive Procedure Call (Control)");
    for I in 1 .. 10000 loop

        Let (Recursion, Ident (Test));

        Recursive_Procedure;

    end loop;
    Stop;
end Drpca1;