01: // Copyright (c) 1997 Per M.A. Bothner.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.bytecode;
05:
06: import java.io.*;
07:
08: /** The state of a conditional expression or statement. */
09:
10: public class IfState {
11:
12: /** The surrounding IfState, if any. */
13: IfState previous;
14:
15: /** True if we are curently in the else part of the conditional. */
16: boolean doing_else;
17:
18: /** The (not-yet-defined) label at the end of the current sub-clause.
19: * If doing_else, this is the end of the entire conditional;
20: * otherwise, it is the end of the "then" clause. */
21: Label end_label;
22:
23: /** The stack size before the "then" clause. */
24: int start_stack_size;
25:
26: /** The change in the stack size caused by the then-clause.
27: * Same as then_stacked_types.length, if stack_growth >= 0. */
28: int stack_growth;
29:
30: /** The types that were pushed by the then-clause. */
31: Type[] then_stacked_types;
32:
33: public IfState(CodeAttr code) {
34: this (code, new Label(code));
35: }
36:
37: public IfState(CodeAttr code, Label endLabel) {
38: previous = code.if_stack;
39: code.if_stack = this;
40: end_label = endLabel;
41: start_stack_size = code.SP;
42: }
43: }
|