/** * Generates call for * {@link IHookDispatcher#dispatchOnThrowInBody(long, Object, Object[], Object)}. This method * expects exception object on stack that can be consumed. */ private void generateThrowInBodyCall() { // we can use same code for the after body call since method signature is same (without // exception) prepareAfterBodyCall(); // execute dispatchOnThrowInBody mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, IInstrumenterConstant.IHOOK_DISPATCHER_INTERNAL_NAME, "dispatchOnThrowInBody", IInstrumenterConstant.DISPATCH_ON_THROW_BODY_DESCRIPTOR, true); }
/** * Generates code for the after body call. This method expects the result of the method call on * the stack that can be consumed. * * @param method * method to be called can be only * {@link IHookDispatcher#dispatchFirstMethodAfterBody(long, Object, Object[], Object, boolean)} * or * {@link IHookDispatcher#dispatchSecondMethodAfterBody(long, Object, Object[], Object, boolean)} * @param exception * Value of the exception argument pass to the dispatcher. */ private void generateAfterBodyCall(String method, boolean exception) { // prepare first everything up to exception boolean prepareAfterBodyCall(); // then push on stack info about exception push(exception); // execute after body mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, IInstrumenterConstant.IHOOK_DISPATCHER_INTERNAL_NAME, method, IInstrumenterConstant.DISPATCH_METHOD_AFTER_BODY_DESCRIPTOR, true); }