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: /** The state of a conditional expression or statement. */
07:
08: public class IfState {
09:
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: this (code, new Label(code));
33: }
34:
35: public IfState(CodeAttr code, Label endLabel) {
36: previous = code.if_stack;
37: code.if_stack = this;
38: end_label = endLabel;
39: start_stack_size = code.SP;
40: }
41: }
|