Super
Previous Next

Wasp strategy for big programs

Sometimes data-flow analysis performed by Wasp is very long and requires considerable amount of memory for some program. This depends mostly on internal program complexity than on program size. Such program is considered as big for Wasp.

There are two actions to improve the Wasp analysis for big programs:

  • cutting data flow analysis
  • saving analysis results for partially analysed program to file

If Wasp exhausted the memory resources, the Wasp analysis would be cut off. After cutoff, the Wasp analysis will be continued only for those program parts which have been already undergone the analysis; other program parts will be dropped in further analysis. The analysis cutoff is an effective technique for Wasp to produce the result message listing for some program parts in the case of resource lack.

Usually, more than one command line invocations of Wasp are needed to finish analysis for a big program. Each next Wasp invocation reads an irf-file, produced by the previous Wasp invocation. An irf-file is the file of the intermediate representation of partially analysed program saved to the directory which is the value of the -irfpath option (see section Options). The last Wasp invocation produces a message listing for the program part.

For correct cleanup after cutoff the finalization phases were introduced. So, full collection of the analysis phases is the following:

CI context-insensitive analysis
CIF CI finalization phase
CS context-sensitive analysis
CSF CS finalization phase
VC value calculation

If the analysis phase was not cut off, the respective finalization phase is not invoked. It is recommended not to cut off the finalization phases, especially the CI finalization phase.

The Wasp strategy for big programs is as follows. The context-insensitive analysis phase will be cut off if the memory required for the analysis exceeds the limit specified by the -cut_ci option. The analysed program will be saved to irf-file if the memory required for analysis exceeds the limit specified by the -save_mem option. The context-sensitive analysis phase will be cut off if, after reading previously saved program, the required memory exceeds the limit specified by the -cut_read option.

The default values of the options -cut_ci, -cut_read, and -save_mem depend on the size of the physical memory available in your computer. You may change some of them by the appropriate settings in the Wasp configuration file, wasp.cfg, or in the command line.

The default values of the options see in section osa:options:def.

The facilities described below will help you to improve the Wasp analysis for big programs.


Super
Previous Next

Saving partially analysed program to a file

A partially analysed program may be saved to an irf-file after any stage using the SAVE option. An irf-file is the file of the intermediate representation of partially analysed program (see section Options). To continue analysis, the READ option should be used when the analyser is invoked next time.

For example, the command line

      wasp  linnew.java -save=156

would save the analysed program to the file linnew_156.irf after completion of the analysis stage number 156. To continue analysis, type

      wasp -read=linnew_156.irf

To continue analysis for just saved program (for irf-file with the recent time), you also may type wasp -continue or simply wasp -c.

The amount of memory required to load a previously saved partially analysed program is typically much less than was allocated before it was saved. So this feature may be used to decrease Wasp memory requirements.

There are three special values of the SAVE option. Specifying -save=last causes the analysed program to be saved after completion of the data flow analysis. -save=first, causes it to be saved right before data flow analysis. -save=check, causes it to be saved after completion of the EU phase of the Error analysis (see section Analysis phases).

The option -save_mem=<amount of memory in megabytes> may be used to save a partially analysed program to file if the amount of allocated memory exceeds the given by the save_mem option after completion of current analysis stage.

The default value of the -save_mem option depends on the size of the physical memory available in your computer. See the table below.

64M 128 M 256M 512M 1024M 2048M
save_mem 170 290 585 970 1700 2800

To change the default setting, insert the appropriate option into the wasp.cfg file. For example,

     -save_mem = 500


Super
Previous Next

Cutting of program analysis

You may terminate the context-insensitive or context-sensitive phase of data flow analysis using the cutoff facilities described below. The remaining phases will work only on the program part that has been processed by the terminated phase.

Under the option -cut=<stage number> the analysis of current Wasp phase will be terminated after completion of the stage <stage number>. The part of the program that has not been processed during the current phase is cut off.

There is one special value of the CUT option. If you type

         wasp -read=<irf-file> -cut=now

then after reading the partially analysed program from <irf-file>, the current phase will be terminated.

In the context-insensitive phase, under the option -cut_ci=<amount of memory in megabytes>, the context-insensitive phase will be terminated after completion of the current stage, if the amount of memory required for analysed program exceeds the limit given in the -cut_ci option.

In the context-sensitive phase, under the option -cut_read=<amount of memory in megabytes>, the context-sensitive phase will be terminated, if the amount of memory for the partially analysed program, after reading from irf-file, exceeds the limit given in the -cut_read option.

The default values of the -cut_ci and -cut_read options depend on the size of the physical memory available in your computer. For the Lite version of Wasp, the default values of the options -cut_ci and -cut_read are those as if you computer had only 80M RAM. See the table below.

64M 128 M 256M 512M 1024M 2048M Lite
cut_ci 100 180 300 700 1200 2100 170
cut_read 140 240 455 900 1600 2500 220

To change the default settings, insert the appropriate options into the wasp.cfg file or in the command line.

The current analysis phase may be cut off interactively by pressing the Esc key and then the C key (see section Interactive facilities).

After terminated phase, the context-insensitive or context-sensitive finalization phase will be invoked for correct cleanup after cutoff. It is recommended not to cut off a finalization phase, especially the context-insensitive finalization phase. IF a finalization phase is very long and hard, the better way is to repeat the Wasp invocation for a program and cut off the Wasp analysis on the earlier stage than before.


Super
Previous Next

Interactive facilities

Features described above may be activated interactively by pressing the Esc key during Wasp execution when analysis phases are working. If you press Esc when data flow analysis is working, then after the end of the current analysis stage the following menu will be printed on the screen:

ANALYSIS INTERRUPTED!
(S) - save to intermediate file and terminate
(C) - cut off non-analysed part of the program and skip to the next phase
(G) - output method call graph to file
(H) - toggle showing names of analysed methods 
(N) - continue analysis
(F) - terminate immediately

If you press "g", Wasp outputs the current method call graph to a file (see Method call graph), and then redisplays the menu. You may now have a look at the call graph from another window and then make your choice.

If you press "h", Wasp reverses the value of the option SHOW, which is OFF by default, and then continues the analysis.

The SHOW option causes names of currently analysed methods to be displayed during further analysis. The name of a method is displayed with two attributes, like in the first section of the method call graph (see Method call graph). The token @ after the method name means that the analysis of the method will be resumed after finishing analysis of a called method in it's body.


Super
Previous Next

Simplified analysis of methods

It may happen that data flow analysis works for a very long time at some stage. A possible reason is the big number of the contexts for some (usually recursive) methods. This may be confirmed by studying the method call graph after the current analysis stage (see chapter Method call graph).

If the above appears to be the case, the option

       -one=<method list>

may be used in the next invocation of Wasp to specify the list of methods that have to be analysed context-insensitively. Analysis will be faster but rough for listed methods. The structure of a <method list> is described below.

<method list> ::= 
          <full name of method> |
          <method list>;<full name of method>
<full name of method> ::=
          <class name>.<method name>
<method name> ::=
          <Identifier>
<class name> ::=
          <Identifier> |
          <package name>.<class name>
<package name> ::=
          <Identifier> |
          <package name>.<Identifier>

To have the names of the methods processed in data flow analysis displayed on the screen, use the option SHOW (see section Interactive facilities).


Copyright 2000, 2001, 2002, 2003 AcademSoft. All rights reserved.