[Soot-list] Numberable

Ondrej Lhotak olhotak at uwaterloo.ca
Mon Oct 2 11:17:38 EDT 2006


On Mon, Oct 02, 2006 at 05:10:15PM +0200, Antonio Castaldo D'Ursi wrote:
> Hi,
> I was experimenting with the SootField getNumber() method.
> I thought distinct SootFields had different numbers, however I noticed
> that for many distinct static SootFields, getNumber() returns 0.
> 
> Is there a way to make Soot assign different numbers to different
> SootField? 
> Is it safe to use a SceneTrasformer to re-number all the SootFields?

The correct way to assign a number to a field is:

Scene.v().getFieldNumberer().add(field);

It is safe to do this with a field that already has a (non-zero) number
-- it will keep the same number.

The field numberer in the Scene maintains the mapping between fields
and their numbers and vice versa.

Normally, Soot only assigns numbers whose type is a reference or array
type (see the last line in the SootField constructor).

Assigning numbers to all fields (either by modifying the SootField
constructor, or using a SceneTransformer) should not break anything.
However, it may slightly reduce the efficiency of the points-to analyses
(Spark or Paddle), which use the numbers to identify the fields:
more numbers means more fields to worry about. If you are not using
Spark or Paddle, no problem. If you are using them, and you encounter
any problems, let me know.

> And what about AllocNode ? I'd like to use a Bitset to store AllocNodes
> and static SootFields modified by a method, is there a way to assign
> a unique number to each AllocNode and SootField? 

The AllocNode constructor should be assigning unique non-zero
numbers to each AllocNode.

The AllocNode numbers are not necessarily distinct from the SootField
numbers; the same number may be re-used for a SootField and an
AllocNode.

> Is it safe to change their numbers using setNumber() ?
> 
> Thank you,
> Antonio
> 
> -- 
> 
> Entia non sunt multiplicanda praeter necessitatem
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> 


More information about the Soot-list mailing list