KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > bcel > verifier > structurals > Subroutine


1 /*
2  * Copyright 2000-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17 package org.apache.bcel.verifier.structurals;
18
19
20 import org.apache.bcel.generic.InstructionHandle;
21
22 /**
23  * This interface defines properties of JVM bytecode subroutines.
24  * Note that it is 'abused' to maintain the top-level code in a
25  * consistent fashion, too.
26  *
27  * @version $Id: Subroutine.java 371539 2006-01-23 14:08:00Z tcurdt $
28  * @author Enver Haase
29  */

30 public interface Subroutine{
31     /**
32      * Returns all the JsrInstructions that have the
33      * first instruction of this subroutine as their target.
34      * <B>Must not be invoked on the 'top-level subroutine'.</B>
35      */

36     public InstructionHandle[] getEnteringJsrInstructions();
37     
38     /**
39      * Returns the one and only RET that leaves the subroutine.
40      * Note that JustIce has a pretty rigid notion of a subroutine.
41      * <B>Must not be invoked on the 'top-level subroutine'.</B>
42      *
43      * @see org.apache.bcel.verifier.structurals.Subroutines
44      */

45     public InstructionHandle getLeavingRET();
46
47     /**
48      * Returns all instructions that together form this subroutine.
49      * Note that an instruction is part of exactly one subroutine
50      * (the top-level code is considered to be a special subroutine) -
51      * else it is not reachable at all (dead code).
52      */

53     public InstructionHandle[] getInstructions();
54
55     /**
56      * Returns if the given InstructionHandle refers to an instruction
57      * that is part of this subroutine. This is a convenience method
58      * that saves iteration over the InstructionHandle objects returned
59      * by getInstructions().
60      *
61      * @see #getInstructions()
62      */

63     public boolean contains(InstructionHandle inst);
64
65     /**
66      * Returns an int[] containing the indices of the local variable slots
67      * accessed by this Subroutine (read-accessed, write-accessed or both);
68      * local variables referenced by subroutines of this subroutine are
69      * not included.
70      *
71      * @see #getRecursivelyAccessedLocalsIndices()
72      */

73     public int[] getAccessedLocalsIndices();
74
75     /**
76      * Returns an int[] containing the indices of the local variable slots
77      * accessed by this Subroutine (read-accessed, write-accessed or both);
78      * local variables referenced by subroutines of this subroutine are
79      * included.
80      *
81      * @see #getAccessedLocalsIndices()
82      */

83     public int[] getRecursivelyAccessedLocalsIndices();
84         
85     /**
86      * Returns the subroutines that are directly called from this subroutine.
87      */

88     public Subroutine[] subSubs();
89 }
90
Popular Tags