]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/java/java-tree.h
Merge from pch-branch up to tag pch-commit-20020603.
[thirdparty/gcc.git] / gcc / java / java-tree.h
CommitLineData
377029eb 1/* Definitions for parsing and type checking for the GNU compiler for
2 the Java(TM) language.
aec3a886 3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
4 Free Software Foundation, Inc.
377029eb 5
6This file is part of GNU CC.
7
8GNU CC is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2, or (at your option)
11any later version.
12
13GNU CC is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GNU CC; see the file COPYING. If not, write to
20the Free Software Foundation, 59 Temple Place - Suite 330,
21Boston, MA 02111-1307, USA.
22
23Java and all Java-based marks are trademarks or registered trademarks
24of Sun Microsystems, Inc. in the United States and other countries.
25The Free Software Foundation is independent of Sun Microsystems, Inc. */
26
27/* Hacked by Per Bothner <bothner@cygnus.com> February 1996. */
28
1f3233d1 29#include "hashtab.h"
9215cfa3 30
377029eb 31/* Java language-specific tree codes. */
32#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
33enum java_tree_code {
34 __DUMMY = LAST_AND_UNUSED_TREE_CODE,
35#include "java-tree.def"
36 LAST_JAVA_TREE_CODE
37};
38#undef DEFTREECODE
39
40struct JCF;
41
42/* Usage of TREE_LANG_FLAG_?:
43 0: IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P (in IDENTIFIER_NODE)
44 RESOLVE_EXPRESSION_NAME_P (in EXPR_WITH_FILE_LOCATION)
4654e794 45 FOR_LOOP_P (in LOOP_EXPR)
bae6ff29 46 SUPPRESS_UNREACHABLE_ERROR (for other _EXPR nodes)
4654e794 47 ANONYMOUS_CLASS_P (in RECORD_TYPE)
48 ARG_FINAL_P (in TREE_LIST)
377029eb 49 1: CLASS_HAS_SUPER_FLAG (in TREE_VEC).
50 IS_A_CLASSFILE_NAME (in IDENTIFIER_NODE)
51 COMPOUND_ASSIGN_P (in EXPR (binop_*))
4654e794 52 LOCAL_CLASS_P (in RECORD_TYPE)
2a3fc102 53 BLOCK_IS_IMPLICIT (in BLOCK)
cb18c572 54 JAVA_FILE_P (in TREE_LIST in current_file_list)
377029eb 55 2: RETURN_MAP_ADJUSTED (in TREE_VEC).
56 QUALIFIED_P (in IDENTIFIER_NODE)
57 PRIMARY_P (in EXPR_WITH_FILE_LOCATION)
58 MODIFY_EXPR_FROM_INITIALIZATION_P (in MODIFY_EXPR)
4177eed1 59 CLASS_METHOD_CHECKED_P (in RECORD_TYPE)
cb18c572 60 CLASS_FILE_P (in TREE_LIST in current_file_list)
377029eb 61 3: IS_AN_IMPORT_ON_DEMAND_P (in IDENTIFIER_NODE)
62 RESOLVE_PACKAGE_NAME_P (in EXPR_WITH_FILE_LOCATION)
efd71bdf 63 SWITCH_HAS_DEFAULT (in SWITCH_EXPR)
cb18c572 64 ZIP_FILE_P (in TREE_LIST in current_file_list)
a8f5ddb8 65 HAS_FINALIZER (in RECORD_TYPE)
c31939b7 66 4: IS_A_COMMAND_LINE_FILENAME_P (in IDENTIFIER_NODE)
67 RESOLVE_TYPE_NAME_P (in EXPR_WITH_FILE_LOCATION)
7e1ce541 68 CALL_USING_SUPER (in CALL_EXPR)
2d87a73a 69 IS_ARRAY_LENGTH_ACCESS (in INDIRECT_REF)
c31939b7 70 5: HAS_BEEN_ALREADY_PARSED_P (in IDENTIFIER_NODE)
71 IS_BREAK_STMT_P (in EXPR_WITH_FILE_LOCATION)
b8f64b70 72 IS_CRAFTED_STRING_BUFFER_P (in CALL_EXPR)
b4447497 73 IS_INIT_CHECKED (in SAVE_EXPR)
4654e794 74 6: CAN_COMPLETE_NORMALLY (in statement nodes)
75 OUTER_FIELD_ACCESS_IDENTIFIER_P (in IDENTIFIER_NODE)
377029eb 76
77 Usage of TYPE_LANG_FLAG_?:
4654e794 78 0: CLASS_ACCESS0_GENERATED_P (in RECORD_TYPE)
377029eb 79 1: TYPE_ARRAY_P (in RECORD_TYPE).
0574932f 80 2: CLASS_PARSED_P (in RECORD_TYPE).
377029eb 81 3: CLASS_FROM_SOURCE_P (in RECORD_TYPE).
82 4: CLASS_P (in RECORD_TYPE).
c31939b7 83 5: CLASS_FROM_CURRENTLY_COMPILED_SOURCE_P (in RECORD_TYPE)
4654e794 84 6: CLASS_BEING_LAIDOUT (in RECORD_TYPE)
377029eb 85
86 Usage of DECL_LANG_FLAG_?:
23b7f2e1 87 0: METHOD_DEPRECATED (in FUNCTION_DECL).
88 FIELD_DEPRECATED (in FIELD_DECL).
89 CLASS_DEPRECATED (in TYPE_DECL).
377029eb 90 1: METHOD_PUBLIC (in FUNCTION_DECL).
91 FIELD_PUBLIC (in FIELD_DECL).
92 CLASS_PUBLIC (in TYPE_DECL).
93 2: METHOD_STATIC (in FUNCTION_DECL).
94 (But note that FIELD_STATIC uses TREE_STATIC!)
95 CLASS_COMPLETE_P (in TYPE_DECL)
96 3: METHOD_FINAL (in FUNCTION_DECL)
97 FIELD_FINAL (in FIELD_DECL)
98 CLASS_FINAL (in TYPE_DECL)
2d87a73a 99 DECL_FINAL (in any decl)
377029eb 100 4: METHOD_SYNCHRONIZED (in FUNCTION_DECL).
101 LABEL_IN_SUBR (in LABEL_DECL)
102 CLASS_INTERFACE (in TYPE_DECL)
103 FIELD_VOLATILE (int FIELD_DECL)
104 5: METHOD_ABSTRACT (in FUNCTION_DECL).
105 LABEL_IS_SUBR_START (in LABEL_DECL)
106 CLASS_ABSTRACT (in TYPE_DECL)
107 FIELD_TRANSIENT (in FIELD_DECL)
108 6: METHOD_TRANSIENT (in FUNCTION_DECL)
109 LABEL_CHANGED (in LABEL_DECL)
110 CLASS_SUPER (in TYPE_DECL, ACC_SUPER flag)
4654e794 111 FIELD_LOCAL_ALIAS (in FIELD_DECL)
23b7f2e1 112 7: DECL_CONSTRUCTOR_P (in FUNCTION_DECL).
4654e794 113 CLASS_STATIC (in TYPE_DECL)
114 FIELD_LOCAL_ALIAS_USED (in FIELD_DECL)
115 FIELD_THISN (in FIELD_DECL)
377029eb 116*/
117
118/* True if the class whose TYPE_BINFO this is has a superclass.
119 (True of all classes except Object.) */
120#define CLASS_HAS_SUPER_FLAG(BINFO) TREE_LANG_FLAG_1(BINFO)
121#define CLASS_HAS_SUPER(TYPE) CLASS_HAS_SUPER_FLAG (TYPE_BINFO (TYPE))
122
123/* Return the supertype of class TYPE, or NULL_TREE is it has none. */
124#define CLASSTYPE_SUPER(TYPE) (CLASS_HAS_SUPER (TYPE) ? \
125 BINFO_TYPE (TREE_VEC_ELT (TYPE_BINFO_BASETYPES (TYPE), 0)) : NULL_TREE)
126
127/* True if the class we are compiling is a .java source file;
128 false if it is a .class bytecode file. */
129extern int compiling_from_source;
130
131/* The class defined by the actual (main) file we are compiling. */
48c9f822 132#define main_class \
133 java_global_trees[JTI_MAIN_CLASS]
377029eb 134
135/* The class we are currently processing. */
48c9f822 136#define current_class \
137 java_global_trees[JTI_CURRENT_CLASS]
377029eb 138
7523afef 139/* List of all class DECLs seen so far. */
48c9f822 140#define all_class_list \
141 java_global_trees[JTI_ALL_CLASS_LIST]
7523afef 142
46fde5eb 143/* List of all class filenames seen so far. */
144#define all_class_filename java_global_trees [JTI_ALL_CLASS_FILENAME]
145
bee0e6ed 146/* List of virtual method decls called in this translation unit, used to
147 generate virtual method offset symbol table. */
148#define otable_methods java_global_trees [JTI_OTABLE_METHODS]
149
150/* The virtual method offset table. This is emitted as uninitialized data of
151 the required length, and filled out at run time during class linking. */
152#define otable_decl java_global_trees [JTI_OTABLE_DECL]
153
154/* The virtual method offset symbol table. Used by the runtime to fill out the
155 otable. */
156#define otable_syms_decl java_global_trees [JTI_OTABLE_SYMS_DECL]
157
377029eb 158extern int flag_emit_class_files;
159
489283da 160extern int flag_filelist_file;
161
47efb553 162/* When non zero, assume all native functions are implemented with
163 JNI, not CNI. */
164
165extern int flag_jni;
166
16792571 167/* When non zero, report the now deprecated empty statements. */
168
169extern int flag_extraneous_semicolon;
170
99878175 171/* When non zero, always check for a non gcj generated classes archive. */
172
173extern int flag_force_classes_archive_check;
174
f3d0f1c1 175/* When non zero, we emit xref strings. Values of the flag for xref
176 backends are defined in xref.h. */
177
178extern int flag_emit_xref;
179
ff752ab9 180/* When doing xrefs, tell when not to fold. */
181extern int do_not_fold;
182
7ad6876a 183/* Resource name. */
184extern char * resource_name;
185
6b0c8920 186/* Turned to 1 if -Wall was encountered. See lang.c for their meanings. */
187extern int flag_wall;
188extern int flag_redundant;
189extern int flag_not_overriding;
190extern int flag_static_local_jdk1_1;
191
01ce8ed3 192/* When non zero, warn when source file is newer than matching class
193 file. */
194extern int flag_newer;
195
e2416019 196/* When non zero, call a library routine to do integer divisions. */
197extern int flag_use_divide_subroutine;
198
4576deab 199/* When non zero, generate code for the Boehm GC. */
200extern int flag_use_boehm_gc;
201
af5b2568 202/* When non zero, assume the runtime uses a hash table to map an
203 object to its synchronization structure. */
204extern int flag_hash_synchronization;
205
7d55917c 206/* When non zero, generate checks for references to NULL. */
207extern int flag_check_references;
208
eb47970b 209/* Used through STATIC_CLASS_INIT_OPT_P to check whether static
210 initialization optimization should be performed. */
211extern int flag_optimize_sci;
212
bee0e6ed 213/* When non zero, use offset tables for virtual method calls
214 in order to improve binary compatibility. */
215extern int flag_indirect_dispatch;
216
c738784c 217/* When zero, don't generate runtime array store checks. */
218extern int flag_store_check;
219
f1afe160 220/* Encoding used for source files. */
c03155ca 221extern const char *current_encoding;
f1afe160 222
377029eb 223/* The Java .class file that provides main_class; the main input file. */
0381e6c0 224extern struct JCF *current_jcf;
377029eb 225
226typedef struct CPool constant_pool;
227
228#define CONSTANT_ResolvedFlag 16
229
230/* The cpool->data[i] for a ResolvedString points to a STRING_CST. */
231#define CONSTANT_ResolvedString (CONSTANT_String+CONSTANT_ResolvedFlag)
232
233/* The cpool->data[i] for a ResolvedClass points to a RECORD_TYPE. */
234#define CONSTANT_ResolvedClass (CONSTANT_Class+CONSTANT_ResolvedFlag)
235
236#define CPOOL_UTF(CPOOL, INDEX) ((tree) (CPOOL)->data[INDEX])
237
238/* A NameAndType constant is represented as a TREE_LIST.
239 The type is the signature string (as an IDENTIFIER_NODE). */
240
241#define NAME_AND_TYPE_NAME(CPOOL, IDX) \
242 CPOOL_UTF(CPOOL, CPOOL_USHORT1(CPOOL, IDX))
243#define NAME_AND_TYPE_SIGNATURE(CPOOL, IDX) \
244 CPOOL_UTF(CPOOL, CPOOL_USHORT2(CPOOL, IDX))
245
246/* A FieldRef, MethodRef or InterfaceMethodRef constant
247 is represented as a TREE_LIST. */
248
249#define COMPONENT_REF_CLASS_INDEX(CPOOL, IDX) CPOOL_USHORT1(CPOOL, IDX)
250#define COMPONENT_REF_NAME_AND_TYPE(CPOOL, IDX) CPOOL_USHORT2(CPOOL, IDX)
251#define COMPONENT_REF_NAME(CPOOL, IDX) \
252 NAME_AND_TYPE_NAME (CPOOL, COMPONENT_REF_NAME_AND_TYPE(CPOOL, IDX))
253#define COMPONENT_REF_SIGNATURE(CPOOL, IDX) \
254 NAME_AND_TYPE_SIGNATURE (CPOOL, COMPONENT_REF_NAME_AND_TYPE(CPOOL, IDX))
255
48c9f822 256enum java_tree_index
257{
258 JTI_PROMOTED_BYTE_TYPE_NODE,
259 JTI_PROMOTED_SHORT_TYPE_NODE,
260 JTI_PROMOTED_CHAR_TYPE_NODE,
261 JTI_PROMOTED_BOOLEAN_TYPE_NODE,
262
263 JTI_BYTE_TYPE_NODE,
264 JTI_SHORT_TYPE_NODE,
265 JTI_INT_TYPE_NODE,
266 JTI_LONG_TYPE_NODE,
267
268 JTI_UNSIGNED_BYTE_TYPE_NODE,
269 JTI_UNSIGNED_SHORT_TYPE_NODE,
270 JTI_UNSIGNED_INT_TYPE_NODE,
271 JTI_UNSIGNED_LONG_TYPE_NODE,
272
273 JTI_BOOLEAN_TYPE_NODE,
274
275 JTI_OBJECT_TYPE_NODE,
276 JTI_UNQUALIFIED_OBJECT_ID_NODE,
277 JTI_OBJECT_PTR_TYPE_NODE,
278 JTI_STRING_TYPE_NODE,
279 JTI_STRING_PTR_TYPE_NODE,
280 JTI_THROWABLE_TYPE_NODE,
6eb95932 281 JTI_EXCEPTION_TYPE_NODE,
48c9f822 282 JTI_RUNTIME_EXCEPTION_TYPE_NODE,
283 JTI_ERROR_EXCEPTION_TYPE_NODE,
284 JTI_RAWDATA_PTR_TYPE_NODE,
6eb95932 285 JTI_CLASS_NOT_FOUND_TYPE_NODE,
286 JTI_NO_CLASS_DEF_FOUND_TYPE_NODE,
48c9f822 287
288 JTI_BYTE_ARRAY_TYPE_NODE,
289 JTI_SHORT_ARRAY_TYPE_NODE,
290 JTI_INT_ARRAY_TYPE_NODE,
291 JTI_LONG_ARRAY_TYPE_NODE,
292 JTI_BOOLEAN_ARRAY_TYPE_NODE,
293 JTI_CHAR_ARRAY_TYPE_NODE,
294 JTI_DOUBLE_ARRAY_TYPE_NODE,
295 JTI_FLOAT_ARRAY_TYPE_NODE,
296 JTI_ARRAY_ARRAY_TYPE_NODE,
297 JTI_OBJECT_ARRAY_TYPE_NODE,
298 JTI_STRING_ARRAY_TYPE_NODE,
299 JTI_BOOLEAN_ARRAY_VTABLE,
300 JTI_BYTE_ARRAY_VTABLE,
301 JTI_CHAR_ARRAY_VTABLE,
302 JTI_SHORT_ARRAY_VTABLE,
303 JTI_INT_ARRAY_VTABLE,
304 JTI_LONG_ARRAY_VTABLE,
305 JTI_FLOAT_ARRAY_VTABLE,
306 JTI_DOUBLE_ARRAY_VTABLE,
307 JTI_TYPE_IDENTIFIER_NODE,
308 JTI_INIT_IDENTIFIER_NODE,
309 JTI_CLINIT_IDENTIFIER_NODE,
310 JTI_FINIT_IDENTIFIER_NODE,
6eb95932 311 JTI_INSTINIT_IDENTIFIER_NODE,
48c9f822 312 JTI_VOID_SIGNATURE_NODE,
313 JTI_LENGTH_IDENTIFIER_NODE,
a8f5ddb8 314 JTI_FINALIZE_IDENTIFIER_NODE,
48c9f822 315 JTI_THIS_IDENTIFIER_NODE,
316 JTI_SUPER_IDENTIFIER_NODE,
317 JTI_CONTINUE_IDENTIFIER_NODE,
318 JTI_ACCESS0_IDENTIFIER_NODE,
efcda118 319 JTI_CLASSDOLLAR_IDENTIFIER_NODE,
48c9f822 320 JTI_ONE_ELT_ARRAY_DOMAIN_TYPE,
321
322 JTI_RETURN_ADDRESS_TYPE_NODE,
323
324 JTI_BOOLEAN_TRUE_NODE,
325 JTI_BOOLEAN_FALSE_NODE,
326
327 JTI_LONG_ZERO_NODE,
328 JTI_FLOAT_ZERO_NODE,
329 JTI_DOUBLE_ZERO_NODE,
48c9f822 330 JTI_INTEGER_TWO_NODE,
331 JTI_INTEGER_FOUR_NODE,
332 JTI_EMPTY_STMT_NODE,
333
334 JTI_METHODTABLE_TYPE,
335 JTI_METHODTABLE_PTR_TYPE,
336
337 JTI_UTF8CONST_TYPE,
338 JTI_UTF8CONST_PTR_TYPE,
339
340 JTI_CLASS_TYPE_NODE,
341 JTI_CLASS_PTR_TYPE,
342 JTI_FIELD_TYPE_NODE,
343 JTI_CONSTANTS_TYPE_NODE,
344 JTI_DTABLE_TYPE,
345 JTI_DTABLE_PTR_TYPE,
346 JTI_FIELD_PTR_TYPE_NODE,
347 JTI_FIELD_INFO_UNION_NODE,
348 JTI_EXCEPTION_TYPE,
349 JTI_EXCEPTION_PTR_TYPE,
350 JTI_LINENUMBERENTRY_TYPE,
351 JTI_LINENUMBERS_TYPE,
352 JTI_METHOD_TYPE_NODE,
353 JTI_METHOD_PTR_TYPE_NODE,
bee0e6ed 354 JTI_OTABLE_TYPE,
355 JTI_OTABLE_PTR_TYPE,
356 JTI_METHOD_SYMBOL_TYPE,
357 JTI_METHOD_SYMBOLS_ARRAY_TYPE,
358 JTI_METHOD_SYMBOLS_ARRAY_PTR_TYPE,
48c9f822 359
360 JTI_END_PARAMS_NODE,
361
d3ab4940 362 JTI_THROW_NODE,
48c9f822 363 JTI_ALLOC_OBJECT_NODE,
a8f5ddb8 364 JTI_ALLOC_NO_FINALIZER_NODE,
48c9f822 365 JTI_SOFT_INSTANCEOF_NODE,
366 JTI_SOFT_CHECKCAST_NODE,
367 JTI_SOFT_INITCLASS_NODE,
368 JTI_SOFT_NEWARRAY_NODE,
369 JTI_SOFT_ANEWARRAY_NODE,
370 JTI_SOFT_MULTIANEWARRAY_NODE,
371 JTI_SOFT_BADARRAYINDEX_NODE,
372 JTI_SOFT_NULLPOINTER_NODE,
373 JTI_SOFT_CHECKARRAYSTORE_NODE,
374 JTI_SOFT_MONITORENTER_NODE,
375 JTI_SOFT_MONITOREXIT_NODE,
376 JTI_SOFT_LOOKUPINTERFACEMETHOD_NODE,
377 JTI_SOFT_LOOKUPJNIMETHOD_NODE,
378 JTI_SOFT_GETJNIENVNEWFRAME_NODE,
379 JTI_SOFT_JNIPOPSYSTEMFRAME_NODE,
380 JTI_SOFT_FMOD_NODE,
48c9f822 381 JTI_SOFT_IDIV_NODE,
382 JTI_SOFT_IREM_NODE,
383 JTI_SOFT_LDIV_NODE,
384 JTI_SOFT_LREM_NODE,
385
386 JTI_ACCESS_FLAGS_TYPE_NODE,
387
48c9f822 388 JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE,
389
390 JTI_WFL_OPERATOR,
391 JTI_CURRENT_CONSTANT_POOL_DATA_REF,
392
393 JTI_MAIN_CLASS,
394 JTI_CURRENT_CLASS,
395 JTI_ALL_CLASS_LIST,
46fde5eb 396 JTI_ALL_CLASS_FILENAME,
48c9f822 397
bee0e6ed 398 JTI_OTABLE_METHODS,
399 JTI_OTABLE_DECL,
400 JTI_OTABLE_SYMS_DECL,
401
fcffb974 402 JTI_PREDEF_FILENAMES,
403
48c9f822 404 JTI_MAX
405};
406
1f3233d1 407extern GTY(()) tree java_global_trees[JTI_MAX];
48c9f822 408
377029eb 409/* "Promoted types" that are used for primitive types smaller
410 than int. We could use int_type_node, but then we would lose
411 type information (such as needed for debugging). */
48c9f822 412#define promoted_byte_type_node \
413 java_global_trees[JTI_PROMOTED_BYTE_TYPE_NODE]
414#define promoted_short_type_node \
415 java_global_trees[JTI_PROMOTED_SHORT_TYPE_NODE]
416#define promoted_char_type_node \
417 java_global_trees[JTI_PROMOTED_CHAR_TYPE_NODE]
418#define promoted_boolean_type_node \
419 java_global_trees[JTI_PROMOTED_BOOLEAN_TYPE_NODE]
420
421#define byte_type_node \
422 java_global_trees[JTI_BYTE_TYPE_NODE]
423#define short_type_node \
424 java_global_trees[JTI_SHORT_TYPE_NODE]
425#define int_type_node \
426 java_global_trees[JTI_INT_TYPE_NODE]
427#define long_type_node \
428 java_global_trees[JTI_LONG_TYPE_NODE]
429
430#define unsigned_byte_type_node \
431 java_global_trees[JTI_UNSIGNED_BYTE_TYPE_NODE]
432#define unsigned_short_type_node \
433 java_global_trees[JTI_UNSIGNED_SHORT_TYPE_NODE]
434#define unsigned_int_type_node \
435 java_global_trees[JTI_UNSIGNED_INT_TYPE_NODE]
436#define unsigned_long_type_node \
437 java_global_trees[JTI_UNSIGNED_LONG_TYPE_NODE]
438
439#define boolean_type_node \
440 java_global_trees[JTI_BOOLEAN_TYPE_NODE]
441
442#define object_type_node \
443 java_global_trees[JTI_OBJECT_TYPE_NODE]
444#define unqualified_object_id_node \
445 java_global_trees[JTI_UNQUALIFIED_OBJECT_ID_NODE]
446#define object_ptr_type_node \
447 java_global_trees[JTI_OBJECT_PTR_TYPE_NODE]
448#define string_type_node \
449 java_global_trees[JTI_STRING_TYPE_NODE]
450#define string_ptr_type_node \
451 java_global_trees[JTI_STRING_PTR_TYPE_NODE]
452#define throwable_type_node \
453 java_global_trees[JTI_THROWABLE_TYPE_NODE]
6eb95932 454#define exception_type_node \
455 java_global_trees[JTI_EXCEPTION_TYPE_NODE]
48c9f822 456#define runtime_exception_type_node \
457 java_global_trees[JTI_RUNTIME_EXCEPTION_TYPE_NODE]
458#define error_exception_type_node \
459 java_global_trees[JTI_ERROR_EXCEPTION_TYPE_NODE]
460#define rawdata_ptr_type_node \
461 java_global_trees[JTI_RAWDATA_PTR_TYPE_NODE]
6eb95932 462#define class_not_found_type_node \
463 java_global_trees[JTI_CLASS_NOT_FOUND_TYPE_NODE]
464#define no_class_def_found_type_node \
465 java_global_trees[JTI_NO_CLASS_DEF_FOUND_TYPE_NODE]
48c9f822 466
467#define byte_array_type_node \
468 java_global_trees[JTI_BYTE_ARRAY_TYPE_NODE]
469#define short_array_type_node \
470 java_global_trees[JTI_SHORT_ARRAY_TYPE_NODE]
471#define int_array_type_node \
472 java_global_trees[JTI_INT_ARRAY_TYPE_NODE]
473#define long_array_type_node \
474 java_global_trees[JTI_LONG_ARRAY_TYPE_NODE]
475#define boolean_array_type_node \
476 java_global_trees[JTI_BOOLEAN_ARRAY_TYPE_NODE]
477#define char_array_type_node \
478 java_global_trees[JTI_CHAR_ARRAY_TYPE_NODE]
479#define double_array_type_node \
480 java_global_trees[JTI_DOUBLE_ARRAY_TYPE_NODE]
481#define float_array_type_node \
482 java_global_trees[JTI_FLOAT_ARRAY_TYPE_NODE]
483#define array_array_type_node \
484 java_global_trees[JTI_ARRAY_ARRAY_TYPE_NODE]
485#define object_array_type_node \
486 java_global_trees[JTI_OBJECT_ARRAY_TYPE_NODE]
487#define string_array_type_node \
488 java_global_trees[JTI_STRING_ARRAY_TYPE_NODE]
489#define boolean_array_vtable \
490 java_global_trees[JTI_BOOLEAN_ARRAY_VTABLE]
491#define byte_array_vtable \
492 java_global_trees[JTI_BYTE_ARRAY_VTABLE]
493#define char_array_vtable \
494 java_global_trees[JTI_CHAR_ARRAY_VTABLE]
495#define short_array_vtable \
496 java_global_trees[JTI_SHORT_ARRAY_VTABLE]
497#define int_array_vtable \
498 java_global_trees[JTI_INT_ARRAY_VTABLE]
499#define long_array_vtable \
500 java_global_trees[JTI_LONG_ARRAY_VTABLE]
501#define float_array_vtable \
502 java_global_trees[JTI_FLOAT_ARRAY_VTABLE]
503#define double_array_vtable \
504 java_global_trees[JTI_DOUBLE_ARRAY_VTABLE]
505#define TYPE_identifier_node \
506 java_global_trees[JTI_TYPE_IDENTIFIER_NODE] /* "TYPE" */
507#define init_identifier_node \
508 java_global_trees[JTI_INIT_IDENTIFIER_NODE] /* "<init>" */
509#define clinit_identifier_node \
510 java_global_trees[JTI_CLINIT_IDENTIFIER_NODE] /* "<clinit>" */
511#define finit_identifier_node \
512 java_global_trees[JTI_FINIT_IDENTIFIER_NODE] /* "finit$" */
2d87a73a 513/* FIXME "instinit$" and "finit$" should be merged */
6eb95932 514#define instinit_identifier_node \
515 java_global_trees[JTI_INSTINIT_IDENTIFIER_NODE] /* "instinit$" */
48c9f822 516#define void_signature_node \
517 java_global_trees[JTI_VOID_SIGNATURE_NODE] /* "()V" */
518#define length_identifier_node \
519 java_global_trees[JTI_LENGTH_IDENTIFIER_NODE] /* "length" */
a8f5ddb8 520#define finalize_identifier_node \
521 java_global_trees[JTI_FINALIZE_IDENTIFIER_NODE] /* "finalize" */
48c9f822 522#define this_identifier_node \
523 java_global_trees[JTI_THIS_IDENTIFIER_NODE] /* "this" */
524#define super_identifier_node \
525 java_global_trees[JTI_SUPER_IDENTIFIER_NODE] /* "super" */
526#define continue_identifier_node \
527 java_global_trees[JTI_CONTINUE_IDENTIFIER_NODE] /* "continue" */
528#define access0_identifier_node \
529 java_global_trees[JTI_ACCESS0_IDENTIFIER_NODE] /* "access$0" */
efcda118 530#define classdollar_identifier_node \
531 java_global_trees[JTI_CLASSDOLLAR_IDENTIFIER_NODE] /* "class$" */
48c9f822 532#define one_elt_array_domain_type \
533 java_global_trees[JTI_ONE_ELT_ARRAY_DOMAIN_TYPE]
377029eb 534/* The type of the return address of a subroutine. */
48c9f822 535#define return_address_type_node \
536 java_global_trees[JTI_RETURN_ADDRESS_TYPE_NODE]
377029eb 537
538/* Nodes for boolean constants TRUE and FALSE. */
48c9f822 539#define boolean_true_node \
540 java_global_trees[JTI_BOOLEAN_TRUE_NODE]
541#define boolean_false_node \
542 java_global_trees[JTI_BOOLEAN_FALSE_NODE]
377029eb 543
544/* Integer constants not declared in tree.h. */
48c9f822 545#define long_zero_node \
546 java_global_trees[JTI_LONG_ZERO_NODE]
547#define float_zero_node \
548 java_global_trees[JTI_FLOAT_ZERO_NODE]
549#define double_zero_node \
550 java_global_trees[JTI_DOUBLE_ZERO_NODE]
48c9f822 551#define integer_two_node \
552 java_global_trees[JTI_INTEGER_TWO_NODE]
553#define integer_four_node \
554 java_global_trees[JTI_INTEGER_FOUR_NODE]
555#define empty_stmt_node \
556 java_global_trees[JTI_EMPTY_STMT_NODE]
377029eb 557
558/* The type for struct methodtable. */
48c9f822 559#define methodtable_type \
560 java_global_trees[JTI_METHODTABLE_TYPE]
561#define methodtable_ptr_type \
562 java_global_trees[JTI_METHODTABLE_PTR_TYPE]
563
564#define utf8const_type \
565 java_global_trees[JTI_UTF8CONST_TYPE]
566#define utf8const_ptr_type \
567 java_global_trees[JTI_UTF8CONST_PTR_TYPE]
568
569#define class_type_node \
570 java_global_trees[JTI_CLASS_TYPE_NODE]
571#define class_ptr_type \
572 java_global_trees[JTI_CLASS_PTR_TYPE]
573#define field_type_node \
574 java_global_trees[JTI_FIELD_TYPE_NODE]
575#define constants_type_node \
576 java_global_trees[JTI_CONSTANTS_TYPE_NODE]
577#define dtable_type \
578 java_global_trees[JTI_DTABLE_TYPE]
579#define dtable_ptr_type \
580 java_global_trees[JTI_DTABLE_PTR_TYPE]
581#define field_ptr_type_node \
582 java_global_trees[JTI_FIELD_PTR_TYPE_NODE]
583#define field_info_union_node \
584 java_global_trees[JTI_FIELD_INFO_UNION_NODE]
585#define jexception_type \
586 java_global_trees[JTI_EXCEPTION_TYPE]
587#define jexception_ptr_type \
588 java_global_trees[JTI_EXCEPTION_PTR_TYPE]
589#define lineNumberEntry_type \
590 java_global_trees[JTI_LINENUMBERENTRY_TYPE]
591#define lineNumbers_type \
592 java_global_trees[JTI_LINENUMBERS_TYPE]
593#define method_type_node \
594 java_global_trees[JTI_METHOD_TYPE_NODE]
595#define method_ptr_type_node \
596 java_global_trees[JTI_METHOD_PTR_TYPE_NODE]
bee0e6ed 597#define otable_type \
598 java_global_trees[JTI_OTABLE_TYPE]
599#define otable_ptr_type \
600 java_global_trees[JTI_OTABLE_PTR_TYPE]
601#define method_symbol_type \
602 java_global_trees[JTI_METHOD_SYMBOL_TYPE]
603#define method_symbols_array_type \
604 java_global_trees[JTI_METHOD_SYMBOLS_ARRAY_TYPE]
605#define method_symbols_array_ptr_type \
606 java_global_trees[JTI_METHOD_SYMBOLS_ARRAY_PTR_TYPE]
48c9f822 607
608#define end_params_node \
609 java_global_trees[JTI_END_PARAMS_NODE]
53bfc53e 610
377029eb 611/* References to internal libjava functions we use. */
d3ab4940 612#define throw_node \
613 java_global_trees[JTI_THROW_NODE]
48c9f822 614#define alloc_object_node \
615 java_global_trees[JTI_ALLOC_OBJECT_NODE]
a8f5ddb8 616#define alloc_no_finalizer_node \
617 java_global_trees[JTI_ALLOC_NO_FINALIZER_NODE]
48c9f822 618#define soft_instanceof_node \
619 java_global_trees[JTI_SOFT_INSTANCEOF_NODE]
620#define soft_checkcast_node \
621 java_global_trees[JTI_SOFT_CHECKCAST_NODE]
622#define soft_initclass_node \
623 java_global_trees[JTI_SOFT_INITCLASS_NODE]
624#define soft_newarray_node \
625 java_global_trees[JTI_SOFT_NEWARRAY_NODE]
626#define soft_anewarray_node \
627 java_global_trees[JTI_SOFT_ANEWARRAY_NODE]
628#define soft_multianewarray_node \
629 java_global_trees[JTI_SOFT_MULTIANEWARRAY_NODE]
630#define soft_badarrayindex_node \
631 java_global_trees[JTI_SOFT_BADARRAYINDEX_NODE]
632#define soft_nullpointer_node \
633 java_global_trees[JTI_SOFT_NULLPOINTER_NODE]
48c9f822 634#define soft_checkarraystore_node \
635 java_global_trees[JTI_SOFT_CHECKARRAYSTORE_NODE]
636#define soft_monitorenter_node \
637 java_global_trees[JTI_SOFT_MONITORENTER_NODE]
638#define soft_monitorexit_node \
639 java_global_trees[JTI_SOFT_MONITOREXIT_NODE]
640#define soft_lookupinterfacemethod_node \
641 java_global_trees[JTI_SOFT_LOOKUPINTERFACEMETHOD_NODE]
642#define soft_lookupjnimethod_node \
643 java_global_trees[JTI_SOFT_LOOKUPJNIMETHOD_NODE]
644#define soft_getjnienvnewframe_node \
645 java_global_trees[JTI_SOFT_GETJNIENVNEWFRAME_NODE]
646#define soft_jnipopsystemframe_node \
647 java_global_trees[JTI_SOFT_JNIPOPSYSTEMFRAME_NODE]
648#define soft_fmod_node \
649 java_global_trees[JTI_SOFT_FMOD_NODE]
48c9f822 650#define soft_idiv_node \
651 java_global_trees[JTI_SOFT_IDIV_NODE]
652#define soft_irem_node \
653 java_global_trees[JTI_SOFT_IREM_NODE]
654#define soft_ldiv_node \
655 java_global_trees[JTI_SOFT_LDIV_NODE]
656#define soft_lrem_node \
657 java_global_trees[JTI_SOFT_LREM_NODE]
658
659#define access_flags_type_node \
660 java_global_trees[JTI_ACCESS_FLAGS_TYPE_NODE]
661
48c9f822 662#define nativecode_ptr_array_type_node \
663 java_global_trees[JTI_NATIVECODE_PTR_ARRAY_TYPE_NODE]
664
fcffb974 665#define predef_filenames \
666 java_global_trees[JTI_PREDEF_FILENAMES]
48c9f822 667
668#define nativecode_ptr_type_node ptr_type_node
377029eb 669
670/* They need to be reset before processing each class */
671extern struct CPool *outgoing_cpool;
48c9f822 672/* If non-NULL, an ADDR_EXPR referencing a VAR_DECL containing
673 the constant data array for the current class. */
674#define current_constant_pool_data_ref \
675 java_global_trees[JTI_CURRENT_CONSTANT_POOL_DATA_REF]
377029eb 676
48c9f822 677#define wfl_operator \
678 java_global_trees[JTI_WFL_OPERATOR]
377029eb 679
ec96e4ed 680extern const char *cyclic_inheritance_report;
4654e794 681
1f3233d1 682struct lang_identifier GTY(())
377029eb 683{
684 struct tree_identifier ignore;
1f3233d1 685 tree global_value;
686 tree local_value;
377029eb 687
688 /* If non-NULL: An ADDR_REF to a VAR_DECL that contains
689 * the Utf8Const representation of the identifier. */
690 tree utf8_ref;
691};
692
1f3233d1 693/* The resulting tree type. */
694union lang_tree_node
695 GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE")))
696{
697 union tree_node GTY ((tag ("0"),
698 desc ("tree_node_structure (&%h)")))
699 generic;
700 struct lang_identifier GTY ((tag ("1"))) identifier;
701};
702
377029eb 703/* Macros for access to language-specific slots in an identifier. */
4c8cd415 704/* Unless specified, each of these slots contains a DECL node or null. */
377029eb 705
706/* This represents the value which the identifier has in the
707 file-scope namespace. */
708#define IDENTIFIER_GLOBAL_VALUE(NODE) \
709 (((struct lang_identifier *)(NODE))->global_value)
710/* This represents the value which the identifier has in the current
711 scope. */
712#define IDENTIFIER_LOCAL_VALUE(NODE) \
713 (((struct lang_identifier *)(NODE))->local_value)
714
715/* Given an identifier NODE, get the corresponding (non-handle) class.
716 For get_identifier ("java.lang.Number"), the result is
717 the struct whose DECL_ASSEMBLER_NAME is "Classjava_lang_Number". */
718#define IDENTIFIER_CLASS_VALUE(NODE) IDENTIFIER_GLOBAL_VALUE(NODE)
719
720/* Given an identifier NODE, get the corresponding handle class.
721 For get_identifier ("java.lang.Number"), the result is
722 the struct whose DECL_ASSEMBLER_NAME is "Hjava_lang_Number". */
723#define IDENTIFIER_HANDLECLASS_VALUE(NODE) ???
724
725/* Given a signature of a reference (or array) type, or a method, return the
726 corresponding type (if one has been allocated).
727 Do not use for primitive types, since they may be ambiguous.
728 (E.g. is "I" a signature or a class name?) */
729#define IDENTIFIER_SIGNATURE_TYPE(NODE) IDENTIFIER_GLOBAL_VALUE(NODE)
730
731/* If non-NULL: An ADDR_REF to a VAR_DECL that contains
732 the Utf8Const representation of the identifier. */
733#define IDENTIFIER_UTF8_REF(NODE) \
734 (((struct lang_identifier *)(NODE))->utf8_ref)
735
736#define IDENTIFIER_UTF8_DECL(NODE) \
737 TREE_OPERAND((((struct lang_identifier *)(NODE))->utf8_ref), 0)
738
739/* For a FUNCTION_DECL, if we are compiling a .class file, then this is
740 the position in the .class file of the method code.
741 Specifically, this is the code itself, not the code attribute. */
1f3233d1 742#define DECL_CODE_OFFSET(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.code_offset)
377029eb 743/* Similarly, the length of the bytecode. */
1f3233d1 744#define DECL_CODE_LENGTH(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.code_length)
377029eb 745/* Similarly, the position of the LineNumberTable attribute. */
746#define DECL_LINENUMBERS_OFFSET(DECL) \
1f3233d1 747 (DECL_LANG_SPECIFIC(DECL)->u.f.linenumbers_offset)
377029eb 748/* Similarly, the position of the LocalVariableTable attribute
749 (following the standard attribute header). */
750#define DECL_LOCALVARIABLES_OFFSET(DECL) \
1f3233d1 751 (DECL_LANG_SPECIFIC(DECL)->u.f.localvariables_offset)
377029eb 752
1f3233d1 753#define DECL_MAX_LOCALS(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.max_locals)
754#define DECL_MAX_STACK(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.max_stack)
377029eb 755/* Number of local variable slots needed for the arguments of this function. */
1f3233d1 756#define DECL_ARG_SLOT_COUNT(DECL) \
757 (DECL_LANG_SPECIFIC(DECL)->u.f.arg_slot_count)
cbce943b 758/* Information on declaration location */
1f3233d1 759#define DECL_FUNCTION_WFL(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.wfl)
f757ce2b 760/* List of checked thrown exceptions, as specified with the `throws'
761 keyword */
1f3233d1 762#define DECL_FUNCTION_THROWS(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.throws_list)
a31ac40f 763/* List of other constructors of the same class that this constructor
764 calls */
765#define DECL_CONSTRUCTOR_CALLS(DECL) \
1f3233d1 766 (DECL_LANG_SPECIFIC(DECL)->u.f.called_constructor)
4654e794 767/* When the function is an access function, the DECL it was trying to
768 access */
769#define DECL_FUNCTION_ACCESS_DECL(DECL) \
1f3233d1 770 (DECL_LANG_SPECIFIC(DECL)->u.f.called_constructor)
4654e794 771/* The identifier of the access method used to invoke this method from
772 an inner class. */
773#define DECL_FUNCTION_INNER_ACCESS(DECL) \
1f3233d1 774 (DECL_LANG_SPECIFIC(DECL)->u.f.inner_access)
f757ce2b 775/* Pointer to the function's current's COMPOUND_EXPR tree (while
776 completing its body) or the function's block */
1f3233d1 777#define DECL_FUNCTION_BODY(DECL) \
778 (DECL_LANG_SPECIFIC(DECL)->u.f.function_decl_body)
f757ce2b 779/* How specific the function is (for method selection - Java source
780 code front-end */
b8f64b70 781#define DECL_SPECIFIC_COUNT(DECL) DECL_ARG_SLOT_COUNT(DECL)
9215cfa3 782/* For each function decl, init_test_table contains a hash table whose
783 entries are keyed on class names, and whose values are local
784 boolean decls. The variables are intended to be TRUE when the
785 class has been initialized in this function, and FALSE otherwise. */
786#define DECL_FUNCTION_INIT_TEST_TABLE(DECL) \
1f3233d1 787 (DECL_LANG_SPECIFIC(DECL)->u.f.init_test_table)
160eb709 788/* If LOCAL_CLASS_INITIALIZATION_FLAG_P(decl), give class it initializes. */
789#define DECL_FUNCTION_INIT_TEST_CLASS(DECL) \
1f3233d1 790 (DECL_LANG_SPECIFIC(DECL)->u.v.slot_chain)
eb47970b 791/* For each static function decl, itc contains a hash table whose
792 entries are keyed on class named that are definitively initialized
793 in DECL. */
794#define DECL_FUNCTION_INITIALIZED_CLASS_TABLE(DECL) \
1f3233d1 795 (DECL_LANG_SPECIFIC(DECL)->u.f.ict)
160eb709 796/* A list of all the static method calls in the method DECL (if optimizing).
797 Actually each TREE_VALUE points to a COMPONT_EXPR that wraps the
798 invoation so we can later patch it. */
eb47970b 799#define DECL_FUNCTION_STATIC_METHOD_INVOCATION_COMPOUND(DECL) \
1f3233d1 800 (DECL_LANG_SPECIFIC(DECL)->u.f.smic)
4654e794 801/* The Number of Artificial Parameters (NAP) DECL contains. this$<n>
802 is excluded, because sometimes created as a parameter before the
803 function decl exists. */
1f3233d1 804#define DECL_FUNCTION_NAP(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.nap)
146d1460 805/* True if DECL is a synthetic ctor. */
806#define DECL_FUNCTION_SYNTHETIC_CTOR(DECL) \
1f3233d1 807 (DECL_LANG_SPECIFIC(DECL)->u.f.synthetic_ctor)
808#define DECL_FIXED_CONSTRUCTOR_P(DECL) \
809 (DECL_LANG_SPECIFIC(DECL)->u.f.fixed_ctor)
4654e794 810
2d87a73a 811/* A constructor that calls this. */
1f3233d1 812#define DECL_INIT_CALLS_THIS(DECL) \
813 (DECL_LANG_SPECIFIC(DECL)->u.f.init_calls_this)
2d87a73a 814
4654e794 815/* True when DECL aliases an outer context local variable. */
816#define FIELD_LOCAL_ALIAS(DECL) DECL_LANG_FLAG_6 (DECL)
817
818/* True when DECL, which aliases an outer context local variable is
819 used by the inner classe */
820#define FIELD_LOCAL_ALIAS_USED(DECL) DECL_LANG_FLAG_7 (DECL)
821
822/* True when DECL is a this$<n> field. Note that
823 FIELD_LOCAL_ALIAS_USED can be differenciated when tested against
824 FIELD_LOCAL_ALIAS. */
825#define FIELD_THISN(DECL) DECL_LANG_FLAG_7 (DECL)
377029eb 826
827/* In a LABEL_DECL, a TREE_VEC that saves the type_map at that point. */
828#define LABEL_TYPE_STATE(NODE) (DECL_INITIAL (NODE))
829
830/* In the label of a subroutine, a dummy label that records the
831 state following a merge of all the ret instructions in this subroutine. */
832#define LABEL_RETURN_LABEL(DECL) DECL_ARGUMENTS(DECL)
833
834/* In the label of a sub-routine, records the type state at return.
835 * A local may be TYPE_UNUSED, which means that the local is not
836 * used (stored to or loaded from) in this subroutine - at least for
837 * code that we have verified so far. */
838#define LABEL_RETURN_TYPE_STATE(NODE) LABEL_TYPE_STATE (LABEL_RETURN_LABEL (NODE))
839
840/* In a TREE_VEC for a LABEL_RETURN_TYPE_STATE, notes that
e722e1a8 841 TREE_VEC_LENGTH has been adjusted to the correct stack size. */
377029eb 842#define RETURN_MAP_ADJUSTED(NODE) TREE_LANG_FLAG_2(NODE)
843
844/* In the label of a sub-routine, a chain of the return location labels. */
30d247b2 845#define LABEL_RETURN_LABELS(node) \
846 (LABEL_DECL_CHECK (LABEL_RETURN_LABEL(node))->decl.result)
377029eb 847
848/* In a LABEL_DECL, the next pending label.
849 See pending_blocks in expr.c. */
30d247b2 850#define LABEL_PENDING_CHAIN(NODE) (LABEL_DECL_CHECK (NODE)->decl.result)
377029eb 851
852/* In a LABEL_DECL, the corresponding bytecode program counter. */
ab7943b9 853#define LABEL_PC(NODE) ((NODE)->decl.u2.i)
377029eb 854
855/* Used during verification to mark the label has "changed". (See JVM Spec). */
856#define LABEL_CHANGED(NODE) DECL_LANG_FLAG_6(NODE)
857
858/* In a LABEL_DECL, true if we have verified instructions starting here. */
859#define LABEL_VERIFIED(NODE) (instruction_bits[LABEL_PC(NODE)]&BCODE_VERIFIED)
860
861/* True if this code is within a subroutine (target of a jsr). */
862#define LABEL_IN_SUBR(NODE) DECL_LANG_FLAG_4(NODE)
863/* True if this code is the start of a subroutine (target of a jsr). */
864#define LABEL_IS_SUBR_START(NODE) DECL_LANG_FLAG_5(NODE)
865
866/* In a LABEL_DECL, if LABEL_IN_SUBR(NODE), points to start of subroutine. */
867#define LABEL_SUBR_START(NODE) DECL_ABSTRACT_ORIGIN(NODE)
868
869/* In a LABEL_DECL that has LABEL_IS_SUBR_START, this points to the start
870 of surrounding subroutine in the case of a nested subroutine,
871 and NULL_TREE otherwise. */
872#define LABEL_SUBR_CONTEXT(NODE) DECL_CONTEXT (LABEL_RETURN_LABEL (NODE))
873
874/* The slot number for this local variable. */
875#define DECL_LOCAL_SLOT_NUMBER(NODE) \
1f3233d1 876 (DECL_LANG_SPECIFIC(NODE)->u.v.slot_number)
377029eb 877/* The start (bytecode) pc for the valid range of this local variable. */
878#define DECL_LOCAL_START_PC(NODE) \
1f3233d1 879 (DECL_LANG_SPECIFIC(NODE)->u.v.start_pc)
377029eb 880/* The end (bytecode) pc for the valid range of this local variable. */
881#define DECL_LOCAL_END_PC(NODE) \
1f3233d1 882 (DECL_LANG_SPECIFIC(NODE)->u.v.end_pc)
377029eb 883/* For a VAR_DECLor PARM_DECL, used to chain decls with the same
884 slot_number in decl_map. */
885#define DECL_LOCAL_SLOT_CHAIN(NODE) \
1f3233d1 886 (DECL_LANG_SPECIFIC(NODE)->u.v.slot_chain)
146d1460 887/* For a FIELD_DECL, holds the name of the access method. Used to
888 read/write the content of the field from an inner class. */
889#define FIELD_INNER_ACCESS(DECL) \
1f3233d1 890 (DECL_LANG_SPECIFIC(DECL)->u.v.am)
146d1460 891/* Safely tests whether FIELD_INNER_ACCESS exists or not. */
892#define FIELD_INNER_ACCESS_P(DECL) \
893 DECL_LANG_SPECIFIC (DECL) && FIELD_INNER_ACCESS (DECL)
2d87a73a 894/* True if a final variable was initialized upon its declaration,
895 or (if a field) in an initializer. Set after definite assignment. */
146d1460 896#define DECL_FIELD_FINAL_IUD(NODE) \
1f3233d1 897 (DECL_LANG_SPECIFIC(NODE)->u.v.final_iud)
146d1460 898/* The original WFL of a final variable. */
899#define DECL_FIELD_FINAL_WFL(NODE) \
1f3233d1 900 (DECL_LANG_SPECIFIC(NODE)->u.v.wfl)
2d87a73a 901/* True if NODE is a local variable final. */
902#define LOCAL_FINAL_P(NODE) (DECL_LANG_SPECIFIC (NODE) && DECL_FINAL (NODE))
903/* True if NODE is a final field. */
146d1460 904#define FINAL_VARIABLE_P(NODE) (FIELD_FINAL (NODE) && !FIELD_STATIC (NODE))
2d87a73a 905/* True if NODE is a class final field. */
146d1460 906#define CLASS_FINAL_VARIABLE_P(NODE) \
907 (FIELD_FINAL (NODE) && FIELD_STATIC (NODE))
eb47970b 908/* True if NODE is a class initialization flag. This macro accesses
909 the flag to read or set it. */
910#define LOCAL_CLASS_INITIALIZATION_FLAG(NODE) \
1f3233d1 911 (DECL_LANG_SPECIFIC(NODE)->u.v.cif)
eb47970b 912/* True if NODE is a class initialization flag. */
913#define LOCAL_CLASS_INITIALIZATION_FLAG_P(NODE) \
914 (DECL_LANG_SPECIFIC (NODE) && LOCAL_CLASS_INITIALIZATION_FLAG(NODE))
146d1460 915/* Create a DECL_LANG_SPECIFIC if necessary. */
916#define MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC(T) \
917 if (DECL_LANG_SPECIFIC (T) == NULL) \
918 { \
919 DECL_LANG_SPECIFIC ((T)) \
920 = ((struct lang_decl *) \
1f3233d1 921 ggc_alloc_cleared (sizeof (struct lang_decl))); \
922 DECL_LANG_SPECIFIC (T)->desc = LANG_DECL_VAR; \
146d1460 923 }
377029eb 924
43a20035 925/* A ConstantExpression, after folding and name resolution. */
926#define CONSTANT_VALUE_P(NODE) \
927 (TREE_CODE (NODE) == STRING_CST \
928 || (TREE_CODE (NODE) == INTEGER_CST \
929 && TREE_CODE (TREE_TYPE (NODE)) != POINTER_TYPE) \
930 || TREE_CODE (NODE) == REAL_CST)
931
9215cfa3 932/* For a local VAR_DECL, holds the index into a words bitstring that
933 specifies if this decl is definitively assigned.
2d87a73a 934 The value -1 means the variable has been definitely assigned (and not
935 definitely unassigned). The value -2 means we already reported an error. */
936#define DECL_BIT_INDEX(DECL) (DECL_CHECK (DECL)->decl.pointer_alias_set)
9215cfa3 937
377029eb 938/* DECL_LANG_SPECIFIC for FUNCTION_DECLs. */
1f3233d1 939struct lang_decl_func GTY(())
377029eb 940{
941 /* tree chain; not yet used. */
942 long code_offset;
943 int code_length;
944 long linenumbers_offset;
945 long localvariables_offset;
946 int arg_slots;
1f3233d1 947 int max_locals;
948 int max_stack;
949 int arg_slot_count;
cbce943b 950 tree wfl; /* Information on the original location */
f757ce2b 951 tree throws_list; /* Exception specified by `throws' */
377029eb 952 tree function_decl_body; /* Hold all function's statements */
a31ac40f 953 tree called_constructor; /* When decl is a constructor, the
146d1460 954 list of other constructor it calls */
1f3233d1 955
956 /* Class initialization test variables */
957 htab_t GTY ((param_is (struct treetreehash_entry))) init_test_table;
958
959 /* Initialized (static) Class Table */
960 htab_t GTY ((param_is (union tree_node))) ict;
961
160eb709 962 tree smic; /* Static method invocation compound */
4654e794 963 tree inner_access; /* The identifier of the access method
964 used for invocation from inner classes */
965 int nap; /* Number of artificial parameters */
2d87a73a 966 unsigned int native : 1; /* Nonzero if this is a native method */
967 unsigned int synthetic_ctor : 1; /* Nonzero if this is a synthetic ctor */
968 unsigned int init_final : 1; /* Nonzero all finals are initialized */
969 unsigned int fixed_ctor : 1;
970 unsigned int init_calls_this : 1;
4103fd21 971 unsigned int strictfp : 1;
9215cfa3 972};
973
1f3233d1 974struct treetreehash_entry GTY(())
9215cfa3 975{
1f3233d1 976 tree key;
977 tree value;
377029eb 978};
979
1f3233d1 980extern tree java_treetreehash_find PARAMS ((htab_t, tree));
981extern tree * java_treetreehash_new PARAMS ((htab_t, tree));
982extern htab_t java_treetreehash_create PARAMS ((size_t size, int ggc));
983
146d1460 984/* DECL_LANG_SPECIFIC for VAR_DECL, PARM_DECL and sometimes FIELD_DECL
985 (access methods on outer class fields) and final fields. */
1f3233d1 986struct lang_decl_var GTY(())
377029eb 987{
988 int slot_number;
989 int start_pc;
990 int end_pc;
991 tree slot_chain;
146d1460 992 tree am; /* Access method for this field (1.1) */
993 tree wfl; /* Original wfl */
2d87a73a 994 unsigned int final_iud : 1; /* Final initialized upon declaration */
995 unsigned int cif : 1; /* True: decl is a class initialization flag */
377029eb 996};
997
1f3233d1 998/* This is what 'lang_decl' really points to. */
999
1000enum lang_decl_desc {
1001 LANG_DECL_FUNC,
1002 LANG_DECL_VAR
1003};
1004
1005struct lang_decl GTY(())
1006{
1007 enum lang_decl_desc desc;
1008 union lang_decl_u {
1009 struct lang_decl_func GTY ((tag ("LANG_DECL_FUNC"))) f;
1010 struct lang_decl_var GTY ((tag ("LANG_DECL_VAR"))) v;
1011 } GTY ((desc ("%0.desc"))) u;
1012};
1013
4654e794 1014/* Macro to access fields in `struct lang_type'. */
1015
1016#define TYPE_SIGNATURE(T) (TYPE_LANG_SPECIFIC(T)->signature)
1017#define TYPE_JCF(T) (TYPE_LANG_SPECIFIC(T)->jcf)
1018#define TYPE_CPOOL(T) (TYPE_LANG_SPECIFIC(T)->cpool)
1019#define TYPE_CPOOL_DATA_REF(T) (TYPE_LANG_SPECIFIC(T)->cpool_data_ref)
a4e59c31 1020#define MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC(T) \
1021 if (TYPE_LANG_SPECIFIC ((T)) == NULL) \
1022 { \
1023 TYPE_LANG_SPECIFIC ((T)) = \
1024 ((struct lang_type *) \
1025 ggc_alloc_cleared (sizeof (struct lang_type))); \
4654e794 1026 }
02e7a332 1027
4654e794 1028#define TYPE_FINIT_STMT_LIST(T) (TYPE_LANG_SPECIFIC(T)->finit_stmt_list)
1029#define TYPE_CLINIT_STMT_LIST(T) (TYPE_LANG_SPECIFIC(T)->clinit_stmt_list)
1030#define TYPE_II_STMT_LIST(T) (TYPE_LANG_SPECIFIC(T)->ii_block)
bc251a21 1031/* The decl of the synthetic method `class$' used to handle `.class'
1032 for non primitive types when compiling to bytecode. */
1033#define TYPE_DOT_CLASS(T) (TYPE_LANG_SPECIFIC(T)->dot_class)
6599bf3a 1034#define TYPE_PACKAGE_LIST(T) (TYPE_LANG_SPECIFIC(T)->package_list)
6c52fdf8 1035#define TYPE_IMPORT_LIST(T) (TYPE_LANG_SPECIFIC(T)->import_list)
1036#define TYPE_IMPORT_DEMAND_LIST(T) (TYPE_LANG_SPECIFIC(T)->import_demand_list)
9744ddf1 1037#define TYPE_PRIVATE_INNER_CLASS(T) (TYPE_LANG_SPECIFIC(T)->pic)
6175855a 1038#define TYPE_PROTECTED_INNER_CLASS(T) (TYPE_LANG_SPECIFIC(T)->poic)
4103fd21 1039#define TYPE_STRICTFP(T) (TYPE_LANG_SPECIFIC(T)->strictfp)
4654e794 1040
1f3233d1 1041struct lang_type GTY(())
377029eb 1042{
1043 tree signature;
1f3233d1 1044 struct JCF * GTY ((skip (""))) jcf;
1045 struct CPool * GTY ((skip (""))) cpool;
4654e794 1046 tree cpool_data_ref; /* Cached */
78402341 1047 tree finit_stmt_list; /* List of statements finit$ will use */
4654e794 1048 tree clinit_stmt_list; /* List of statements <clinit> will use */
1049 tree ii_block; /* Instance initializer block */
bc251a21 1050 tree dot_class; /* The decl of the `class$' function that
1051 needs to be invoked and generated when
1052 compiling to bytecode to implement
1053 <non_primitive_type>.class */
6599bf3a 1054 tree package_list; /* List of package names, progressive */
6c52fdf8 1055 tree import_list; /* Imported types, in the CU of this class */
1056 tree import_demand_list; /* Imported types, in the CU of this class */
9744ddf1 1057 unsigned pic:1; /* Private Inner Class. */
6175855a 1058 unsigned poic:1; /* Protected Inner Class. */
4103fd21 1059 unsigned strictfp:1; /* `strictfp' class. */
377029eb 1060};
1061
1062#ifdef JAVA_USE_HANDLES
1063/* TYPE_BINFO_HANDLE points from a handle-class to its corresponding
1064 non-handle-class, and vice verse. */
1065
1066#define BINFO_HANDLE(NODE) TREE_VEC_ELT ((NODE), 6)
1067
1068/* Given a RECORD_TYPE for a handle type, return the corresponding class. */
1069#define HANDLE_TO_CLASS_TYPE(HTYPE) BINFO_HANDLE (TYPE_BINFO (HTYPE))
1070
1071/* Given a RECORD_TYPE for a class, return the corresponding handle type. */
1072#define CLASS_TO_HANDLE_TYPE(TYPE) BINFO_HANDLE (TYPE_BINFO (TYPE))
1073#else
1074#define HANDLE_TO_CLASS_TYPE(HTYPE) (HTYPE)
1075#define CLASS_TO_HANDLE_TYPE(TYPE) (TYPE)
1076#endif
1077
1078#define JCF_u4 unsigned long
1079#define JCF_u2 unsigned short
1080
1c542e4c 1081extern void java_parse_file PARAMS ((int));
9b86eec0 1082extern bool java_mark_addressable PARAMS ((tree));
771d21fa 1083extern tree java_type_for_mode PARAMS ((enum machine_mode, int));
1084extern tree java_type_for_size PARAMS ((unsigned int, int));
4070745f 1085extern tree java_unsigned_type PARAMS ((tree));
1086extern tree java_signed_type PARAMS ((tree));
1087extern tree java_signed_or_unsigned_type PARAMS ((int, tree));
aff9e656 1088extern tree java_truthvalue_conversion PARAMS ((tree));
fa334f7d 1089extern void add_assume_compiled PARAMS ((const char *, int));
1090extern tree lookup_class PARAMS ((tree));
1091extern tree lookup_java_constructor PARAMS ((tree, tree));
1092extern tree lookup_java_method PARAMS ((tree, tree, tree));
1093extern tree lookup_argument_method PARAMS ((tree, tree, tree));
a536b5f2 1094extern tree lookup_argument_method2 PARAMS ((tree, tree, tree));
83b0a282 1095extern int has_method PARAMS ((tree, tree));
fa334f7d 1096extern tree promote_type PARAMS ((tree));
1097extern tree get_constant PARAMS ((struct JCF*, int));
1098extern tree get_name_constant PARAMS ((struct JCF*, int));
1099extern tree get_class_constant PARAMS ((struct JCF*, int));
1100extern tree parse_signature PARAMS ((struct JCF *jcf, int sig_index));
fa334f7d 1101extern tree add_field PARAMS ((tree, tree, tree, int));
1102extern tree add_method PARAMS ((tree, int, tree, tree));
1103extern tree add_method_1 PARAMS ((tree, int, tree, tree));
1104extern tree make_class PARAMS ((void));
1105extern tree push_class PARAMS ((tree, tree));
1106extern tree unmangle_classname PARAMS ((const char *name, int name_length));
1107extern tree parse_signature_string PARAMS ((const unsigned char *, int));
1108extern tree get_type_from_signature PARAMS ((tree));
1109extern void layout_class PARAMS ((tree));
1110extern tree layout_class_method PARAMS ((tree, tree, tree, tree));
1111extern void layout_class_methods PARAMS ((tree));
1112extern tree build_class_ref PARAMS ((tree));
1113extern tree build_dtable_decl PARAMS ((tree));
1114extern tree build_internal_class_name PARAMS ((tree));
1115extern tree build_constants_constructor PARAMS ((void));
1116extern tree build_ref_from_constant_pool PARAMS ((int));
aec3a886 1117extern void compile_resource_file PARAMS ((char *, const char *));
fa334f7d 1118extern tree build_utf8_ref PARAMS ((tree));
1119extern tree ident_subst PARAMS ((const char*, int,
377029eb 1120 const char*, int, int, const char*));
fa334f7d 1121extern tree identifier_subst PARAMS ((const tree,
377029eb 1122 const char *, int, int, const char *));
20325f61 1123extern int global_bindings_p PARAMS ((void));
1124extern int kept_level_p PARAMS ((void));
1125extern tree getdecls PARAMS ((void));
1126extern void pushlevel PARAMS ((int));
1127extern tree poplevel PARAMS ((int,int, int));
1128extern void insert_block PARAMS ((tree));
1129extern void set_block PARAMS ((tree));
1130extern tree pushdecl PARAMS ((tree));
9ceb1c29 1131extern void java_init_decl_processing PARAMS ((void));
dbc42b78 1132extern void java_dup_lang_specific_decl PARAMS ((tree));
fa334f7d 1133extern tree build_java_signature PARAMS ((tree));
1134extern tree build_java_argument_signature PARAMS ((tree));
1135extern void set_java_signature PARAMS ((tree, tree));
1136extern tree build_static_field_ref PARAMS ((tree));
1137extern tree build_address_of PARAMS ((tree));
1138extern tree find_local_variable PARAMS ((int index, tree type, int pc));
1139extern tree find_stack_slot PARAMS ((int index, tree type));
1140extern tree build_prim_array_type PARAMS ((tree, HOST_WIDE_INT));
1141extern tree build_java_array_type PARAMS ((tree, HOST_WIDE_INT));
1142extern int is_compiled_class PARAMS ((tree));
1143extern tree mangled_classname PARAMS ((const char*, tree));
1144extern tree lookup_label PARAMS ((int));
3e02ce30 1145extern tree pop_type_0 PARAMS ((tree, char**));
fa334f7d 1146extern tree pop_type PARAMS ((tree));
fa334f7d 1147extern tree decode_newarray_type PARAMS ((int));
1148extern tree lookup_field PARAMS ((tree*, tree));
1149extern int is_array_type_p PARAMS ((tree));
1150extern HOST_WIDE_INT java_array_type_length PARAMS ((tree));
1151extern int read_class PARAMS ((tree));
1152extern void load_class PARAMS ((tree, int));
1153
85dce5fa 1154extern tree check_for_builtin PARAMS ((tree, tree));
fcffb974 1155extern void initialize_builtins PARAMS ((void));
1156
fa334f7d 1157extern tree lookup_name PARAMS ((tree));
1158extern tree build_known_method_ref PARAMS ((tree, tree, tree, tree, tree));
1159extern tree build_class_init PARAMS ((tree, tree));
1160extern tree build_invokevirtual PARAMS ((tree, tree));
4095293c 1161extern tree build_invokeinterface PARAMS ((tree, tree));
47efb553 1162extern tree build_jni_stub PARAMS ((tree));
fa334f7d 1163extern tree invoke_build_dtable PARAMS ((int, tree));
1164extern tree build_field_ref PARAMS ((tree, tree, tree));
1165extern void pushdecl_force_head PARAMS ((tree));
1166extern tree build_java_binop PARAMS ((enum tree_code, tree, tree, tree));
1167extern tree build_java_soft_divmod PARAMS ((enum tree_code, tree, tree, tree));
1168extern tree binary_numeric_promotion PARAMS ((tree, tree, tree *, tree *));
1169extern tree build_java_arrayaccess PARAMS ((tree, tree, tree));
c738784c 1170extern tree build_java_arraystore_check PARAMS ((tree, tree));
fa334f7d 1171extern tree build_newarray PARAMS ((int, tree));
1172extern tree build_anewarray PARAMS ((tree, tree));
1173extern tree build_new_array PARAMS ((tree, tree));
1174extern tree build_java_array_length_access PARAMS ((tree));
1175extern tree build_java_arraynull_check PARAMS ((tree, tree, tree));
7d55917c 1176extern tree build_java_indirect_ref PARAMS ((tree, tree, int));
1177extern tree java_check_reference PARAMS ((tree, int));
7b842db5 1178extern tree build_get_class PARAMS ((tree));
1179extern tree build_instanceof PARAMS ((tree, tree));
fa334f7d 1180extern tree create_label_decl PARAMS ((tree));
1181extern void push_labeled_block PARAMS ((tree));
1182extern tree prepare_eh_table_type PARAMS ((tree));
df4b504c 1183extern tree build_exception_object_ref PARAMS ((tree));
fa334f7d 1184extern tree generate_name PARAMS ((void));
1185extern void pop_labeled_block PARAMS ((void));
1186extern const char *lang_printable_name PARAMS ((tree, int));
1187extern tree maybe_add_interface PARAMS ((tree, tree));
1188extern void set_super_info PARAMS ((int, tree, tree, int));
728b4c29 1189extern void set_class_decl_access_flags PARAMS ((int, tree));
fa334f7d 1190extern int get_access_flags_from_decl PARAMS ((tree));
1191extern int interface_of_p PARAMS ((tree, tree));
1192extern int inherits_from_p PARAMS ((tree, tree));
09bb3514 1193extern int common_enclosing_context_p PARAMS ((tree, tree));
4654e794 1194extern int enclosing_context_p PARAMS ((tree, tree));
fa334f7d 1195extern void complete_start_java_method PARAMS ((tree));
1196extern tree build_result_decl PARAMS ((tree));
1197extern void emit_handlers PARAMS ((void));
1198extern void init_outgoing_cpool PARAMS ((void));
1199extern void make_class_data PARAMS ((tree));
1200extern void register_class PARAMS ((void));
1201extern int alloc_name_constant PARAMS ((int, tree));
1202extern void emit_register_classes PARAMS ((void));
bee0e6ed 1203extern void emit_offset_symbol_table PARAMS ((void));
fa334f7d 1204extern void lang_init_source PARAMS ((int));
1205extern void write_classfile PARAMS ((tree));
1206extern char *print_int_node PARAMS ((tree));
1207extern void parse_error_context PARAMS ((tree cl, const char *, ...))
65c439eb 1208 ATTRIBUTE_PRINTF_2;
fa334f7d 1209extern void finish_class PARAMS ((void));
1210extern void java_layout_seen_class_methods PARAMS ((void));
2d87a73a 1211extern void check_for_initialization PARAMS ((tree, tree));
fa334f7d 1212
1213extern tree pushdecl_top_level PARAMS ((tree));
1214extern int alloc_class_constant PARAMS ((tree));
fa334f7d 1215extern void init_expr_processing PARAMS ((void));
1216extern void push_super_field PARAMS ((tree, tree));
1217extern void init_class_processing PARAMS ((void));
1218extern int can_widen_reference_to PARAMS ((tree, tree));
1219extern int class_depth PARAMS ((tree));
1220extern int verify_jvm_instructions PARAMS ((struct JCF *, const unsigned char *, long));
1221extern void maybe_pushlevels PARAMS ((int));
1222extern void maybe_poplevels PARAMS ((int));
c1b6623d 1223extern void force_poplevels PARAMS ((int));
fa334f7d 1224extern int process_jvm_instruction PARAMS ((int, const unsigned char *, long));
bc099162 1225extern int maybe_adjust_start_pc PARAMS ((struct JCF *, int, int, int));
fa334f7d 1226extern void set_local_type PARAMS ((int, tree));
1227extern int merge_type_state PARAMS ((tree));
3e02ce30 1228extern int push_type_0 PARAMS ((tree));
fa334f7d 1229extern void push_type PARAMS ((tree));
1230extern void load_type_state PARAMS ((tree));
1231extern void add_interface PARAMS ((tree, tree));
fa334f7d 1232extern tree force_evaluation_order PARAMS ((tree));
1233extern int verify_constant_pool PARAMS ((struct JCF *));
1234extern void start_java_method PARAMS ((tree));
1235extern void end_java_method PARAMS ((void));
1236extern void give_name_to_locals PARAMS ((struct JCF *));
bc099162 1237extern void note_instructions PARAMS ((struct JCF *, tree));
fa334f7d 1238extern void expand_byte_code PARAMS ((struct JCF *, tree));
1239extern int open_in_zip PARAMS ((struct JCF *, const char *, const char *, int));
1240extern void set_constant_value PARAMS ((tree, tree));
5ce13bce 1241#ifdef jword
fa334f7d 1242extern int find_constant1 PARAMS ((struct CPool *, int, jword));
1243extern int find_constant2 PARAMS ((struct CPool *, int, jword, jword));
5ce13bce 1244#endif
fa334f7d 1245extern int find_utf8_constant PARAMS ((struct CPool *, tree));
1246extern int find_string_constant PARAMS ((struct CPool *, tree));
1247extern int find_class_constant PARAMS ((struct CPool *, tree));
1248extern int find_fieldref_index PARAMS ((struct CPool *, tree));
1249extern int find_methodref_index PARAMS ((struct CPool *, tree));
735b10df 1250extern int find_methodref_with_class_index PARAMS ((struct CPool *, tree, tree));
fa334f7d 1251extern void write_constant_pool PARAMS ((struct CPool *, unsigned char *, int));
1252extern int count_constant_pool_bytes PARAMS ((struct CPool *));
1253extern int encode_newarray_type PARAMS ((tree));
003019ba 1254#ifdef uint64
fa334f7d 1255extern void format_int PARAMS ((char *, jlong, int));
1256extern void format_uint PARAMS ((char *, uint64, int));
003019ba 1257#endif
fa334f7d 1258extern void jcf_trim_old_input PARAMS ((struct JCF *));
003019ba 1259#ifdef BUFSIZ
fa334f7d 1260extern void jcf_print_utf8 PARAMS ((FILE *, const unsigned char *, int));
1261extern void jcf_print_char PARAMS ((FILE *, int));
1262extern void jcf_print_utf8_replace PARAMS ((FILE *, const unsigned char *,
003019ba 1263 int, int, int));
1264# if JCF_USE_STDIO
e772a198 1265extern const char* open_class PARAMS ((const char *, struct JCF *,
1266 FILE *, const char *));
003019ba 1267# else
e772a198 1268extern const char* open_class PARAMS ((const char *, struct JCF *,
1269 int, const char *));
003019ba 1270# endif /* JCF_USE_STDIO */
1271#endif
87cd7b07 1272extern void java_debug_context PARAMS ((void));
1273extern void safe_layout_class PARAMS ((tree));
65c439eb 1274
4576deab 1275extern tree get_boehm_type_descriptor PARAMS ((tree));
a8f5ddb8 1276extern bool class_has_finalize_method PARAMS ((tree));
4177eed1 1277extern void java_check_methods PARAMS ((tree));
48c9f822 1278extern void init_jcf_parse PARAMS((void));
489283da 1279extern void init_src_parse PARAMS((void));
6599bf3a 1280
1281extern int cxx_keyword_p PARAMS ((const char *, int));
1282extern tree java_mangle_decl PARAMS ((struct obstack *, tree));
1283extern tree java_mangle_class_field PARAMS ((struct obstack *, tree));
1284extern tree java_mangle_class_field_from_string PARAMS ((struct obstack *, char *));
1285extern tree java_mangle_vtable PARAMS ((struct obstack *, tree));
b6250dbc 1286extern const char *lang_printable_name_wls PARAMS ((tree, int));
bca8957b 1287extern void append_gpp_mangled_name PARAMS ((const char *, int));
4576deab 1288
fcffb974 1289extern void add_predefined_file PARAMS ((tree));
1290extern int predefined_filename_p PARAMS ((tree));
1291
b467ecc1 1292#if defined(RTX_CODE) && defined (HAVE_MACHINE_MODES)
1293struct rtx_def * java_expand_expr PARAMS ((tree, rtx, enum machine_mode,
1294 int));
1295#endif
1c637495 1296
2d87a73a 1297#define DECL_FINAL(DECL) DECL_LANG_FLAG_3 (DECL)
1298
377029eb 1299/* Access flags etc for a method (a FUNCTION_DECL): */
1300
1301#define METHOD_PUBLIC(DECL) DECL_LANG_FLAG_1 (DECL)
1302#define METHOD_PRIVATE(DECL) TREE_PRIVATE (DECL)
1303#define METHOD_PROTECTED(DECL) TREE_PROTECTED (DECL)
1304#define METHOD_STATIC(DECL) DECL_LANG_FLAG_2 (DECL)
2d87a73a 1305#define METHOD_FINAL(DECL) DECL_FINAL (DECL)
377029eb 1306#define METHOD_SYNCHRONIZED(DECL) DECL_LANG_FLAG_4 (DECL)
1f3233d1 1307#define METHOD_NATIVE(DECL) (DECL_LANG_SPECIFIC(DECL)->u.f.native)
377029eb 1308#define METHOD_ABSTRACT(DECL) DECL_LANG_FLAG_5 (DECL)
1309#define METHOD_TRANSIENT(DECL) DECL_LANG_FLAG_6 (DECL)
1f3233d1 1310#define METHOD_STRICTFP(DECL) (DECL_LANG_SPECIFIC (DECL)->u.f.strictfp)
377029eb 1311
cb18c572 1312#define JAVA_FILE_P(NODE) TREE_LANG_FLAG_2 (NODE)
1313#define CLASS_FILE_P(NODE) TREE_LANG_FLAG_3 (NODE)
1314#define ZIP_FILE_P(NODE) TREE_LANG_FLAG_4 (NODE)
1315
4654e794 1316/* Other predicates on method decls */
1317
377029eb 1318#define DECL_CONSTRUCTOR_P(DECL) DECL_LANG_FLAG_7(DECL)
1319
4654e794 1320#define DECL_INIT_P(DECL) (ID_INIT_P (DECL_NAME (DECL)))
1321#define DECL_FINIT_P(DECL) (ID_FINIT_P (DECL_NAME (DECL)))
1322#define DECL_CLINIT_P(DECL) (ID_CLINIT_P (DECL_NAME (DECL)))
6eb95932 1323#define DECL_INSTINIT_P(DECL) (ID_INSTINIT_P (DECL_NAME (DECL)))
4654e794 1324
1325/* Predicates on method identifiers. Kept close to other macros using
1326 them */
1327#define ID_INIT_P(ID) ((ID) == init_identifier_node)
78402341 1328#define ID_FINIT_P(ID) ((ID) == finit_identifier_node)
4654e794 1329#define ID_CLINIT_P(ID) ((ID) == clinit_identifier_node)
efcda118 1330#define ID_CLASSDOLLAR_P(ID) ((ID) == classdollar_identifier_node)
6eb95932 1331#define ID_INSTINIT_P(ID) ((ID) == instinit_identifier_node)
4654e794 1332
377029eb 1333/* Access flags etc for a variable/field (a FIELD_DECL): */
1334
1335#define FIELD_PRIVATE(DECL) TREE_PRIVATE (DECL)
1336#define FIELD_PROTECTED(DECL) TREE_PROTECTED (DECL)
1337#define FIELD_PUBLIC(DECL) DECL_LANG_FLAG_1 (DECL)
1338#define FIELD_STATIC(DECL) TREE_STATIC (DECL)
2d87a73a 1339#define FIELD_FINAL(DECL) DECL_FINAL (DECL)
377029eb 1340#define FIELD_VOLATILE(DECL) DECL_LANG_FLAG_4 (DECL)
1341#define FIELD_TRANSIENT(DECL) DECL_LANG_FLAG_5 (DECL)
1342
377029eb 1343/* Access flags etc for a class (a TYPE_DECL): */
1344
1345#define CLASS_PUBLIC(DECL) DECL_LANG_FLAG_1 (DECL)
2d87a73a 1346#define CLASS_FINAL(DECL) DECL_FINAL (DECL)
377029eb 1347#define CLASS_INTERFACE(DECL) DECL_LANG_FLAG_4 (DECL)
1348#define CLASS_ABSTRACT(DECL) DECL_LANG_FLAG_5 (DECL)
1349#define CLASS_SUPER(DECL) DECL_LANG_FLAG_6 (DECL)
4654e794 1350#define CLASS_STATIC(DECL) DECL_LANG_FLAG_7 (DECL)
9744ddf1 1351#define CLASS_PRIVATE(DECL) (TYPE_PRIVATE_INNER_CLASS (TREE_TYPE (DECL)))
6175855a 1352#define CLASS_PROTECTED(DECL) (TYPE_PROTECTED_INNER_CLASS (TREE_TYPE (DECL)))
4103fd21 1353#define CLASS_STRICTFP(DECL) (TYPE_STRICTFP (TREE_TYPE (DECL)))
377029eb 1354
23b7f2e1 1355/* @deprecated marker flag on methods, fields and classes */
1356
1357#define METHOD_DEPRECATED(DECL) DECL_LANG_FLAG_0 (DECL)
1358#define FIELD_DEPRECATED(DECL) DECL_LANG_FLAG_0 (DECL)
1359#define CLASS_DEPRECATED(DECL) DECL_LANG_FLAG_0 (DECL)
1360#define DECL_DEPRECATED(DECL) DECL_LANG_FLAG_0 (DECL)
1361
377029eb 1362/* The number of virtual methods in this class's dispatch table.
1363 Does not include initial two dummy entries (one points to the
1364 Class object, and the other is for G++ -fvtable-thunks compatibility). */
1365#define TYPE_NVIRTUALS(TYPE) TYPE_BINFO_VIRTUALS (TYPE)
1366
1367/* A TREE_VEC (indexed by DECL_VINDEX) containing this class's
1368 virtual methods. */
1369#define TYPE_VTABLE(TYPE) TYPE_BINFO_VTABLE(TYPE)
1370
377029eb 1371/* Use CLASS_LOADED_P? FIXME */
1372#define CLASS_COMPLETE_P(DECL) DECL_LANG_FLAG_2 (DECL)
1373
1374/* This maps a bytecode offset (PC) to various flags,
1375 listed below (starting with BCODE_). */
1376extern char *instruction_bits;
1377
1378/* True iff the byte is the start of an instruction. */
1379#define BCODE_INSTRUCTION_START 1
1380
78b4b656 1381/* True iff there is a jump or a return to this location. */
377029eb 1382#define BCODE_JUMP_TARGET 2
1383
377029eb 1384/* True iff this is the start of an exception handler. */
1385#define BCODE_EXCEPTION_TARGET 16
1386
1387/* True iff there is a jump to this location (and it needs a label). */
78b4b656 1388#define BCODE_TARGET (BCODE_JUMP_TARGET| BCODE_EXCEPTION_TARGET)
377029eb 1389
1390/* True iff there is an entry in the linenumber table for this location. */
1391#define BCODE_HAS_LINENUMBER 32
1392
1393/* True iff there is more than one entry in the linenumber table for
1394 this location. (This probably does not make much sense.) */
1395#define BCODE_HAS_MULTI_LINENUMBERS 64
1396
1397/* True if this instruction has been verified. */
1398#define BCODE_VERIFIED 8
1399
1400/* A pointer to the line number table of the current method. */
1c637495 1401extern const unsigned char *linenumber_table;
377029eb 1402/* The length (in items) of the line number table. */
1403extern int linenumber_count;
1404
1405/* In type_map, means that slot is uninitialized or otherwise unusable. */
1406#define TYPE_UNKNOWN NULL_TREE
1407
1408/* In type_map, means the second half of a 64-bit double or long. */
1409#define TYPE_SECOND void_type_node
1410
1411/* In type_map, means the null type (i.e. type of a null reference). */
1412#define TYPE_NULL ptr_type_node
1413
1414/* In a type map means the type the address subroutine return address. */
1415#define TYPE_RETURN_ADDR return_address_type_node
1416
1417/* In a subroutine's return type map, indicates that the slot was neither
1418 used nor set in the subroutine. */
1419#define TYPE_UNUSED error_mark_node
1420
3e02ce30 1421/* When returned from pop_type_0, indicates stack underflow. */
1422#define TYPE_UNDERFLOW integer_zero_node
1423
1424/* When returned from pop_type_0, indicates a type mismatch. */
1425#define TYPE_UNEXPECTED NULL_TREE
1426
377029eb 1427/* A array mapping variable/stack slot index to the type current
1428 in that variable/stack slot.
1429 TYPE_UNKNOWN, TYPE_SECOND, and TYPE_NULL are special cases. */
1430extern tree *type_map;
1431
1432/* Map a stack index to the type currently in that slot. */
1433#define stack_type_map (type_map+DECL_MAX_LOCALS(current_function_decl))
1434
1435/* True iff TYPE takes two variable/stack slots. */
1436#define TYPE_IS_WIDE(TYPE) \
1437 ((TYPE) == double_type_node || (TYPE) == long_type_node)
1438
4654e794 1439/* True iif CLASS has it's access$0 method generated. */
1440#define CLASS_ACCESS0_GENERATED_P(CLASS) TYPE_LANG_FLAG_0 (CLASS)
1441
377029eb 1442/* True iff TYPE is a Java array type. */
1443#define TYPE_ARRAY_P(TYPE) TYPE_LANG_FLAG_1 (TYPE)
1444
2d87a73a 1445/* True for an INDIRECT_REF created from a 'ARRAY.length' operation. */
1446#define IS_ARRAY_LENGTH_ACCESS(NODE) TREE_LANG_FLAG_4 (NODE)
1447
377029eb 1448/* If FUNCTION_TYPE or METHOD_TYPE: cache for build_java_argument_signature. */
1449#define TYPE_ARGUMENT_SIGNATURE(TYPE) TYPE_VFIELD(TYPE)
1450
1451/* Given an array type, give the type of the elements. */
1452/* FIXME this use of TREE_TYPE conflicts with something or other. */
1453#define TYPE_ARRAY_ELEMENT(ATYPE) TREE_TYPE(ATYPE)
1454
0574932f 1455/* True if class TYPE has been loaded (i.e. parsed plus laid out).
1456 (The check for CLASS_PARSED_P is needed because of Object and Class.) */
1457#define CLASS_LOADED_P(TYPE) (TYPE_SIZE (TYPE) != NULL_TREE \
1458 && (CLASS_PARSED_P(TYPE) || TYPE_ARRAY_P(TYPE)))
1459
1460/* True if class TYPE has been parsed (first pass). */
1461#define CLASS_PARSED_P(TYPE) TYPE_LANG_FLAG_2 (TYPE)
377029eb 1462
1463/* True if class TYPE was defined in Java source code. */
1464#define CLASS_FROM_SOURCE_P(TYPE) TYPE_LANG_FLAG_3 (TYPE)
1465
c31939b7 1466/* True of a RECORD_TYPE of a class/interface type (not array type) */
1467#define CLASS_P(TYPE) TYPE_LANG_FLAG_4 (TYPE)
1468
cb18c572 1469/* True if class TYPE was requested (on command line) to be compiled.*/
1470#define CLASS_FROM_CURRENTLY_COMPILED_P(TYPE) \
c31939b7 1471 TYPE_LANG_FLAG_5 (TYPE)
1472
4654e794 1473/* True if class TYPE is currently being laid out. Helps in detection
1d936ee2 1474 of inheritance cycle occurring as a side effect of performing the
4654e794 1475 layout of a class. */
1476#define CLASS_BEING_LAIDOUT(TYPE) TYPE_LANG_FLAG_6 (TYPE)
1477
78402341 1478/* True if class TYPE has a field initializer finit$ function */
4654e794 1479#define CLASS_HAS_FINIT_P(TYPE) TYPE_FINIT_STMT_LIST (TYPE)
a31ac40f 1480
377029eb 1481/* True if identifier ID was seen while processing a single type import stmt */
1482#define IS_A_SINGLE_IMPORT_CLASSFILE_NAME_P(ID) TREE_LANG_FLAG_0 (ID)
1483
1484/* True if identifier ID was seen while processing an import statement */
1485#define IS_A_CLASSFILE_NAME(ID) TREE_LANG_FLAG_1 (ID)
1486
1487/* True if ID is a qualified named (contains . or /) */
1488#define QUALIFIED_P(ID) TREE_LANG_FLAG_2 (ID)
1489
1490/* True if ID is an already processed import on demand */
1491#define IS_AN_IMPORT_ON_DEMAND_P(ID) TREE_LANG_FLAG_3 (ID)
1492
c31939b7 1493/* True if ID is a command-line specified filename */
1494#define IS_A_COMMAND_LINE_FILENAME_P(ID) TREE_LANG_FLAG_4 (ID)
1495
1496/* True if filename ID has already been parsed */
1497#define HAS_BEEN_ALREADY_PARSED_P(ID) TREE_LANG_FLAG_5 (ID)
1498
377029eb 1499/* True if EXPR is RHS sub-tree of a compound assign expression */
1500#define COMPOUND_ASSIGN_P(EXPR) TREE_LANG_FLAG_1 (EXPR)
1501
efd71bdf 1502/* True if a SWITCH_EXPR has a DEFAULT_EXPR. */
1503#define SWITCH_HAS_DEFAULT(NODE) TREE_LANG_FLAG_3 (NODE)
1504
377029eb 1505/* True if EXPR (a WFL in that case) was created after the
1506 reduction of PRIMARY . XXX */
1507#define PRIMARY_P(EXPR) TREE_LANG_FLAG_2 (EXPR)
1508
1509/* True if EXPR (a MODIFY_EXPR in that case) is the result of variable
1510 initialization during its declaration */
1511#define MODIFY_EXPR_FROM_INITIALIZATION_P(EXPR) TREE_LANG_FLAG_2 (EXPR)
1512
2c28cd42 1513/* True if EXPR (a TREE_TYPE denoting a class type) has its methods
1514 already checked (for redifitions, etc, see java_check_regular_methods.) */
4177eed1 1515#define CLASS_METHOD_CHECKED_P(EXPR) TREE_LANG_FLAG_2 (EXPR)
1516
a8f5ddb8 1517/* True if TYPE (a TREE_TYPE denoting a class type) was found to
1518 feature a finalizer method. */
1519#define HAS_FINALIZER_P(EXPR) TREE_LANG_FLAG_3 (EXPR)
1520
377029eb 1521/* True if EXPR (a WFL in that case) resolves into an expression name */
1522#define RESOLVE_EXPRESSION_NAME_P(WFL) TREE_LANG_FLAG_0 (WFL)
1523
1524/* True if EXPR (a LOOP_EXPR in that case) is part of a for statement */
4654e794 1525#define FOR_LOOP_P(EXPR) TREE_LANG_FLAG_0 (EXPR)
1526
1527/* True if NODE (a RECORD_TYPE in that case) is an anonymous class. */
1528#define ANONYMOUS_CLASS_P(NODE) TREE_LANG_FLAG_0 (NODE)
1529
1530/* True if NODE (a RECORD_TYPE in that case) is a block local class. */
1531#define LOCAL_CLASS_P(NODE) TREE_LANG_FLAG_1 (NODE)
1532
1533/* True if NODE (a TREE_LIST) hold a pair of argument name/type
1534 declared with the final modifier */
1535#define ARG_FINAL_P(NODE) TREE_LANG_FLAG_0 (NODE)
377029eb 1536
bae6ff29 1537/* True if NODE (some kind of EXPR, but not a WFL) should not give an
1538 error if it is found to be unreachable. This can only be applied
1539 to those EXPRs which can be used as the update expression of a
1540 `for' loop. In particular it can't be set on a LOOP_EXPR. */
1541#define SUPPRESS_UNREACHABLE_ERROR(NODE) TREE_LANG_FLAG_0 (NODE)
1542
377029eb 1543/* True if EXPR (a WFL in that case) resolves into a package name */
1544#define RESOLVE_PACKAGE_NAME_P(WFL) TREE_LANG_FLAG_3 (WFL)
1545
1546/* True if EXPR (a WFL in that case) resolves into a type name */
1547#define RESOLVE_TYPE_NAME_P(WFL) TREE_LANG_FLAG_4 (WFL)
1548
1549/* True if STMT (a WFL in that case) holds a BREAK statement */
1550#define IS_BREAK_STMT_P(WFL) TREE_LANG_FLAG_5 (WFL)
1551
b8f64b70 1552/* True if EXPR (a CALL_EXPR in that case) is a crafted StringBuffer */
1553#define IS_CRAFTED_STRING_BUFFER_P(EXPR) TREE_LANG_FLAG_5 (EXPR)
1554
b4447497 1555/* True if EXPR (a SAVE_EXPR in that case) had its content already
1556 checked for (un)initialized local variables. */
1557#define IS_INIT_CHECKED(EXPR) TREE_LANG_FLAG_5 (EXPR)
1558
7e1ce541 1559/* If set in CALL_EXPR, the receiver is 'super'. */
1560#define CALL_USING_SUPER(EXPR) TREE_LANG_FLAG_4 (EXPR)
1561
efd71bdf 1562/* True if NODE (a statement) can complete normally. */
1563#define CAN_COMPLETE_NORMALLY(NODE) TREE_LANG_FLAG_6(NODE)
1564
4654e794 1565/* True if NODE (an IDENTIFIER) bears the name of a outer field from
1566 inner class access function. */
1567#define OUTER_FIELD_ACCESS_IDENTIFIER_P(NODE) TREE_LANG_FLAG_6(NODE)
1568
1569/* Non null if NODE belongs to an inner class TYPE_DECL node.
1570 Verifies that NODE as the attributes of a decl. */
1571#define INNER_CLASS_DECL_P(NODE) (TYPE_NAME (TREE_TYPE (NODE)) == NODE \
1572 && DECL_CONTEXT (NODE))
1573
1574/* Non null if NODE is an top level class TYPE_DECL node: NODE isn't
1575 an inner class or NODE is a static class. */
1576#define TOPLEVEL_CLASS_DECL_P(NODE) (!INNER_CLASS_DECL_P (NODE) \
1577 || CLASS_STATIC (NODE))
1578
1579/* True if the class decl NODE was declared in a inner scope and is
1580 not a toplevel class */
1581#define PURE_INNER_CLASS_DECL_P(NODE) \
1582 (INNER_CLASS_DECL_P (NODE) && !CLASS_STATIC (NODE))
1583
1584/* Non null if NODE belongs to an inner class RECORD_TYPE node. Checks
1585 that TYPE_NAME bears a decl. An array type wouldn't. */
1586#define INNER_CLASS_TYPE_P(NODE) (TREE_CODE (TYPE_NAME (NODE)) == TYPE_DECL \
1587 && DECL_CONTEXT (TYPE_NAME (NODE)))
1588
1589#define TOPLEVEL_CLASS_TYPE_P(NODE) (!INNER_CLASS_TYPE_P (NODE) \
1590 || CLASS_STATIC (TYPE_NAME (NODE)))
1591
1592/* True if the class type NODE was declared in a inner scope and is
1593 not a toplevel class */
1594#define PURE_INNER_CLASS_TYPE_P(NODE) \
1595 (INNER_CLASS_TYPE_P (NODE) && !CLASS_STATIC (TYPE_NAME (NODE)))
1596
1597/* Non null if NODE (a TYPE_DECL or a RECORD_TYPE) is an inner class. */
1598#define INNER_CLASS_P(NODE) (TREE_CODE (NODE) == TYPE_DECL ? \
1599 INNER_CLASS_DECL_P (NODE) : \
1600 (TREE_CODE (NODE) == RECORD_TYPE ? \
1601 INNER_CLASS_TYPE_P (NODE) : \
f060a027 1602 (abort (), 0)))
4654e794 1603
1604/* On a TYPE_DECL, hold the list of inner classes defined within the
1605 scope of TYPE_DECL. */
1606#define DECL_INNER_CLASS_LIST(NODE) DECL_INITIAL (NODE)
1607
46fde5eb 1608/* Build a IDENTIFIER_NODE for a file name we're considering. Since
1609 all_class_filename is a registered root, putting this identifier
1610 in a TREE_LIST it holds keeps this node alive. */
1611#define BUILD_FILENAME_IDENTIFIER_NODE(F, S) \
1612 if (!((F) = maybe_get_identifier ((S)))) \
1613 { \
1614 (F) = get_identifier ((S)); \
1615 tree_cons ((F), NULL_TREE, all_class_filename); \
6a6de9c5 1616 }
1617
377029eb 1618/* Add a FIELD_DECL to RECORD_TYPE RTYPE.
1619 The field has name NAME (a char*), and type FTYPE.
1620 Unless this is the first field, FIELD most hold the previous field.
1621 FIELD is set to the newly created FIELD_DECL.
1622
1623 We set DECL_ARTIFICIAL so these fields get skipped by make_class_data
1624 if compiling java.lang.Object or java.lang.Class. */
1625
1626#define PUSH_FIELD(RTYPE, FIELD, NAME, FTYPE) \
1627{ tree tmp_field = build_decl (FIELD_DECL, get_identifier(NAME), FTYPE); \
1628 if (TYPE_FIELDS (RTYPE) == NULL_TREE) TYPE_FIELDS (RTYPE) = tmp_field; \
1629 else TREE_CHAIN(FIELD) = tmp_field; \
1630 DECL_CONTEXT (tmp_field) = RTYPE; \
1631 DECL_ARTIFICIAL (tmp_field) = 1; \
1632 FIELD = tmp_field; }
1633
1634#define FINISH_RECORD(RTYPE) layout_type (RTYPE)
1635
1636/* Start building a RECORD_TYPE constructor with a given TYPE in CONS. */
1637#define START_RECORD_CONSTRUCTOR(CONS, CTYPE) { \
1638 CONS = build (CONSTRUCTOR, CTYPE, NULL_TREE, NULL_TREE);\
1639 TREE_CHAIN(CONS) = TYPE_FIELDS (CTYPE); }
1640
1641/* Append a field initializer to CONS for the dummy field for the inherited
1642 fields. The dummy field has the given VALUE, and the same type as the
1643 super-class. Must be specified before calls to PUSH_FIELD_VALUE. */
1644
1645#define PUSH_SUPER_VALUE(CONS, VALUE) {\
1646 tree field = TREE_CHAIN(CONS);\
1647 if (DECL_NAME (field) != NULL_TREE) abort();\
1648 CONSTRUCTOR_ELTS(CONS) = tree_cons (field, VALUE, CONSTRUCTOR_ELTS(CONS));\
1649 TREE_CHAIN(CONS) = TREE_CHAIN (field); }
1650
1651/* Append a field initializer to CONS for a field with the given VALUE.
1652 NAME is a char* string used for error checking;
1653 the initializer must be specified in order. */
1654#define PUSH_FIELD_VALUE(CONS, NAME, VALUE) {\
1655 tree field = TREE_CHAIN(CONS);\
1656 if (strcmp (IDENTIFIER_POINTER (DECL_NAME (field)), NAME) != 0) abort();\
1657 CONSTRUCTOR_ELTS(CONS) = tree_cons (field, VALUE, CONSTRUCTOR_ELTS(CONS));\
1658 TREE_CHAIN(CONS) = TREE_CHAIN (field); }
1659
1660/* Finish creating a record CONSTRUCTOR CONS. */
1661#define FINISH_RECORD_CONSTRUCTOR(CONS) \
1662 CONSTRUCTOR_ELTS(CONS) = nreverse (CONSTRUCTOR_ELTS(CONS))
1663
a31ac40f 1664/* Macros on constructors invocations. */
1665#define CALL_CONSTRUCTOR_P(NODE) \
1666 (TREE_CODE (NODE) == NEW_CLASS_EXPR || CALL_EXPLICIT_CONSTRUCTOR_P (NODE))
1667
1668#define CALL_EXPLICIT_CONSTRUCTOR_P(NODE) \
1669 (CALL_THIS_CONSTRUCTOR_P (NODE) || CALL_SUPER_CONSTRUCTOR_P (NODE))
1670
1671#define CALL_THIS_CONSTRUCTOR_P(NODE) \
1672 (TREE_CODE (NODE) == CALL_EXPR \
1673 && EXPR_WFL_NODE (TREE_OPERAND (NODE, 0)) == this_identifier_node)
1674
1675#define CALL_SUPER_CONSTRUCTOR_P(NODE) \
1676 (TREE_CODE (NODE) == CALL_EXPR \
1677 && EXPR_WFL_NODE (TREE_OPERAND (NODE, 0)) == super_identifier_node)
b8f64b70 1678
1679/* Using a FINALLY_EXPR node */
1680#define FINALLY_EXPR_LABEL(NODE) TREE_OPERAND ((NODE), 0)
1681#define FINALLY_EXPR_BLOCK(NODE) TREE_OPERAND ((NODE), 1)
377029eb 1682
57fc05de 1683#define BLOCK_EXPR_DECLS(NODE) BLOCK_VARS(NODE)
1684#define BLOCK_EXPR_BODY(NODE) BLOCK_SUBBLOCKS(NODE)
2a3fc102 1685/* True for an implicit block surrounding declaration not at start of {...}. */
1686#define BLOCK_IS_IMPLICIT(NODE) TREE_LANG_FLAG_1 (NODE)
57fc05de 1687
caa63dd7 1688#define BUILD_MONITOR_ENTER(WHERE, ARG) \
1689 { \
1690 (WHERE) = build (CALL_EXPR, int_type_node, \
1691 build_address_of (soft_monitorenter_node), \
1692 build_tree_list (NULL_TREE, (ARG)), \
1693 NULL_TREE); \
1694 TREE_SIDE_EFFECTS (WHERE) = 1; \
1695 }
1696
1697#define BUILD_MONITOR_EXIT(WHERE, ARG) \
1698 { \
1699 (WHERE) = build (CALL_EXPR, int_type_node, \
1700 build_address_of (soft_monitorexit_node), \
1701 build_tree_list (NULL_TREE, (ARG)), \
1702 NULL_TREE); \
1703 TREE_SIDE_EFFECTS (WHERE) = 1; \
1704 }
1705
6b0c8920 1706/* Non zero if TYPE is an unchecked exception */
1707#define IS_UNCHECKED_EXCEPTION_P(TYPE) \
f757ce2b 1708 (inherits_from_p ((TYPE), runtime_exception_type_node) \
1709 || inherits_from_p ((TYPE), error_exception_type_node))
c31939b7 1710
eb47970b 1711/* True when we can perform static class initialization optimization */
1712#define STATIC_CLASS_INIT_OPT_P() \
160eb709 1713 (flag_optimize_sci && (optimize >= 2) && ! flag_emit_class_files)
eb47970b 1714
2d87a73a 1715extern int java_error_count;
57fc05de 1716
c31939b7 1717/* Make the current function where this macro is invoked report error
1718 messages and and return, if any */
23b7f2e1 1719#define java_parse_abort_on_error() \
1720 { \
57fc05de 1721 if (java_error_count > save_error_count) \
6b0c8920 1722 return; \
c31939b7 1723 }
c1b6623d 1724
483c9a9d 1725/* These are the possible values for the `state' field of the class
1726 structure. This must be kept in sync with libgcj. */
1727enum
1728{
1729 JV_STATE_NOTHING = 0, /* Set by compiler. */
1730
1731 JV_STATE_PRELOADING = 1, /* Can do _Jv_FindClass. */
1732 JV_STATE_LOADING = 3, /* Has super installed. */
1733 JV_STATE_LOADED = 5, /* Is complete. */
1734
1735 JV_STATE_COMPILED = 6, /* This was a compiled class. */
1736
1737 JV_STATE_PREPARED = 7, /* Layout & static init done. */
1738 JV_STATE_LINKED = 9, /* Strings interned. */
1739
1740 JV_STATE_IN_PROGRESS = 10, /* <Clinit> running. */
1741 JV_STATE_DONE = 12,
1742
1743 JV_STATE_ERROR = 14 /* must be last. */
1744};
1745
c1b6623d 1746#undef DEBUG_JAVA_BINDING_LEVELS