Class 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
    • Constructor Detail

      • ByReferenceWrapperGenerator

        public ByReferenceWrapperGenerator()
    • Method Detail

      • getWrapperClass

        public static SootClass getWrapperClass​(Type t)
      • insertWrapperCall

        public static Value insertWrapperCall​(Body jb,
                                              SootClass wrapperClass,
                                              Value arg)
        Inserts calls to wrap objects
        Parameters:
        jb - the body to insert wrapper calls
        wrapperClass - the class to use for wrapping
        arg - 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 wrapping
        argToUnwrap - the argument to unwrap
        target - the target that should contain the target afterwards
        Returns:
        the unwrapper statement
      • getUpdateWrappedValueCall

        public static Unit getUpdateWrappedValueCall​(Local wrapped,
                                                     Local unwrapped)
        Returns a call to update a wrapped object
        Parameters:
        wrapped - the wrapped variable
        unwrapped - the unwrapped variable
        Returns:
        the call