OSDN Git Service

1999-11-17 Andrew Haley <aph@cygnus.com>
[pf3gnuchains/gcc-fork.git] / gcc / java / java-tree.h
1 /* Definitions for parsing and type checking for the GNU compiler for
2    the Java(TM) language.
3    Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
4
5 This file is part of GNU CC.
6
7 GNU CC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GNU CC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GNU CC; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.  
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 /* Hacked by Per Bothner <bothner@cygnus.com> February 1996. */
27
28 /* Java language-specific tree codes.  */
29 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
30 enum java_tree_code {
31   __DUMMY = LAST_AND_UNUSED_TREE_CODE,
32 #include "java-tree.def"
33   LAST_JAVA_TREE_CODE
34 };
35 #undef DEFTREECODE
36
37 struct JCF;
38
39 /* Usage of TREE_LANG_FLAG_?:
40    0: IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (in IDENTIFIER_NODE)
41       RESOLVE_EXPRESSION_NAME_P (in EXPR_WITH_FILE_LOCATION)
42       IS_FOR_LOOP_P (in LOOP_EXPR)
43    1: CLASS_HAS_SUPER_FLAG (in TREE_VEC).
44       IS_A_CLASSFILE_NAME (in IDENTIFIER_NODE)
45       COMPOUND_ASSIGN_P (in EXPR (binop_*))
46    2: RETURN_MAP_ADJUSTED (in TREE_VEC).
47       QUALIFIED_P (in IDENTIFIER_NODE)
48       PRIMARY_P (in EXPR_WITH_FILE_LOCATION)
49       MODIFY_EXPR_FROM_INITIALIZATION_P (in MODIFY_EXPR)
50    3: IS_AN_IMPORT_ON_DEMAND_P (in IDENTIFIER_NODE)
51       RESOLVE_PACKAGE_NAME_P (in EXPR_WITH_FILE_LOCATION)
52       SWITCH_HAS_DEFAULT (in SWITCH_EXPR)
53    4: IS_A_COMMAND_LINE_FILENAME_P (in IDENTIFIER_NODE)
54       RESOLVE_TYPE_NAME_P (in EXPR_WITH_FILE_LOCATION)
55       CALL_USING_SUPER (in CALL_EXPR)
56    5: HAS_BEEN_ALREADY_PARSED_P (in IDENTIFIER_NODE)
57       IS_BREAK_STMT_P (in EXPR_WITH_FILE_LOCATION)
58       IS_CRAFTED_STRING_BUFFER_P (in CALL_EXPR)
59    6: CAN_COMPLETE_NORMALLY (in statement nodes).
60
61    Usage of TYPE_LANG_FLAG_?:
62    1: TYPE_ARRAY_P (in RECORD_TYPE).
63    2: CLASS_LOADED_P (in RECORD_TYPE).
64    3: CLASS_FROM_SOURCE_P (in RECORD_TYPE).
65    4: CLASS_P (in RECORD_TYPE).
66    5: CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (in RECORD_TYPE)
67    6: CLASS_HAS_FINIT_P (in RECORD_TYPE)
68
69    Usage of DECL_LANG_FLAG_?:
70    0: METHOD_DEPRECATED (in FUNCTION_DECL).
71       FIELD_DEPRECATED (in FIELD_DECL).
72       CLASS_DEPRECATED (in TYPE_DECL).
73    1: METHOD_PUBLIC (in FUNCTION_DECL).
74       FIELD_PUBLIC (in FIELD_DECL).
75       CLASS_PUBLIC (in TYPE_DECL).
76    2: METHOD_STATIC (in FUNCTION_DECL).
77       (But note that FIELD_STATIC uses TREE_STATIC!)
78       CLASS_COMPLETE_P (in TYPE_DECL)
79    3: METHOD_FINAL (in FUNCTION_DECL)
80       FIELD_FINAL (in FIELD_DECL)
81       CLASS_FINAL (in TYPE_DECL)
82    4: METHOD_SYNCHRONIZED (in FUNCTION_DECL).
83       LABEL_IN_SUBR (in LABEL_DECL)
84       CLASS_INTERFACE (in TYPE_DECL)
85       FIELD_VOLATILE (int FIELD_DECL)
86    5: METHOD_ABSTRACT (in FUNCTION_DECL).
87       LABEL_IS_SUBR_START (in LABEL_DECL)
88       CLASS_ABSTRACT (in TYPE_DECL)
89       FIELD_TRANSIENT (in FIELD_DECL)
90    6: METHOD_TRANSIENT (in FUNCTION_DECL)
91       LABEL_CHANGED (in LABEL_DECL)
92       CLASS_SUPER (in TYPE_DECL, ACC_SUPER flag)
93    7: DECL_CONSTRUCTOR_P (in FUNCTION_DECL).
94 */
95
96 /* True if the class whose TYPE_BINFO this is has a superclass.
97    (True of all classes except Object.) */
98 #define CLASS_HAS_SUPER_FLAG(BINFO) TREE_LANG_FLAG_1(BINFO)
99 #define CLASS_HAS_SUPER(TYPE) CLASS_HAS_SUPER_FLAG (TYPE_BINFO (TYPE))
100
101 /* Return the supertype of class TYPE, or NULL_TREE is it has none. */
102 #define CLASSTYPE_SUPER(TYPE) (CLASS_HAS_SUPER (TYPE) ? \
103   BINFO_TYPE (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (TYPE), 0)) : NULL_TREE)
104
105 /* True if the class we are compiling is a .java source file;
106    false if it is a .class bytecode file. */
107 extern int compiling_from_source;
108
109 /* The class defined by the actual (main) file we are compiling. */
110 extern tree main_class;
111
112 /* The class we are currently processing. */
113 extern tree current_class;
114
115 /* List of all class DECLs seen so far.  */
116 extern tree all_class_list;
117
118 /* Nonzero if we should make is_compiled_class always return 1 for
119    appropriate classes that we're referencing.  */
120
121 extern int flag_assume_compiled;
122
123 extern int flag_emit_class_files;
124
125 /* When non zero, we emit xref strings. Values of the flag for xref
126    backends are defined in xref.h.  */
127
128 extern int flag_emit_xref;
129
130 /* When doing xrefs, tell when not to fold.   */
131 extern int do_not_fold;
132
133 /* Turned to 1 if -Wall was encountered. See lang.c for their meanings.  */
134 extern int flag_wall;
135 extern int flag_redundant;
136 extern int flag_not_overriding;
137 extern int flag_static_local_jdk1_1;
138
139 /* When non zero, call a library routine to do integer divisions. */
140 extern int flag_use_divide_subroutine;
141
142 /* The Java .class file that provides main_class;  the main input file. */
143 extern struct JCF *current_jcf;
144
145 typedef struct CPool constant_pool;
146
147 #define CONSTANT_ResolvedFlag 16
148
149 /* The cpool->data[i] for a ResolvedString points to a STRING_CST. */
150 #define CONSTANT_ResolvedString    (CONSTANT_String+CONSTANT_ResolvedFlag)
151
152 /* The cpool->data[i] for a ResolvedClass points to a RECORD_TYPE. */
153 #define CONSTANT_ResolvedClass     (CONSTANT_Class+CONSTANT_ResolvedFlag)
154
155 #define CPOOL_UTF(CPOOL, INDEX) ((tree) (CPOOL)->data[INDEX])
156
157 /* A NameAndType constant is represented as a TREE_LIST.
158    The type is the signature string (as an IDENTIFIER_NODE).  */
159
160 #define NAME_AND_TYPE_NAME(CPOOL, IDX) \
161   CPOOL_UTF(CPOOL, CPOOL_USHORT1(CPOOL, IDX))
162 #define NAME_AND_TYPE_SIGNATURE(CPOOL, IDX) \
163   CPOOL_UTF(CPOOL, CPOOL_USHORT2(CPOOL, IDX))
164
165 /* A FieldRef, MethodRef or InterfaceMethodRef constant
166    is represented as a TREE_LIST. */
167
168 #define COMPONENT_REF_CLASS_INDEX(CPOOL, IDX) CPOOL_USHORT1(CPOOL, IDX)
169 #define COMPONENT_REF_NAME_AND_TYPE(CPOOL, IDX) CPOOL_USHORT2(CPOOL, IDX)
170 #define COMPONENT_REF_NAME(CPOOL, IDX) \
171   NAME_AND_TYPE_NAME (CPOOL, COMPONENT_REF_NAME_AND_TYPE(CPOOL, IDX))
172 #define COMPONENT_REF_SIGNATURE(CPOOL, IDX) \
173   NAME_AND_TYPE_SIGNATURE (CPOOL, COMPONENT_REF_NAME_AND_TYPE(CPOOL, IDX))
174
175 /* "Promoted types" that are used for primitive types smaller
176    than int.  We could use int_type_node, but then we would lose
177    type information (such as needed for debugging). */
178 extern tree promoted_byte_type_node;
179 extern tree promoted_short_type_node;
180 extern tree promoted_char_type_node;
181 extern tree promoted_boolean_type_node;
182
183 extern tree byte_type_node;
184 extern tree short_type_node;
185 extern tree int_type_node;
186 extern tree long_type_node;
187
188 extern tree unsigned_byte_type_node;
189 extern tree unsigned_short_type_node;
190 extern tree unsigned_int_type_node;
191 extern tree unsigned_long_type_node;
192
193 extern tree boolean_type_node;
194
195 extern tree object_type_node;
196 extern tree unqualified_object_id_node;
197 extern tree object_ptr_type_node;
198 extern tree string_type_node;
199 extern tree string_ptr_type_node;
200 extern tree throwable_type_node;
201 extern tree runtime_exception_type_node;
202 extern tree error_exception_type_node;
203
204 extern tree *predef_filenames;
205 extern int predef_filenames_size;
206
207 extern tree byte_array_type_node;
208 extern tree short_array_type_node;
209 extern tree int_array_type_node;
210 extern tree long_array_type_node;
211 extern tree boolean_array_type_node;
212 extern tree char_array_type_node;
213 extern tree double_array_type_node;
214 extern tree float_array_type_node;
215 extern tree array_array_type_node;
216 extern tree object_array_type_node;
217 extern tree string_array_type_node;
218 extern tree TYPE_identifier_node;      /* "TYPE" */
219 extern tree init_identifier_node;      /* "<init>" */
220 extern tree clinit_identifier_node;      /* "<clinit>" */
221 extern tree finit_identifier_node;      /* "$finit$" */
222 extern tree void_signature_node;       /* "()V" */
223 extern tree length_identifier_node;  /* "length" */
224 extern tree this_identifier_node;  /* "this" */
225 extern tree super_identifier_node;  /* "super" */
226 extern tree continue_identifier_node;  /* "continue" */
227 extern tree one_elt_array_domain_type;
228 /* The type of the return address of a subroutine. */
229 extern tree return_address_type_node;
230
231 /* Nodes for boolean constants TRUE and FALSE. */
232 extern tree boolean_true_node, boolean_false_node;
233
234 /* Integer constants not declared in tree.h. */
235 extern tree long_zero_node;
236 extern tree float_zero_node;
237 extern tree double_zero_node;
238 extern tree integer_negative_one_node;
239 extern tree integer_two_node;
240 extern tree integer_four_node;
241 extern tree empty_stmt_node;
242
243 /* The type for struct methodtable. */
244 extern tree methodtable_type;
245 extern tree methodtable_ptr_type;
246
247 extern tree utf8const_type;
248 extern tree utf8const_ptr_type;
249
250 extern tree class_type_node;
251 extern tree class_ptr_type;
252 extern tree field_type_node;
253 extern tree constants_type_node;
254 extern tree dtable_type, dtable_ptr_type;
255 extern tree field_ptr_type_node;
256 extern tree field_info_union_node;
257 extern tree method_type_node;
258 extern tree method_ptr_type_node;
259 #define nativecode_ptr_type_node ptr_type_node
260
261 extern tree end_params_node;
262
263 /* References to internal libjava functions we use. */
264 extern tree alloc_object_node;
265 extern tree soft_instanceof_node;
266 extern tree soft_checkcast_node;
267 extern tree soft_initclass_node;
268 extern tree soft_newarray_node;
269 extern tree soft_anewarray_node;
270 extern tree soft_multianewarray_node;
271 extern tree soft_badarrayindex_node;
272 extern tree throw_node[];
273 extern tree soft_checkarraystore_node;
274 extern tree soft_monitorenter_node;
275 extern tree soft_monitorexit_node;
276 extern tree soft_lookupinterfacemethod_node;
277 extern tree soft_fmod_node;
278 extern tree soft_exceptioninfo_call_node;
279 extern tree soft_idiv_node;
280 extern tree soft_irem_node;
281 extern tree soft_ldiv_node;
282 extern tree soft_lrem_node;
283
284 extern tree access_flags_type_node;
285
286 extern tree class_dtable_decl;
287
288 /* They need to be reset before processing each class */
289 extern struct CPool *outgoing_cpool; 
290 extern tree current_constant_pool_data_ref;
291
292 extern tree wfl_operator;
293
294 struct lang_identifier
295 {
296   struct tree_identifier ignore;
297   tree global_value, local_value;
298
299   /* If non-NULL:  An ADDR_REF to a VAR_DECL that contains
300    * the Utf8Const representation of the identifier.  */
301   tree utf8_ref;
302 };
303
304 /* Macros for access to language-specific slots in an identifier.  */
305 /* UNless specifide, each of these slots contains a DECL node or null.  */
306
307 /* This represents the value which the identifier has in the
308    file-scope namespace.  */
309 #define IDENTIFIER_GLOBAL_VALUE(NODE)   \
310   (((struct lang_identifier *)(NODE))->global_value)
311 /* This represents the value which the identifier has in the current
312    scope.  */
313 #define IDENTIFIER_LOCAL_VALUE(NODE)    \
314   (((struct lang_identifier *)(NODE))->local_value)
315
316 /* Given an identifier NODE, get the corresponding (non-handle) class.
317    For get_identifier ("java.lang.Number"), the result is
318    the struct whose DECL_ASSEMBLER_NAME is "Classjava_lang_Number". */
319 #define IDENTIFIER_CLASS_VALUE(NODE) IDENTIFIER_GLOBAL_VALUE(NODE)
320
321 /* Given an identifier NODE, get the corresponding handle class.
322    For get_identifier ("java.lang.Number"), the result is
323    the struct whose DECL_ASSEMBLER_NAME is "Hjava_lang_Number". */
324 #define IDENTIFIER_HANDLECLASS_VALUE(NODE) ???
325
326 /* Given a signature of a reference (or array) type, or a method, return the
327    corresponding type (if one has been allocated).
328    Do not use for primitive types, since they may be ambiguous.
329    (E.g. is "I" a signature or a class name?) */
330 #define IDENTIFIER_SIGNATURE_TYPE(NODE) IDENTIFIER_GLOBAL_VALUE(NODE)
331
332 /* If non-NULL:  An ADDR_REF to a VAR_DECL that contains
333    the Utf8Const representation of the identifier.  */
334 #define IDENTIFIER_UTF8_REF(NODE) \
335   (((struct lang_identifier *)(NODE))->utf8_ref)
336
337 #define IDENTIFIER_UTF8_DECL(NODE) \
338   TREE_OPERAND((((struct lang_identifier *)(NODE))->utf8_ref), 0)
339
340 /* For a FUNCTION_DECL, if we are compiling a .class file, then this is
341    the position in the .class file of the method code.
342    Specifically, this is the code itself, not the code attribute. */
343 #define DECL_CODE_OFFSET(DECL) (DECL_LANG_SPECIFIC(DECL)->code_offset)
344 /* Similarly, the length of the bytecode. */
345 #define DECL_CODE_LENGTH(DECL) (DECL_LANG_SPECIFIC(DECL)->code_length)
346 /* Similarly, the position of the LineNumberTable attribute. */
347 #define DECL_LINENUMBERS_OFFSET(DECL) \
348   (DECL_LANG_SPECIFIC(DECL)->linenumbers_offset)
349 /* Similarly, the position of the LocalVariableTable attribute
350    (following the standard attribute header). */
351 #define DECL_LOCALVARIABLES_OFFSET(DECL) \
352   (DECL_LANG_SPECIFIC(DECL)->localvariables_offset)
353
354 #define DECL_MAX_LOCALS(DECL) (DECL_LANG_SPECIFIC(DECL)->max_locals)
355 #define DECL_MAX_STACK(DECL) (DECL_LANG_SPECIFIC(DECL)->max_stack)
356 /* Number of local variable slots needed for the arguments of this function. */
357 #define DECL_ARG_SLOT_COUNT(DECL) (DECL_LANG_SPECIFIC(DECL)->arg_slot_count)
358 /* List of checked thrown exceptions, as specified with the `throws'
359    keyword */
360 #define DECL_FUNCTION_THROWS(DECL) (DECL_LANG_SPECIFIC(DECL)->throws_list)
361 /* List of other constructors of the same class that this constructor
362    calls */
363 #define DECL_CONSTRUCTOR_CALLS(DECL) \
364   (DECL_LANG_SPECIFIC(DECL)->called_constructor)
365 /* Pointer to the function's current's COMPOUND_EXPR tree (while
366    completing its body) or the function's block */
367 #define DECL_FUNCTION_BODY(DECL) (DECL_LANG_SPECIFIC(DECL)->function_decl_body)
368 /* How specific the function is (for method selection - Java source
369    code front-end */
370 #define DECL_SPECIFIC_COUNT(DECL) DECL_ARG_SLOT_COUNT(DECL)
371
372 /* In a LABEL_DECL, a TREE_VEC that saves the type_map at that point. */
373 #define LABEL_TYPE_STATE(NODE) (DECL_INITIAL (NODE))
374
375 /* In the label of a subroutine, a dummy label that records the
376    state following a merge of all the ret instructions in this subroutine. */
377 #define LABEL_RETURN_LABEL(DECL) DECL_ARGUMENTS(DECL)
378
379 /* In the label of a sub-routine, records the type state at return.
380  * A local may be TYPE_UNUSED, which means that the local is not
381  * used (stored to or loaded from) in this subroutine - at least for
382  * code that we have verified so far. */
383 #define LABEL_RETURN_TYPE_STATE(NODE) LABEL_TYPE_STATE (LABEL_RETURN_LABEL (NODE))
384
385 /* In a TREE_VEC for a LABEL_RETURN_TYPE_STATE, notes that
386    TREE_VEC_LENGTH has been adjust to the correct stack size. */
387 #define RETURN_MAP_ADJUSTED(NODE) TREE_LANG_FLAG_2(NODE)
388
389 /* In the label of a sub-routine, a chain of the return location labels. */
390 #define LABEL_RETURN_LABELS(node) DECL_RESULT (LABEL_RETURN_LABEL(node))
391
392 /* In a LABEL_DECL, the next pending label.
393    See pending_blocks in expr.c. */
394 #define LABEL_PENDING_CHAIN(NODE) DECL_RESULT(NODE)
395
396 /* In a LABEL_DECL, the corresponding bytecode program counter. */
397 #define LABEL_PC(NODE) ((NODE)->decl.saved_insns.i)
398
399 /* Used during verification to mark the label has "changed". (See JVM Spec). */
400 #define LABEL_CHANGED(NODE) DECL_LANG_FLAG_6(NODE)
401
402 /* In a LABEL_DECL, true if we have verified instructions starting here. */
403 #define LABEL_VERIFIED(NODE) (instruction_bits[LABEL_PC(NODE)]&BCODE_VERIFIED)
404
405 /* True if this code is within a subroutine (target of a jsr). */
406 #define LABEL_IN_SUBR(NODE) DECL_LANG_FLAG_4(NODE)
407 /* True if this code is the start of a subroutine (target of a jsr). */
408 #define LABEL_IS_SUBR_START(NODE) DECL_LANG_FLAG_5(NODE)
409
410 /* In a LABEL_DECL, if LABEL_IN_SUBR(NODE), points to start of subroutine. */
411 #define LABEL_SUBR_START(NODE) DECL_ABSTRACT_ORIGIN(NODE)
412
413 /* In a LABEL_DECL that has LABEL_IS_SUBR_START, this points to the start
414    of surrounding subroutine in the case of a nested subroutine,
415    and NULL_TREE otherwise. */
416 #define LABEL_SUBR_CONTEXT(NODE) DECL_CONTEXT (LABEL_RETURN_LABEL (NODE))
417
418 /* The slot number for this local variable. */
419 #define DECL_LOCAL_SLOT_NUMBER(NODE) \
420   (((struct lang_decl_var*)DECL_LANG_SPECIFIC(NODE))->slot_number)
421 /* The start (bytecode) pc for the valid range of this local variable. */
422 #define DECL_LOCAL_START_PC(NODE) \
423   (((struct lang_decl_var*)DECL_LANG_SPECIFIC(NODE))->start_pc)
424 /* The end (bytecode) pc for the valid range of this local variable. */
425 #define DECL_LOCAL_END_PC(NODE) \
426   (((struct lang_decl_var*)DECL_LANG_SPECIFIC(NODE))->end_pc)
427 /* For a VAR_DECLor PARM_DECL, used to chain decls with the same
428    slot_number in decl_map. */
429 #define DECL_LOCAL_SLOT_CHAIN(NODE) \
430   (((struct lang_decl_var*)DECL_LANG_SPECIFIC(NODE))->slot_chain)
431
432 /* DECL_LANG_SPECIFIC for FUNCTION_DECLs. */
433 struct lang_decl
434 {
435   /*  tree chain; not yet used. */
436   long code_offset;
437   int code_length;
438   long linenumbers_offset;
439   long localvariables_offset;
440   int arg_slots;
441   int max_locals, max_stack, arg_slot_count;
442   tree throws_list;             /* Exception specified by `throws' */
443   tree function_decl_body;      /* Hold all function's statements */
444   tree called_constructor;      /* When decl is a constructor, the
445                                    list of other constructor it calls. */
446 };
447
448 /* DECL_LANG_SPECIFIC for VAR_DECL and PARM_DECL. */
449 struct lang_decl_var
450 {
451   int slot_number;
452   int start_pc;
453   int end_pc;
454   tree slot_chain;
455 };
456
457 struct lang_type
458 {
459   tree signature;
460   struct JCF *jcf;
461 };
462
463 #ifdef JAVA_USE_HANDLES
464 /* TYPE_BINFO_HANDLE points from a handle-class to its corresponding
465    non-handle-class, and vice verse. */
466
467 #define BINFO_HANDLE(NODE) TREE_VEC_ELT ((NODE), 6)
468
469 /* Given a RECORD_TYPE for a handle type, return the corresponding class. */
470 #define HANDLE_TO_CLASS_TYPE(HTYPE) BINFO_HANDLE (TYPE_BINFO (HTYPE))
471
472 /* Given a RECORD_TYPE for a class, return the corresponding handle type. */
473 #define CLASS_TO_HANDLE_TYPE(TYPE) BINFO_HANDLE (TYPE_BINFO (TYPE))
474 #else
475 #define HANDLE_TO_CLASS_TYPE(HTYPE) (HTYPE)
476 #define CLASS_TO_HANDLE_TYPE(TYPE) (TYPE)
477 #endif
478
479 #define JCF_u4 unsigned long
480 #define JCF_u2 unsigned short
481
482 extern void add_assume_compiled PROTO ((const char *, int));
483 extern tree lookup_class PROTO ((tree));
484 extern tree lookup_java_constructor PROTO ((tree, tree));
485 extern tree lookup_java_method PROTO ((tree, tree, tree));
486 extern tree lookup_argument_method PROTO ((tree, tree, tree));
487 extern tree promote_type PROTO ((tree));
488 extern tree get_constant PROTO ((struct JCF*, int));
489 extern tree get_name_constant PROTO ((struct JCF*, int));
490 extern tree get_class_constant PROTO ((struct JCF*, int));
491 extern tree parse_signature PROTO ((struct JCF *jcf, int sig_index));
492 extern void jcf_parse PROTO ((struct JCF*));
493 extern tree add_field PROTO ((tree, tree, tree, int));
494 extern tree add_method PROTO ((tree, int, tree, tree));
495 extern tree add_method_1 PROTO ((tree, int, tree, tree));
496 extern tree make_class PROTO ((void));
497 extern tree push_class PROTO ((tree, tree));
498 extern tree unmangle_classname PROTO ((const char *name, int name_length));
499 extern tree parse_signature_string PROTO ((const unsigned char *, int));
500 extern tree get_type_from_signature PROTO ((tree));
501 extern void layout_class PROTO ((tree));
502 extern tree layout_class_method PROTO ((tree, tree, tree, tree));
503 extern void layout_class_methods PROTO ((tree));
504 extern tree build_class_ref PROTO ((tree));
505 extern tree build_dtable_decl PROTO ((tree));
506 extern tree build_internal_class_name PROTO ((tree));
507 extern tree build_constants_constructor PROTO ((void));
508 extern tree build_ref_from_constant_pool PROTO ((int));
509 extern tree build_utf8_ref PROTO ((tree));
510 extern tree ident_subst PROTO ((const char*, int,
511                                 const char*, int, int, const char*));
512 extern tree identifier_subst PROTO ((const tree,
513                                      const char *, int, int, const char *));
514 extern tree build_java_signature PROTO ((tree));
515 extern tree build_java_argument_signature PROTO ((tree));
516 extern void set_java_signature PROTO ((tree, tree));
517 extern tree build_static_field_ref PROTO ((tree));
518 extern tree build_address_of PROTO ((tree));
519 extern tree find_local_variable PROTO ((int index, tree type, int pc));
520 extern tree find_stack_slot PROTO ((int index, tree type));
521 extern tree build_prim_array_type PROTO ((tree, HOST_WIDE_INT));
522 extern tree build_java_array_type PROTO ((tree, HOST_WIDE_INT));
523 extern int is_compiled_class PROTO ((tree));
524 extern tree mangled_classname PROTO ((const char*, tree));
525 extern tree lookup_label PROTO ((int));
526 extern tree pop_type_0 PROTO ((tree));
527 extern tree pop_type PROTO ((tree));
528 extern void pop_argument_types PROTO ((tree));
529 extern tree decode_newarray_type PROTO ((int));
530 extern tree lookup_field PROTO ((tree*, tree));
531 extern int is_array_type_p PROTO ((tree));
532 extern HOST_WIDE_INT java_array_type_length PROTO ((tree));
533 extern int read_class PROTO ((tree));
534 extern void load_class PROTO ((tree, int));
535
536 extern tree lookup_name PROTO ((tree));
537 extern tree build_known_method_ref PROTO ((tree, tree, tree, tree, tree));
538 extern tree build_class_init PROTO ((tree, tree));
539 extern tree build_invokevirtual PROTO ((tree, tree));
540 extern tree build_invokeinterface PROTO ((tree, tree, tree));
541 extern tree invoke_build_dtable PROTO ((int, tree));
542 extern tree build_field_ref PROTO ((tree, tree, tree));
543 extern void pushdecl_force_head PROTO ((tree));
544 extern tree build_java_binop PROTO ((enum tree_code, tree, tree, tree));
545 extern tree build_java_soft_divmod PROTO ((enum tree_code, tree, tree, tree));
546 extern tree binary_numeric_promotion PROTO ((tree, tree, tree *, tree *));
547 extern tree build_java_arrayaccess PROTO ((tree, tree, tree));
548 extern tree build_newarray PROTO ((int, tree));
549 extern tree build_anewarray PROTO ((tree, tree));
550 extern tree build_new_array PROTO ((tree, tree));
551 extern tree build_java_array_length_access PROTO ((tree));
552 extern tree build_java_arraynull_check PROTO ((tree, tree, tree));
553 extern tree create_label_decl PROTO ((tree));
554 extern void push_labeled_block PROTO ((tree));
555 extern tree prepare_eh_table_type PROTO ((tree));
556 extern void java_set_exception_lang_code PROTO ((void));
557 extern tree generate_name PROTO ((void));
558 extern void pop_labeled_block PROTO ((void));
559 extern const char *lang_printable_name PROTO ((tree, int));
560 extern tree maybe_add_interface PROTO ((tree, tree));
561 extern void set_super_info PROTO ((int, tree, tree, int));
562 extern int get_access_flags_from_decl PROTO ((tree));
563 extern int interface_of_p PROTO ((tree, tree));
564 extern int inherits_from_p PROTO ((tree, tree));
565 extern void complete_start_java_method PROTO ((tree));
566 extern tree build_result_decl PROTO ((tree));
567 extern void emit_handlers PROTO ((void));
568 extern void init_outgoing_cpool PROTO ((void));
569 extern void make_class_data PROTO ((tree));
570 extern void register_class PROTO ((void));
571 extern int alloc_name_constant PROTO ((int, tree));
572 extern void emit_register_classes PROTO ((void));
573 extern void lang_init_source PROTO ((int));
574 extern void write_classfile PROTO ((tree));
575 extern char *print_int_node PROTO ((tree));
576 extern void parse_error_context PVPROTO ((tree cl, const char *, ...))
577   ATTRIBUTE_PRINTF_2;
578 extern tree build_primtype_type_ref PROTO ((const char *));
579 extern tree java_get_real_method_name PROTO ((tree));
580 extern void finish_class PROTO ((void));
581 extern void java_layout_seen_class_methods PROTO ((void));
582 extern void check_for_initialization PROTO ((tree));
583
584 extern tree pushdecl_top_level PROTO ((tree));
585 extern int alloc_class_constant PROTO ((tree));
586 extern int unicode_mangling_length PROTO ((const char *, int));
587 extern void init_expr_processing PROTO ((void));
588 extern void push_super_field PROTO ((tree, tree));
589 extern void init_class_processing PROTO ((void));
590 extern int can_widen_reference_to PROTO ((tree, tree));
591 extern int class_depth PROTO ((tree));
592 extern int verify_jvm_instructions PROTO ((struct JCF *, const unsigned char *, long));
593 extern void maybe_pushlevels PROTO ((int));
594 extern void maybe_poplevels PROTO ((int));
595 extern int process_jvm_instruction PROTO ((int, const unsigned char *, long));
596 extern void set_local_type PROTO ((int, tree));
597 extern int merge_type_state PROTO ((tree));
598 extern void push_type PROTO ((tree));
599 extern void load_type_state PROTO ((tree));
600 extern void add_interface PROTO ((tree, tree));
601 extern void append_gpp_mangled_name PROTO ((struct obstack *, const char *, int));
602 extern void append_gpp_mangled_classtype PROTO ((struct obstack *, const char *));
603 extern void emit_unicode_mangled_name PROTO ((struct obstack *, const char *, int));
604 extern tree force_evaluation_order PROTO ((tree));
605 extern int verify_constant_pool PROTO ((struct JCF *));
606 extern void start_java_method PROTO ((tree));
607 extern void end_java_method PROTO ((void));
608 extern void give_name_to_locals PROTO ((struct JCF *));
609 extern void expand_byte_code PROTO ((struct JCF *, tree));
610 extern int open_in_zip PROTO ((struct JCF *, const char *, const char *, int));
611 extern void set_constant_value PROTO ((tree, tree));
612 #ifdef jword
613 extern int find_constant1 PROTO ((struct CPool *, int, jword));
614 extern int find_constant2 PROTO ((struct CPool *, int, jword, jword));
615 #endif
616 extern int find_utf8_constant PROTO ((struct CPool *, tree));
617 extern int find_string_constant PROTO ((struct CPool *, tree));
618 extern int find_class_constant PROTO ((struct CPool *, tree));
619 extern int find_fieldref_index PROTO ((struct CPool *, tree));
620 extern int find_methodref_index PROTO ((struct CPool *, tree));
621 extern void write_constant_pool PROTO ((struct CPool *, unsigned char *, int));
622 extern int count_constant_pool_bytes PROTO ((struct CPool *));
623 extern int encode_newarray_type PROTO ((tree));
624 #ifdef uint64
625 extern void format_int PROTO ((char *, jlong, int));
626 extern void format_uint PROTO ((char *, uint64, int));
627 #endif
628 extern void jcf_trim_old_input PROTO ((struct JCF *));
629 #ifdef BUFSIZ
630 extern void jcf_print_utf8 PROTO ((FILE *, const unsigned char *, int));
631 extern void jcf_print_char PROTO ((FILE *, int));
632 extern void jcf_print_utf8_replace PROTO ((FILE *, const unsigned char *,
633                                            int, int, int));
634 # if JCF_USE_STDIO
635 extern char* open_class PROTO ((char *, struct JCF *, FILE *, const char *));
636 # else
637 extern char* open_class PROTO ((char *, struct JCF *, int, const char *));
638 # endif /* JCF_USE_STDIO */
639 #endif
640
641 /* We use ARGS_SIZE_RTX to indicate that gcc/expr.h has been included
642    to declare `enum expand_modifier'. */
643 #if defined (TREE_CODE) && defined(RTX_CODE) && defined (HAVE_MACHINE_MODES) && defined (ARGS_SIZE_RTX)
644 struct rtx_def * java_lang_expand_expr PROTO ((tree, rtx, enum machine_mode,
645                                                enum expand_modifier)); 
646 #endif /* TREE_CODE && RTX_CODE && HAVE_MACHINE_MODES && ARGS_SIZE_RTX */
647
648 /* Access flags etc for a method (a FUNCTION_DECL): */
649
650 #define METHOD_PUBLIC(DECL) DECL_LANG_FLAG_1 (DECL)
651 #define METHOD_PRIVATE(DECL) TREE_PRIVATE (DECL)
652 #define METHOD_PROTECTED(DECL) TREE_PROTECTED (DECL)
653 #define METHOD_STATIC(DECL) DECL_LANG_FLAG_2 (DECL)
654 #define METHOD_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
655 #define METHOD_SYNCHRONIZED(DECL) DECL_LANG_FLAG_4 (DECL)
656 #define METHOD_NATIVE(DECL) DECL_EXTERNAL(DECL)
657 #define METHOD_ABSTRACT(DECL) DECL_LANG_FLAG_5 (DECL)
658 #define METHOD_TRANSIENT(DECL) DECL_LANG_FLAG_6 (DECL)
659
660 #define DECL_CONSTRUCTOR_P(DECL) DECL_LANG_FLAG_7(DECL)
661
662 /* Access flags etc for a variable/field (a FIELD_DECL): */
663
664 #define FIELD_PRIVATE(DECL) TREE_PRIVATE (DECL)
665 #define FIELD_PROTECTED(DECL) TREE_PROTECTED (DECL)
666 #define FIELD_PUBLIC(DECL) DECL_LANG_FLAG_1 (DECL)
667 #define FIELD_STATIC(DECL) TREE_STATIC (DECL)
668 #define FIELD_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
669 #define FIELD_VOLATILE(DECL) DECL_LANG_FLAG_4 (DECL)
670 #define FIELD_TRANSIENT(DECL) DECL_LANG_FLAG_5 (DECL)
671
672 /* Access flags etc for a class (a TYPE_DECL): */
673
674 #define CLASS_PUBLIC(DECL) DECL_LANG_FLAG_1 (DECL)
675 #define CLASS_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
676 #define CLASS_INTERFACE(DECL) DECL_LANG_FLAG_4 (DECL)
677 #define CLASS_ABSTRACT(DECL) DECL_LANG_FLAG_5 (DECL)
678 #define CLASS_SUPER(DECL) DECL_LANG_FLAG_6 (DECL)
679
680 /* @deprecated marker flag on methods, fields and classes */
681
682 #define METHOD_DEPRECATED(DECL) DECL_LANG_FLAG_0 (DECL)
683 #define FIELD_DEPRECATED(DECL) DECL_LANG_FLAG_0 (DECL)
684 #define CLASS_DEPRECATED(DECL) DECL_LANG_FLAG_0 (DECL)
685 #define DECL_DEPRECATED(DECL) DECL_LANG_FLAG_0 (DECL)
686
687 /* The number of virtual methods in this class's dispatch table.
688  Does not include initial two dummy entries (one points to the
689  Class object, and the other is for G++ -fvtable-thunks compatibility). */
690 #define TYPE_NVIRTUALS(TYPE) TYPE_BINFO_VIRTUALS (TYPE)
691
692 /* A TREE_VEC (indexed by DECL_VINDEX) containing this class's
693    virtual methods. */
694 #define TYPE_VTABLE(TYPE) TYPE_BINFO_VTABLE(TYPE)
695
696 /* Use CLASS_LOADED_P? FIXME */
697 #define CLASS_COMPLETE_P(DECL) DECL_LANG_FLAG_2 (DECL) 
698
699 /* This maps a bytecode offset (PC) to various flags,
700    listed below (starting with BCODE_). */
701 extern char *instruction_bits;
702
703 /* True iff the byte is the start of an instruction. */
704 #define BCODE_INSTRUCTION_START 1
705
706 /* True iff there is a jump to this location. */
707 #define BCODE_JUMP_TARGET 2
708
709 /* True iff there is a return to this location.
710    (I.e. the preceedng instruction was a call.) */
711 #define BCODE_RETURN_TARGET 4
712
713 /* True iff this is the start of an exception handler. */
714 #define BCODE_EXCEPTION_TARGET 16
715
716 /* True iff there is a jump to this location (and it needs a label). */
717 #define BCODE_TARGET \
718   (BCODE_JUMP_TARGET|BCODE_RETURN_TARGET \
719    | BCODE_EXCEPTION_TARGET)
720
721 /* True iff there is an entry in the linenumber table for this location. */
722 #define BCODE_HAS_LINENUMBER 32
723
724 /* True iff there is more than one entry in the linenumber table for
725    this location.  (This probably does not make much sense.)  */
726 #define BCODE_HAS_MULTI_LINENUMBERS 64
727
728 /* True if this instruction has been verified. */
729 #define BCODE_VERIFIED 8
730
731 /* A pointer to the line number table of the current method. */
732 extern const unsigned char *linenumber_table;
733 /* The length (in items) of the line number table. */
734 extern int linenumber_count;
735
736 /* In type_map, means that slot is uninitialized or otherwise unusable. */
737 #define TYPE_UNKNOWN NULL_TREE
738
739 /* In type_map, means the second half of a 64-bit double or long. */
740 #define TYPE_SECOND void_type_node
741
742 /* In type_map, means the null type (i.e. type of a null reference). */ 
743 #define TYPE_NULL ptr_type_node
744
745 /* In a type map means the type the address subroutine return address. */
746 #define TYPE_RETURN_ADDR return_address_type_node
747
748 /* In a subroutine's return type map, indicates that the slot was neither
749    used nor set in the subroutine. */
750 #define TYPE_UNUSED error_mark_node
751
752 /* A array mapping variable/stack slot index to the type current
753    in that variable/stack slot.
754    TYPE_UNKNOWN, TYPE_SECOND, and TYPE_NULL are special cases. */
755 extern tree *type_map;
756
757 /* Map a stack index to the type currently in that slot. */
758 #define stack_type_map (type_map+DECL_MAX_LOCALS(current_function_decl))
759
760 /* True iff TYPE takes two variable/stack slots. */
761 #define TYPE_IS_WIDE(TYPE) \
762   ((TYPE) == double_type_node || (TYPE) == long_type_node)
763
764 /* True iff TYPE is a Java array type. */
765 #define TYPE_ARRAY_P(TYPE) TYPE_LANG_FLAG_1 (TYPE)
766
767 /* If FUNCTION_TYPE or METHOD_TYPE: cache for build_java_argument_signature. */
768 #define TYPE_ARGUMENT_SIGNATURE(TYPE) TYPE_VFIELD(TYPE)
769
770 /* Given an array type, give the type of the elements. */
771 /* FIXME this use of TREE_TYPE conflicts with something or other. */
772 #define TYPE_ARRAY_ELEMENT(ATYPE) TREE_TYPE(ATYPE)
773
774 /* True if class TYPE has been loaded. */
775 #define CLASS_LOADED_P(TYPE) TYPE_LANG_FLAG_2 (TYPE)
776
777 /* True if class TYPE was defined in Java source code. */
778 #define CLASS_FROM_SOURCE_P(TYPE) TYPE_LANG_FLAG_3 (TYPE)
779
780 /* True of a RECORD_TYPE of a class/interface type (not array type) */
781 #define CLASS_P(TYPE) TYPE_LANG_FLAG_4 (TYPE)
782
783 /* True if class TYPE was defined in a Java source file compiled. */
784 #define CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P(TYPE) \
785   TYPE_LANG_FLAG_5 (TYPE)
786
787 /* True if class TYPE has a field initializer $finit$ function */
788 #define CLASS_HAS_FINIT_P(TYPE) TYPE_LANG_FLAG_6 (TYPE)
789
790 /* True if identifier ID was seen while processing a single type import stmt */
791 #define IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P(ID) TREE_LANG_FLAG_0 (ID)
792
793 /* True if identifier ID was seen while processing an import statement */
794 #define IS_A_CLASSFILE_NAME(ID) TREE_LANG_FLAG_1 (ID)
795
796 /* True if ID is a qualified named (contains . or /) */
797 #define QUALIFIED_P(ID) TREE_LANG_FLAG_2 (ID)
798
799 /* True if ID is an already processed import on demand */
800 #define IS_AN_IMPORT_ON_DEMAND_P(ID) TREE_LANG_FLAG_3 (ID)
801
802 /* True if ID is a command-line specified filename */
803 #define IS_A_COMMAND_LINE_FILENAME_P(ID) TREE_LANG_FLAG_4 (ID)
804
805 /* True if filename ID has already been parsed */
806 #define HAS_BEEN_ALREADY_PARSED_P(ID) TREE_LANG_FLAG_5 (ID)
807
808 /* True if EXPR is RHS sub-tree of a compound assign expression */
809 #define COMPOUND_ASSIGN_P(EXPR) TREE_LANG_FLAG_1 (EXPR)
810
811 /* True if a SWITCH_EXPR has a DEFAULT_EXPR. */
812 #define SWITCH_HAS_DEFAULT(NODE) TREE_LANG_FLAG_3 (NODE)
813
814 /* True if EXPR (a WFL in that case) was created after the
815    reduction of PRIMARY . XXX */
816 #define PRIMARY_P(EXPR) TREE_LANG_FLAG_2 (EXPR)
817
818 /* True if EXPR (a MODIFY_EXPR in that case) is the result of variable
819    initialization during its declaration */
820 #define MODIFY_EXPR_FROM_INITIALIZATION_P(EXPR) TREE_LANG_FLAG_2 (EXPR)
821
822 /* True if EXPR (a WFL in that case) resolves into an expression name */
823 #define RESOLVE_EXPRESSION_NAME_P(WFL) TREE_LANG_FLAG_0 (WFL)
824
825 /* True if EXPR (a LOOP_EXPR in that case) is part of a for statement */
826 #define IS_FOR_LOOP_P(EXPR) TREE_LANG_FLAG_0 (EXPR)
827
828 /* True if EXPR (a WFL in that case) resolves into a package name */
829 #define RESOLVE_PACKAGE_NAME_P(WFL) TREE_LANG_FLAG_3 (WFL)
830
831 /* True if EXPR (a WFL in that case) resolves into a type name */
832 #define RESOLVE_TYPE_NAME_P(WFL) TREE_LANG_FLAG_4 (WFL)
833
834 /* True if STMT (a WFL in that case) holds a BREAK statement */
835 #define IS_BREAK_STMT_P(WFL) TREE_LANG_FLAG_5 (WFL)
836
837 /* True if EXPR (a CALL_EXPR in that case) is a crafted StringBuffer */
838 #define IS_CRAFTED_STRING_BUFFER_P(EXPR) TREE_LANG_FLAG_5 (EXPR)
839
840 /* If set in CALL_EXPR, the receiver is 'super'. */
841 #define CALL_USING_SUPER(EXPR) TREE_LANG_FLAG_4 (EXPR)
842
843 /* True if NODE (a statement) can complete normally. */
844 #define CAN_COMPLETE_NORMALLY(NODE) TREE_LANG_FLAG_6(NODE)
845
846 /* Add a FIELD_DECL to RECORD_TYPE RTYPE.
847    The field has name NAME (a char*), and type FTYPE.
848    Unless this is the first field, FIELD most hold the previous field.
849    FIELD is set to the newly created FIELD_DECL.
850
851    We set DECL_ARTIFICIAL so these fields get skipped by make_class_data
852    if compiling java.lang.Object or java.lang.Class. */
853
854 #define PUSH_FIELD(RTYPE, FIELD, NAME, FTYPE) \
855 { tree tmp_field = build_decl (FIELD_DECL, get_identifier(NAME), FTYPE); \
856   if (TYPE_FIELDS (RTYPE) == NULL_TREE) TYPE_FIELDS (RTYPE) = tmp_field; \
857   else TREE_CHAIN(FIELD) = tmp_field; \
858   DECL_CONTEXT (tmp_field) = RTYPE; \
859   DECL_ARTIFICIAL (tmp_field) = 1; \
860   FIELD = tmp_field; }
861
862 #define FINISH_RECORD(RTYPE) layout_type (RTYPE)
863
864 /* Start building a RECORD_TYPE constructor with a given TYPE in CONS. */
865 #define START_RECORD_CONSTRUCTOR(CONS, CTYPE) { \
866   CONS = build (CONSTRUCTOR, CTYPE, NULL_TREE, NULL_TREE);\
867   TREE_CHAIN(CONS) = TYPE_FIELDS (CTYPE); }
868
869 /* Append a field initializer to CONS for the dummy field for the inherited
870    fields.  The dummy field has the given VALUE, and the same type as the
871    super-class.   Must be specified before calls to PUSH_FIELD_VALUE. */
872
873 #define PUSH_SUPER_VALUE(CONS, VALUE) {\
874   tree field = TREE_CHAIN(CONS);\
875   if (DECL_NAME (field) != NULL_TREE) abort();\
876   CONSTRUCTOR_ELTS(CONS) = tree_cons (field, VALUE, CONSTRUCTOR_ELTS(CONS));\
877   TREE_CHAIN(CONS) = TREE_CHAIN (field); }
878
879 /* Append a field initializer to CONS for a field with the given VALUE.
880    NAME is a char* string used for error checking;
881    the initializer must be specified in order. */
882 #define PUSH_FIELD_VALUE(CONS, NAME, VALUE) {\
883   tree field = TREE_CHAIN(CONS);\
884   if (strcmp (IDENTIFIER_POINTER (DECL_NAME (field)), NAME) != 0) abort();\
885   CONSTRUCTOR_ELTS(CONS) = tree_cons (field, VALUE, CONSTRUCTOR_ELTS(CONS));\
886   TREE_CHAIN(CONS) = TREE_CHAIN (field); }
887
888 /* Finish creating a record CONSTRUCTOR CONS. */
889 #define FINISH_RECORD_CONSTRUCTOR(CONS) \
890   CONSTRUCTOR_ELTS(CONS) = nreverse (CONSTRUCTOR_ELTS(CONS))
891
892 /* Macros on constructors invocations.  */
893 #define CALL_CONSTRUCTOR_P(NODE)                \
894   (TREE_CODE (NODE) == NEW_CLASS_EXPR || CALL_EXPLICIT_CONSTRUCTOR_P (NODE))
895
896 #define CALL_EXPLICIT_CONSTRUCTOR_P(NODE)                               \
897   (CALL_THIS_CONSTRUCTOR_P (NODE) || CALL_SUPER_CONSTRUCTOR_P (NODE))
898
899 #define CALL_THIS_CONSTRUCTOR_P(NODE)                                   \
900   (TREE_CODE (NODE) == CALL_EXPR                                        \
901    && EXPR_WFL_NODE (TREE_OPERAND (NODE, 0)) == this_identifier_node)
902
903 #define CALL_SUPER_CONSTRUCTOR_P(NODE)                                  \
904   (TREE_CODE (NODE) == CALL_EXPR                                        \
905    && EXPR_WFL_NODE (TREE_OPERAND (NODE, 0)) == super_identifier_node)
906
907 /* Using a FINALLY_EXPR node */
908 #define FINALLY_EXPR_LABEL(NODE) TREE_OPERAND ((NODE), 0)
909 #define FINALLY_EXPR_BLOCK(NODE) TREE_OPERAND ((NODE), 1)
910
911 #define BLOCK_EXPR_DECLS(NODE)  BLOCK_VARS(NODE)
912 #define BLOCK_EXPR_BODY(NODE)   BLOCK_SUBBLOCKS(NODE)
913
914 #define BUILD_MONITOR_ENTER(WHERE, ARG)                         \
915   {                                                             \
916     (WHERE) = build (CALL_EXPR, int_type_node,                  \
917                      build_address_of (soft_monitorenter_node), \
918                      build_tree_list (NULL_TREE, (ARG)),        \
919                      NULL_TREE);                                \
920     TREE_SIDE_EFFECTS (WHERE) = 1;                              \
921   }
922
923 #define BUILD_MONITOR_EXIT(WHERE, ARG)                          \
924   {                                                             \
925     (WHERE) = build (CALL_EXPR, int_type_node,                  \
926                      build_address_of (soft_monitorexit_node),  \
927                      build_tree_list (NULL_TREE, (ARG)),        \
928                      NULL_TREE);                                \
929     TREE_SIDE_EFFECTS (WHERE) = 1;                              \
930   }
931
932 /* Non zero if TYPE is an unchecked exception */
933 #define IS_UNCHECKED_EXCEPTION_P(TYPE)                          \
934   (inherits_from_p ((TYPE), runtime_exception_type_node)        \
935    || inherits_from_p ((TYPE), error_exception_type_node))
936
937 extern int java_error_count;                                    \
938
939 /* Make the current function where this macro is invoked report error
940    messages and and return, if any */
941 #define java_parse_abort_on_error()                                     \
942   {                                                                     \
943      if (java_error_count > save_error_count)                           \
944        return;                                                          \
945    }