Class DexSharedConstantSplitter

java.lang.Object
sootup.apk.frontend.interceptors.DexSharedConstantSplitter
All Implemented Interfaces:
BodyInterceptor

public class DexSharedConstantSplitter extends Object implements BodyInterceptor
Gives each statement that uses a shared constant its own copy of the constant, like Soot's dexpler does with its SharedInitializationLocalSplitter.

Dex constants have no type: const/4 v0, 0 can be the int 0, false, the float 0.0 or null, and the verifier checks each use on its own, so one register can feed uses of different types:

 l = 0;
 useInt(l);
 useObject(l);
 
The number and null transformers decide per local, so one of the uses would get a constant of the wrong type. After this interceptor, each using statement has its own local:
 l = 0;
 useInt(l);
 l#c1 = 0;
 useObject(l#c1);
 

It handles locals with a single definition that assigns an int or long constant, so it runs after a LocalSplitter and before the dex transformers. The copy is assigned right before the statement that uses it.

  • Constructor Details

    • DexSharedConstantSplitter

      public DexSharedConstantSplitter()
  • Method Details