IExecutionDataAccessorGenerator.java revision f9843446d68ccdbab7fb4006b381b1f8abfbf091
1/*******************************************************************************
2 * Copyright (c) 2009, 2010 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 * $Id: $
12 *******************************************************************************/
13package org.jacoco.core.runtime;
14
15import 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 * therefore provided by {@link IRuntime} implementations and are used by the
22 * instrumentation process.
23 *
24 * @author Marc R. Hoffmann
25 * @version $Revision: $
26 */
27public interface IExecutionDataAccessorGenerator {
28
29	/**
30	 * This method generates the byte code required to obtain the coverage data
31	 * structure for the class with the given id. Typically the instrumentation
32	 * process will embed this code into a method that is called on class
33	 * initialization. This method can be called at any time even outside the
34	 * target VM.
35	 *
36	 * The generated code must push a <code>boolean[]</code> instance to the
37	 * operand stack. Except this result object the generated code must not make
38	 * any assumptions about the structure of the embedding method or class. The
39	 * generated code must not use or allocate local variables.
40	 *
41	 * @param classid
42	 *            identifier of the 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	 */
48	public int generateDataAccessor(long classid, MethodVisitor mv);
49
50}
51