Class ASMBackendUtils


  • public class ASMBackendUtils
    extends Object
    Utility class for ASM-based back-ends.
    Author:
    Tobias Hamann, Florian Kuebler, Dominik Helm, Lukas Sommer
    • Constructor Detail

      • ASMBackendUtils

        public ASMBackendUtils()
    • Method Detail

      • slashify

        public static String slashify​(String s)
        Convert class identifiers and signatures by replacing dots by slashes.
        Parameters:
        s - String to convert
        Returns:
        Converted identifier
      • toTypeDesc

        public static String toTypeDesc​(SootMethodRef m)
        Compute type description for methods, comprising parameter types and return type.
        Parameters:
        m - Method to determine type description
        Returns:
        Method type description
      • toTypeDesc

        public static String toTypeDesc​(List<Type> parameterTypes,
                                        Type returnType)
        Compute type description for methods, comprising parameter types and return type.
        Parameters:
        parameterTypes - The parameters for some method
        returnType - The return type for some method
        Returns:
        Method type description
      • toTypeDesc

        public static String toTypeDesc​(Type type)
        Convert type to JVM style type description
        Parameters:
        type - Type to convert
        Returns:
        JVM style type description
      • getDefaultValue

        public static Object getDefaultValue​(SootField field)
        Get default value of a field for constant pool
        Parameters:
        field - Field to get default value for
        Returns:
        Default value or null if there is no default value.
      • acceptsStringInitialValue

        public static boolean acceptsStringInitialValue​(SootField field)
        Determine if the field accepts a string default value, this is only true for fields of type String or a sub-type of String
        Parameters:
        field - Field
        Returns:
        true if the field is of type String or sub-type, false otherwise.
      • sizeOfType

        public static int sizeOfType​(Type t)
        Get the size in words for a type.
        Parameters:
        t - Type
        Returns:
        Size in words
      • createASMAttribute

        public static org.objectweb.asm.Attribute createASMAttribute​(Attribute attr)
        Create an ASM attribute from an Soot attribute
        Parameters:
        attr - Soot attribute
        Returns:
        ASM attribute
      • translateJavaVersion

        public static String translateJavaVersion​(int javaVersion)
        Translate internal numbering of java versions to real version for debug messages.
        Parameters:
        javaVersion - Internal java version number
        Returns:
        Java version in the format "1.7"