Re: Need help with URR (Unused routines remover)

new topic     » goto parent     » topic index » view thread      » older message » newer message

----- Original Message -----
From: <pampeano at ROCKETMAIL.COM>
To: "EUforum" <EUforum at topica.com>
Subject: RE: Need help with URR (Unused routines remover)

> my program is intended to remove routines that aren't called at anytime
> in the program, routine_id call a routine, but sometimes the parameter
> passed to routine_id is a variable so I don't know which routine it is
> calling to not remove it.

The bad news is you can't know if it is safe to remove.

In general, if a program uses routine_id with a variable as a parameter,
then you cannot safely remove ANY routine in the program.

For example, if a program has the line ...

    xyzzy = routine_id(vRoutineName)

the only thing you can rely on is that, at run-time, the value in
'vRoutineName' probably won't refer to any routine the occurs physically
after this line.

Because the line is resolved at run-rime, you cannot use another program to
remove routines that occur before this line, because the variable
'vRoutineName' is going to be set to the name of one (or more) of the
routines above it - but you might not know which ones! For example, the name
might come from outside the program - a database field, or passed as a
parameter to a generic routine ( a lot of O-O implmentation uses this
mechanism).

The only safe way to do this is to run the program and monitor which
routines were not called and then remove them. But that would only apply to
a specific execution of the program and thus defeat the intention for a
general "fix up" of the code.

If however you could determine that the routine that contains the
troublesome routine_id() statement, is itself ever executed, you could
disregard it. Another possibility is in situations like this ...

    xyzzy = routine_id("XX_" & vRoutineName)

then clearly routines that do not start with "XX_" can be inspected for
candidate removal, but those that do start with "XX_" must all be retained,
just in case they are called at runtime.

Just to repeat, I believe that if a program contains usage of routine_id()
with a variable as a parameter, then it is not safe to remove ANY routines
that occur earlier than the last instance of this type of usage in a
program. There are a few exceptions but the complexity soon becomes enormous
to detect these exceptions.

By the way, this would mean that your URR program would not work very well
on Win32Lib.ew programs.

------
Derek Parnell
Melbourne, Australia
"To finish a job quickly, go slower."

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu