Package daikon.dcomp

Class DCInstrument


  • public class DCInstrument
    extends InstructionListUtils
    Instruments a class file to perform Dynamic Comparability.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  DCInstrument.JUnitState
      Possible states of JUnit test discovery.
    • Constructor Summary

      Constructors 
      Constructor Description
      DCInstrument​(JavaClass orig_class, boolean in_jdk, @Nullable ClassLoader loader)
      Initialize with the original class and whether or not the class is part of the JDK.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add_create_tag_frame​(MethodGen mg)
      Adds the code to create the tag frame to the beginning of the method.
      void add_enter​(MethodGen mg, MethodInfo mi, int method_info_index)
      Adds the call to DCRuntime.enter to the beginning of the method.
      void add_exception_handler​(MethodGen mg, InstructionList catch_il)
      Adds a try/catch block around the entire method.
      void build_exception_handler​(MethodGen mg)
      Adds a try/catch block around the entire method.
      protected String full_name​(JavaClass jc, Field f)
      Return the fully qualified fieldname of the specified field.
      List<String> get_skipped_methods()
      Returns the list of uninstrumented methods.
      void install_exception_handler​(MethodGen mg)
      Adds a try/catch block around the entire method.
      JavaClass instrument()
      Instruments the original class to perform dynamic comparabilty and returns the new class definition.
      JavaClass instrument_jdk()
      Instruments a JDK class to perform dynamic comparability and returns the new class definition.
      void instrument_method​(MethodGen mg)
      Instrument the specified method for dynamic comparability.
      protected String simplify_method_name​(Method m)
      Return simplified name of a method.
      • Methods inherited from class InstructionListUtils

        append_inst, build_il, calculateLiveLocalTypes, calculateLiveStackTypes, delete_instructions, insertAtMethodStart, insertBeforeHandle, replaceInstructions
      • Methods inherited from class StackMapUtils

        addNewParameter, addString, adjust_code_for_locals_change, bcelCalcStackTypes, buildUninitializedNewMap, create_local_from_live_range, create_method_scope_local, createNewStackMapAttribute, findStackMapEqual, findStackMapIndexAfter, findStackMapIndexBefore, fixLocalVariableTable, gen_locals, gen_locals_from_byte_codes, gen_locals_from_byte_codes, generate_Type_from_StackMapType, generateStackMapTypeFromType, get_attribute_name, get_local_variable_type_table_attribute, getSize, getStackMapTable_attribute, is_local_variable_type_table, isStackMapTable, modifyStackMapsForSwitches, printStackMapTable, remove_local_variable_type_table, set_method_stackTypes, setCurrentStackMapTable, typeToClassGetName, update_full_frameStackMap_entries, updateStackMapOffset, updateUninitializedNewOffsets
    • Constructor Detail

      • DCInstrument

        public DCInstrument​(JavaClass orig_class,
                            boolean in_jdk,
                            @Nullable ClassLoader loader)
        Initialize with the original class and whether or not the class is part of the JDK.
    • Method Detail

      • instrument

        public JavaClass instrument()
        Instruments the original class to perform dynamic comparabilty and returns the new class definition.
        Returns:
        the modified JavaClass
      • instrument_jdk

        public JavaClass instrument_jdk()
        Instruments a JDK class to perform dynamic comparability and returns the new class definition. A second version of each method in the class is created which is instrumented for comparability.
        Returns:
        the modified JavaClass
      • instrument_method

        public void instrument_method​(MethodGen mg)
        Instrument the specified method for dynamic comparability.
        Parameters:
        mg - MethodGen for the method to be instrumented
      • get_skipped_methods

        public List<Stringget_skipped_methods()
        Returns the list of uninstrumented methods. (Note: instrument_jdk() needs to have been called first.)
      • build_exception_handler

        public void build_exception_handler​(MethodGen mg)
        Adds a try/catch block around the entire method. If an exception occurs, the tag stack is cleaned up and the exception is rethrown.
      • add_exception_handler

        public void add_exception_handler​(MethodGen mg,
                                          InstructionList catch_il)
        Adds a try/catch block around the entire method.
      • install_exception_handler

        public void install_exception_handler​(MethodGen mg)
        Adds a try/catch block around the entire method.
      • add_create_tag_frame

        public void add_create_tag_frame​(MethodGen mg)
        Adds the code to create the tag frame to the beginning of the method. This needs to be before the call to DCRuntime.enter (since it passed to that method).
      • add_enter

        public void add_enter​(MethodGen mg,
                              MethodInfo mi,
                              int method_info_index)
        Adds the call to DCRuntime.enter to the beginning of the method.
        Parameters:
        mg - method to modify
        mi - MethodInfo for method
        method_info_index - index for MethodInfo
      • full_name

        protected String full_name​(JavaClass jc,
                                   Field f)
        Return the fully qualified fieldname of the specified field.
        Parameters:
        jc - class containing the field
        f - the field
        Returns:
        string containing the fully qualified name
      • simplify_method_name

        protected String simplify_method_name​(Method m)
        Return simplified name of a method. Both exceptions and annotations are removed.
        Parameters:
        m - the method
        Returns:
        string containing the simplified method name