Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Subroutine |
|
| 1.0;1 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one or more | |
3 | * contributor license agreements. See the NOTICE file distributed with | |
4 | * this work for additional information regarding copyright ownership. | |
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 | |
6 | * (the "License"); you may not use this file except in compliance with | |
7 | * the License. You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | */ | |
17 | package org.apache.commons.javaflow.bytecode.transformation.bcel.analyser; | |
18 | ||
19 | import org.apache.bcel.generic.*; | |
20 | ||
21 | /** | |
22 | * This interface defines properties of JVM bytecode subroutines. | |
23 | * Note that it is 'abused' to maintain the top-level code in a | |
24 | * consistent fashion, too. | |
25 | * | |
26 | * WARNING! These classes are a fork of the bcel verifier. | |
27 | * | |
28 | * @version $Id: Subroutine.java 480487 2006-11-29 08:54:42Z bayard $ | |
29 | * @author <A HREF="http://www.inf.fu-berlin.de/~ehaase"/>Enver Haase</A> | |
30 | */ | |
31 | public interface Subroutine{ | |
32 | /** | |
33 | * Returns all the JsrInstructions that have the | |
34 | * first instruction of this subroutine as their target. | |
35 | * <B>Must not be invoked on the 'top-level subroutine'.</B> | |
36 | */ | |
37 | public InstructionHandle[] getEnteringJsrInstructions(); | |
38 | ||
39 | /** | |
40 | * Returns the one and only RET that leaves the subroutine. | |
41 | * Note that JustIce has a pretty rigid notion of a subroutine. | |
42 | * <B>Must not be invoked on the 'top-level subroutine'.</B> | |
43 | * | |
44 | * @see org.apache.bcel.verifier.structurals.Subroutines | |
45 | */ | |
46 | public InstructionHandle getLeavingRET(); | |
47 | ||
48 | /** | |
49 | * Returns all instructions that together form this subroutine. | |
50 | * Note that an instruction is part of exactly one subroutine | |
51 | * (the top-level code is considered to be a special subroutine) - | |
52 | * else it is not reachable at all (dead code). | |
53 | */ | |
54 | public InstructionHandle[] getInstructions(); | |
55 | ||
56 | /** | |
57 | * Returns if the given InstructionHandle refers to an instruction | |
58 | * that is part of this subroutine. This is a convenience method | |
59 | * that saves iteration over the InstructionHandle objects returned | |
60 | * by getInstructions(). | |
61 | * | |
62 | * @see #getInstructions() | |
63 | */ | |
64 | public boolean contains(InstructionHandle inst); | |
65 | ||
66 | /** | |
67 | * Returns an int[] containing the indices of the local variable slots | |
68 | * accessed by this Subroutine (read-accessed, write-accessed or both); | |
69 | * local variables referenced by subroutines of this subroutine are | |
70 | * not included. | |
71 | * | |
72 | * @see #getRecursivelyAccessedLocalsIndices() | |
73 | */ | |
74 | public int[] getAccessedLocalsIndices(); | |
75 | ||
76 | /** | |
77 | * Returns an int[] containing the indices of the local variable slots | |
78 | * accessed by this Subroutine (read-accessed, write-accessed or both); | |
79 | * local variables referenced by subroutines of this subroutine are | |
80 | * included. | |
81 | * | |
82 | * @see #getAccessedLocalsIndices() | |
83 | */ | |
84 | public int[] getRecursivelyAccessedLocalsIndices(); | |
85 | ||
86 | /** | |
87 | * Returns the subroutines that are directly called from this subroutine. | |
88 | */ | |
89 | public Subroutine[] subSubs(); | |
90 | } |