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