1/* Definitions for exception handling for use by the GNU compiler
2   for the Java(TM) language compiler.
3   Copyright (C) 1997-2015 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3.  If not see
19<http://www.gnu.org/licenses/>.
20
21Java and all Java-based marks are trademarks or registered trademarks
22of Sun Microsystems, Inc. in the United States and other countries.
23The Free Software Foundation is independent of Sun Microsystems, Inc.  */
24
25struct eh_range
26  {
27    /* The (byte-code PC) range of the handled block. */
28    int start_pc;
29    int end_pc;
30
31    /* A list of handlers.  For each element in the list,
32       the TREE_PURPOSE is the handled class (NULL_EXPR for a finally block),
33       and the TREE_VALUE is the LABEL_DECL of the handler. */
34    tree handlers;
35
36    /* Surrounding handler, if any. */
37    struct eh_range *outer;
38
39    /* The first child range.  It is is nested inside this range
40       (i.e. this.start_pc <= first_child.end_pc
41       && this.end_pc >= first_child.end_pc).
42       The children are linked together using next_sibling, and are sorted
43       by increasing start_pc and end_pc (we do not support non-nested
44       overlapping ranges). */
45    struct eh_range *first_child;
46
47    /* The next child of outer, in address order. */
48    struct eh_range *next_sibling;
49
50    /* True if this range has already been expanded. */
51    int expanded;
52
53    /* The TRY_CATCH_EXPR for this EH range.  */
54    tree stmt;
55  };
56
57/* A dummy range that represents the entire method. */
58extern struct eh_range whole_range;
59
60#define NULL_EH_RANGE (&whole_range)
61
62extern struct eh_range * find_handler (int);
63extern void method_init_exceptions (void);
64extern void maybe_start_try (int, int);
65extern void add_handler (int, int, tree, tree);
66extern void expand_end_java_handler (struct eh_range *);
67extern bool sanity_check_exception_range (struct eh_range *);
68