Package soot.dotnet.members
Class ByReferenceWrapperGenerator
- java.lang.Object
-
- soot.dotnet.members.ByReferenceWrapperGenerator
-
public class ByReferenceWrapperGenerator extends Object
Parameters in .NET can be passed by reference. Since Jimple does not support this semantic, we generate Wrapper classes to pass instead. Note that .NET (as of right now, mid 2024) does not support co- or contravariants in parameters and return types. As such, overriding virtual methods does not pose a problem when we substitute parameters with reference wrappers.- Author:
- Marc Miltenberger
-
-
Field Summary
Fields Modifier and Type Field Description static StringWRAPPER_CLASS_NAMEstatic StringWRAPPER_FIELD_NAME
-
Constructor Summary
Constructors Constructor Description ByReferenceWrapperGenerator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static UnitgetUnwrapCall(SootClass wrapperClass, Value argToUnwrap, Value target)Returns a call to unwrap objectsstatic UnitgetUpdateWrappedValueCall(Local wrapped, Local unwrapped)Returns a call to update a wrapped objectstatic SootClassgetWrapperClass(Type t)static SootFieldgetWrapperField(SootClass wrapperClass)static ValueinsertWrapperCall(Body jb, SootClass wrapperClass, Value arg)Inserts calls to wrap objectsstatic booleanneedsWrapper(ProtoAssemblyAllTypes.ParameterDefinition parameter)
-
-
-
Field Detail
-
WRAPPER_FIELD_NAME
public static final String WRAPPER_FIELD_NAME
- See Also:
- Constant Field Values
-
WRAPPER_CLASS_NAME
public static final String WRAPPER_CLASS_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
needsWrapper
public static boolean needsWrapper(ProtoAssemblyAllTypes.ParameterDefinition parameter)
-
insertWrapperCall
public static Value insertWrapperCall(Body jb, SootClass wrapperClass, Value arg)
Inserts calls to wrap objects- Parameters:
jb- the body to insert wrapper callswrapperClass- the class to use for wrappingarg- the argument to wrap- Returns:
- the wrapped argument
-
getUnwrapCall
public static Unit getUnwrapCall(SootClass wrapperClass, Value argToUnwrap, Value target)
Returns a call to unwrap objects- Parameters:
wrapperClass- the class to use for wrappingargToUnwrap- the argument to unwraptarget- the target that should contain the target afterwards- Returns:
- the unwrapper statement
-
-