• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*******************************************************************************
2  * Copyright (c) 2009, 2021 Mountainminds GmbH & Co. KG and Contributors
3  * This program and the accompanying materials are made available under
4  * the terms of the Eclipse Public License 2.0 which is available at
5  * http://www.eclipse.org/legal/epl-2.0
6  *
7  * SPDX-License-Identifier: EPL-2.0
8  *
9  * Contributors:
10  *    Marc R. Hoffmann - initial API and implementation
11  *
12  *******************************************************************************/
13 package org.jacoco.core.internal.instr;
14 
15 import org.objectweb.asm.ClassVisitor;
16 import org.objectweb.asm.MethodVisitor;
17 
18 /**
19  * Strategies to retrieve the probe array instance for each method within a
20  * type. This abstraction is required as we need to follow a different strategy
21  * depending on whether the instrumented type is a class or interface.
22  */
23 public interface IProbeArrayStrategy {
24 
25 	/**
26 	 * Creates code that stores the probe array instance in the given variable.
27 	 *
28 	 * @param mv
29 	 *            visitor to create code
30 	 * @param clinit
31 	 *            true in case of {@code <clinit>} method
32 	 * @param variable
33 	 *            variable index to store probe array to
34 	 * @return maximum stack size required by the generated code
35 	 */
storeInstance(MethodVisitor mv, boolean clinit, int variable)36 	int storeInstance(MethodVisitor mv, boolean clinit, int variable);
37 
38 	/**
39 	 * Adds additional class members required by this strategy. This method is
40 	 * called after all original members of the class has been processed.
41 	 *
42 	 * @param cv
43 	 *            visitor to create fields and methods
44 	 * @param probeCount
45 	 *            total number of probes required for this class
46 	 */
addMembers(ClassVisitor cv, int probeCount)47 	void addMembers(ClassVisitor cv, int probeCount);
48 
49 }
50