• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*******************************************************************************
2  * Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *    Marc R. Hoffmann - initial API and implementation
10  *
11  *******************************************************************************/
12 package org.jacoco.core.runtime;
13 
14 import org.objectweb.asm.MethodVisitor;
15 
16 /**
17  * The instrumented classes need a piece of code that obtains a
18  * <code>boolean[]</code> instance from the runtime. The mechanism is runtime
19  * specific and therefore abstracted by this interface. Implementations are
20  * provided by {@link IRuntime} implementations and are used by the
21  * instrumentation process.
22  */
23 public interface IExecutionDataAccessorGenerator {
24 
25 	/**
26 	 * This method generates the byte code required to obtain the coverage data
27 	 * structure for the class with the given id. Typically the instrumentation
28 	 * process will embed this code into a method that is called on class
29 	 * initialization. This method can be called at any time even outside the
30 	 * target VM.
31 	 *
32 	 * The generated code must push a <code>boolean[]</code> instance to the
33 	 * operand stack. Except this result object the generated code must not make
34 	 * any assumptions about the structure of the embedding method or class. The
35 	 * generated code must not use or allocate local variables.
36 	 *
37 	 * @param classid
38 	 *            identifier of the class
39 	 * @param classname
40 	 *            VM class name
41 	 * @param probecount
42 	 *            probe count for this class
43 	 * @param mv
44 	 *            code output
45 	 * @return additional stack size required by the implementation, including
46 	 *         the instance pushed to the stack
47 	 */
generateDataAccessor(final long classid, final String classname, final int probecount, MethodVisitor mv)48 	public int generateDataAccessor(final long classid, final String classname,
49 			final int probecount, MethodVisitor mv);
50 
51 }
52