• 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.runtime;
14 
15 import org.objectweb.asm.MethodVisitor;
16 
17 /**
18  * The instrumented classes need a piece of code that obtains a
19  * <code>boolean[]</code> instance from the runtime. The mechanism is runtime
20  * specific and therefore abstracted by this interface. Implementations are
21  * provided by {@link IRuntime} implementations and are used by the
22  * instrumentation process.
23  */
24 public interface IExecutionDataAccessorGenerator {
25 
26 	/**
27 	 * This method generates the byte code required to obtain the coverage data
28 	 * structure for the class with the given id. Typically the instrumentation
29 	 * process will embed this code into a method that is called on class
30 	 * initialization. This method can be called at any time even outside the
31 	 * target VM.
32 	 *
33 	 * The generated code must push a <code>boolean[]</code> instance to the
34 	 * operand stack. Except this result object the generated code must not make
35 	 * any assumptions about the structure of the embedding method or class. The
36 	 * generated code must not use or allocate local variables.
37 	 *
38 	 * @param classid
39 	 *            identifier of the class
40 	 * @param classname
41 	 *            VM class name
42 	 * @param probecount
43 	 *            probe count for this class
44 	 * @param mv
45 	 *            code output
46 	 * @return additional stack size required by the implementation, including
47 	 *         the instance pushed to the stack
48 	 */
generateDataAccessor(long classid, String classname, int probecount, MethodVisitor mv)49 	int generateDataAccessor(long classid, String classname, int probecount,
50 			MethodVisitor mv);
51 
52 }
53