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