1. package com.sun.org.apache.bcel.internal.verifier.structurals;
  2. /* ====================================================================
  3. * The Apache Software License, Version 1.1
  4. *
  5. * Copyright (c) 2001 The Apache Software Foundation. All rights
  6. * reserved.
  7. *
  8. * Redistribution and use in source and binary forms, with or without
  9. * modification, are permitted provided that the following conditions
  10. * are met:
  11. *
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. *
  20. * 3. The end-user documentation included with the redistribution,
  21. * if any, must include the following acknowledgment:
  22. * "This product includes software developed by the
  23. * Apache Software Foundation (http://www.apache.org/)."
  24. * Alternately, this acknowledgment may appear in the software itself,
  25. * if and wherever such third-party acknowledgments normally appear.
  26. *
  27. * 4. The names "Apache" and "Apache Software Foundation" and
  28. * "Apache BCEL" must not be used to endorse or promote products
  29. * derived from this software without prior written permission. For
  30. * written permission, please contact apache@apache.org.
  31. *
  32. * 5. Products derived from this software may not be called "Apache",
  33. * "Apache BCEL", nor may "Apache" appear in their name, without
  34. * prior written permission of the Apache Software Foundation.
  35. *
  36. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  37. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  38. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  39. * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  40. * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  42. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  43. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  44. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  45. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  46. * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  47. * SUCH DAMAGE.
  48. * ====================================================================
  49. *
  50. * This software consists of voluntary contributions made by many
  51. * individuals on behalf of the Apache Software Foundation. For more
  52. * information on the Apache Software Foundation, please see
  53. * <http://www.apache.org/>.
  54. */
  55. import com.sun.org.apache.bcel.internal.generic.*;
  56. /**
  57. * This interface defines properties of JVM bytecode subroutines.
  58. * Note that it is 'abused' to maintain the top-level code in a
  59. * consistent fashion, too.
  60. *
  61. * @version $Id: Subroutine.java,v 1.1.1.1 2001/10/29 20:00:42 jvanzyl Exp $
  62. * @author <A HREF="http://www.inf.fu-berlin.de/~ehaase"/>Enver Haase</A>
  63. */
  64. public interface Subroutine{
  65. /**
  66. * Returns all the JsrInstructions that have the
  67. * first instruction of this subroutine as their target.
  68. * <B>Must not be invoked on the 'top-level subroutine'.</B>
  69. */
  70. public InstructionHandle[] getEnteringJsrInstructions();
  71. /**
  72. * Returns the one and only RET that leaves the subroutine.
  73. * Note that JustIce has a pretty rigid notion of a subroutine.
  74. * <B>Must not be invoked on the 'top-level subroutine'.</B>
  75. *
  76. * @see com.sun.org.apache.bcel.internal.verifier.structurals.Subroutines
  77. */
  78. public InstructionHandle getLeavingRET();
  79. /**
  80. * Returns all instructions that together form this subroutine.
  81. * Note that an instruction is part of exactly one subroutine
  82. * (the top-level code is considered to be a special subroutine) -
  83. * else it is not reachable at all (dead code).
  84. */
  85. public InstructionHandle[] getInstructions();
  86. /**
  87. * Returns if the given InstructionHandle refers to an instruction
  88. * that is part of this subroutine. This is a convenience method
  89. * that saves iteration over the InstructionHandle objects returned
  90. * by getInstructions().
  91. *
  92. * @see #getInstructions()
  93. */
  94. public boolean contains(InstructionHandle inst);
  95. /**
  96. * Returns an int[] containing the indices of the local variable slots
  97. * accessed by this Subroutine (read-accessed, write-accessed or both);
  98. * local variables referenced by subroutines of this subroutine are
  99. * not included.
  100. *
  101. * @see #getRecursivelyAccessedLocalsIndices()
  102. */
  103. public int[] getAccessedLocalsIndices();
  104. /**
  105. * Returns an int[] containing the indices of the local variable slots
  106. * accessed by this Subroutine (read-accessed, write-accessed or both);
  107. * local variables referenced by subroutines of this subroutine are
  108. * included.
  109. *
  110. * @see #getAccessedLocalsIndices()
  111. */
  112. public int[] getRecursivelyAccessedLocalsIndices();
  113. /**
  114. * Returns the subroutines that are directly called from this subroutine.
  115. */
  116. public Subroutine[] subSubs();
  117. }