KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > bytecode > IfState


1 // Copyright (c) 1997 Per M.A. Bothner.
2
// This is free software; for terms and warranty disclaimer see ./COPYING.
3

4 package gnu.bytecode;
5
6 /** The state of a conditional expression or statement. */
7
8 public class IfState {
9
10   /** The surrounding IfState, if any. */
11   IfState previous;
12
13   /** True if we are curently in the else part of the conditional. */
14   boolean doing_else;
15
16   /** The (not-yet-defined) label at the end of the current sub-clause.
17    * If doing_else, this is the end of the entire conditional;
18    * otherwise, it is the end of the "then" clause. */

19   Label end_label;
20
21   /** The stack size before the "then" clause. */
22   int start_stack_size;
23
24   /** The change in the stack size caused by the then-clause.
25    * Same as then_stacked_types.length, if stack_growth >= 0. */

26   int stack_growth;
27
28   /** The types that were pushed by the then-clause. */
29   Type[] then_stacked_types;
30
31   public IfState (CodeAttr code)
32   {
33     this(code, new Label(code));
34   }
35
36   public IfState (CodeAttr code, Label endLabel)
37   {
38     previous = code.if_stack;
39     code.if_stack = this;
40     end_label = endLabel;
41     start_stack_size = code.SP;
42   }
43 }
44
45
Popular Tags