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