OSDN Git Service

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