Class InstrumentationFactory


  • public class InstrumentationFactory
    extends Object
    Factory for creating instrumentation IR instructions.
    • Constructor Detail

      • InstrumentationFactory

        public InstrumentationFactory()
    • Method Detail

      • createMethodEntryHook

        public List<IRInstruction> createMethodEntryHook​(MethodEntryHook hook,
                                                         IRMethod irMethod,
                                                         MethodEntry sourceMethod,
                                                         String className)
        Creates instructions to invoke a method entry hook.
        Parameters:
        hook - the method entry hook configuration
        irMethod - the IR method being instrumented
        sourceMethod - the source method entry
        className - the class name (internal format)
        Returns:
        list of IR instructions to insert
      • createMethodExitHook

        public List<IRInstruction> createMethodExitHook​(MethodExitHook hook,
                                                        IRMethod irMethod,
                                                        ReturnInstruction returnInstr,
                                                        MethodEntry sourceMethod,
                                                        String className)
        Creates instructions to invoke a method exit hook.
        Parameters:
        hook - the method exit hook configuration
        irMethod - the IR method being instrumented
        returnInstr - the return instruction being hooked
        sourceMethod - the source method entry
        className - the class name (internal format)
        Returns:
        list of IR instructions to insert
      • createFieldWriteHook

        public List<IRInstruction> createFieldWriteHook​(FieldWriteHook hook,
                                                        FieldAccessInstruction fieldAccess)
        Creates instructions to invoke a field write hook.
        Parameters:
        hook - the field write hook configuration
        fieldAccess - the field store instruction being hooked
        Returns:
        list of IR instructions to insert
      • createArrayStoreHook

        public List<IRInstruction> createArrayStoreHook​(ArrayStoreHook hook,
                                                        ArrayAccessInstruction arrayAccess)
        Creates instructions to invoke an array store hook.
        Parameters:
        hook - the array store hook configuration
        arrayAccess - the array store instruction being hooked
        Returns:
        list of IR instructions to insert
      • createFieldReadHook

        public List<IRInstruction> createFieldReadHook​(FieldReadHook hook,
                                                       FieldAccessInstruction fieldAccess)
        Creates instructions to invoke a field read hook.
        Parameters:
        hook - the field read hook configuration
        fieldAccess - the field load instruction being hooked
        Returns:
        list of IR instructions to insert
      • createArrayLoadHook

        public List<IRInstruction> createArrayLoadHook​(ArrayLoadHook hook,
                                                       ArrayAccessInstruction arrayAccess)
        Creates instructions to invoke an array load hook.
        Parameters:
        hook - the array load hook configuration
        arrayAccess - the array load instruction being hooked
        Returns:
        list of IR instructions to insert
      • createMethodCallHook

        public List<IRInstruction> createMethodCallHook​(MethodCallHook hook,
                                                        InvokeInstruction invoke,
                                                        boolean isBefore)
        Creates instructions to invoke a method call hook.
        Parameters:
        hook - the method call hook configuration
        invoke - the invoke instruction being hooked
        isBefore - true if this is a before-call hook
        Returns:
        list of IR instructions to insert
      • createExceptionHook

        public List<IRInstruction> createExceptionHook​(ExceptionHook hook,
                                                       SSAValue exceptionValue,
                                                       String className,
                                                       String methodName)
        Creates instructions to invoke an exception hook.
        Parameters:
        hook - the exception hook configuration
        exceptionValue - the exception value
        className - the class name
        methodName - the method name
        Returns:
        list of IR instructions to insert