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