summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/java/ChangeLog23
-rw-r--r--gcc/java/check-init.c5
-rw-r--r--gcc/java/class.c41
-rw-r--r--gcc/java/decl.c27
-rw-r--r--gcc/java/expr.c50
-rw-r--r--gcc/java/java-tree.h23
-rw-r--r--gcc/java/jcf-parse.c8
-rw-r--r--gcc/java/parse.c410
8 files changed, 329 insertions, 258 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 182c1fab73b..9e9e877ba66 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,26 @@
+2000-02-25 Anthony Green <green@cygnus.com>
+
+ * expr.c (build_class_init): Mark the decl to be ignored by
+ check_init.
+ * java-tree.h (DECL_BIT_INDEX): Move definition from check-init.c
+ * check-init.c: Move DECL_BIT_INDEX to java-tree.h
+ * class.c (init_test_hash_newfunc): New function.
+ (decl_hash): New function.
+ (decl_compare): New function.
+ * decl.c (emit_init_test_initialization): New function.
+ (complete_start_java_method): Traverse the init test hashtable,
+ calling emit_init_test_initialization.
+ (always_initialize_class_p): Define.
+ * expr.c (build_class_init): Use initialization tests when
+ emitting class initialization code.
+ (always_initialize_class_p): Declare.
+ * jcf-parse.c (parse_class_file): Set always_initialize_class_p to
+ 1.
+ * java-tree.h: Include hash.h.
+ (DECL_FUNCTION_INIT_TEST_TABLE): Define.
+ (struct lang_decl): Add init_test_table field.
+ (init_test_hash_entry): Define.
+
Fri Feb 25 18:41:31 2000 Alexandre Petit-Bianco <apbianco@cygnus.com>
* gjavah.c (main): Avoid using `argi' to report unimplemented
diff --git a/gcc/java/check-init.c b/gcc/java/check-init.c
index a202b45bbc5..63ee697f029 100644
--- a/gcc/java/check-init.c
+++ b/gcc/java/check-init.c
@@ -39,11 +39,6 @@ typedef unsigned int word;
/* Pointer to a bitstring. */
typedef word *words;
-/* For a local VAR_DECL, holds the index into a words bitstring that
- specifies if this decl is definitively assigned.
- A DECL_BIT_INDEX of -1 means we no longer care. */
-#define DECL_BIT_INDEX(DECL) DECL_FIELD_SIZE(DECL)
-
/* Number of locals variables currently active. */
int num_current_locals = 0;
diff --git a/gcc/java/class.c b/gcc/java/class.c
index a62f89042be..af56f740ebf 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -389,7 +389,7 @@ set_super_info (access_flags, this_class, super_class, interfaces_count)
CLASS_HAS_SUPER (this_class) = 1;
}
pop_obstacks ();
-
+
if (access_flags & ACC_PUBLIC) CLASS_PUBLIC (class_decl) = 1;
if (access_flags & ACC_FINAL) CLASS_FINAL (class_decl) = 1;
if (access_flags & ACC_SUPER) CLASS_SUPER (class_decl) = 1;
@@ -548,6 +548,40 @@ build_java_method_type (fntype, this_class, access_flags)
return build_method_type (CLASS_TO_HANDLE_TYPE (this_class), fntype);
}
+static struct hash_entry *
+init_test_hash_newfunc (entry, table, string)
+ struct hash_entry *entry;
+ struct hash_table *table;
+ hash_table_key string ATTRIBUTE_UNUSED;
+{
+ struct init_test_hash_entry *ret = (struct init_test_hash_entry *) entry;
+ if (ret == NULL)
+ {
+ ret = ((struct init_test_hash_entry *)
+ hash_allocate (table, sizeof (struct init_test_hash_entry)));
+ if (ret == NULL)
+ return NULL;
+ }
+ ret->init_test_decl = 0;
+ return (struct hash_entry *) ret;
+}
+
+static unsigned long
+decl_hash (k)
+ hash_table_key k;
+{
+ return (long) k;
+}
+
+static boolean
+decl_compare (k1, k2)
+ hash_table_key k1;
+ hash_table_key k2;
+{
+ return ((char*) k1 == (char*) k2);
+}
+
+
tree
add_method_1 (handle_class, access_flags, name, function_type)
tree handle_class;
@@ -568,6 +602,11 @@ add_method_1 (handle_class, access_flags, name, function_type)
= (struct lang_decl *) permalloc (sizeof (struct lang_decl));
bzero ((PTR) DECL_LANG_SPECIFIC (fndecl), sizeof (struct lang_decl));
+ /* Initialize the static initializer test table. */
+ hash_table_init (&DECL_FUNCTION_INIT_TEST_TABLE (fndecl),
+ init_test_hash_newfunc, decl_hash,
+ decl_compare);
+
TREE_CHAIN (fndecl) = TYPE_METHODS (handle_class);
TYPE_METHODS (handle_class) = fndecl;
pop_obstacks ();
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index 711f9cb3776..46d322b6216 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -48,6 +48,10 @@ static tree lookup_name_current_level PARAMS ((tree));
static tree push_promoted_type PARAMS ((const char *, tree));
static struct binding_level *make_binding_level PARAMS ((void));
+/* Set to non-zero value in order to emit class initilization code
+ before static field references. */
+extern int always_initialize_class_p;
+
#ifndef INT_TYPE_SIZE
#define INT_TYPE_SIZE BITS_PER_WORD
#endif
@@ -1623,6 +1627,24 @@ build_result_decl (fndecl)
return (DECL_RESULT (fndecl) = build_decl (RESULT_DECL, NULL_TREE, restype));
}
+
+/* Called for every element in DECL_FUNCTION_INIT_TEST_TABLE in order
+ to emit initialization code for each test flag. */
+
+static boolean
+emit_init_test_initialization (entry, key)
+ struct hash_entry *entry;
+ hash_table_key key;
+{
+ struct init_test_hash_entry *ite = (struct init_test_hash_entry *) entry;
+ expand_decl (ite->init_test_decl);
+
+ expand_expr_stmt (build (MODIFY_EXPR, boolean_type_node,
+ ite->init_test_decl, boolean_false_node));
+
+ return true;
+}
+
void
complete_start_java_method (fndecl)
tree fndecl;
@@ -1634,6 +1656,11 @@ complete_start_java_method (fndecl)
/* Set up parameters and prepare for return, for the function. */
expand_function_start (fndecl, 0);
+
+ /* Emit initialization code for test flags. */
+ if (! always_initialize_class_p)
+ hash_traverse (&DECL_FUNCTION_INIT_TEST_TABLE (fndecl),
+ emit_init_test_initialization, 0);
}
/* Allocate further tree nodes temporarily during compilation
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index f25b1940a91..41a1d3d99b1 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -83,6 +83,10 @@ static tree case_identity PARAMS ((tree, tree));
static tree operand_type[59];
extern struct obstack permanent_obstack;
+/* Set to non-zero value in order to emit class initilization code
+ before static field references. */
+int always_initialize_class_p;
+
void
init_expr_processing()
{
@@ -1490,14 +1494,48 @@ tree
build_class_init (clas, expr)
tree clas, expr;
{
- tree init;
+ tree init, call;
+ struct init_test_hash_entry *ite;
if (inherits_from_p (current_class, clas))
return expr;
- init = build (CALL_EXPR, void_type_node,
- build_address_of (soft_initclass_node),
- build_tree_list (NULL_TREE, build_class_ref (clas)),
- NULL_TREE);
- TREE_SIDE_EFFECTS (init) = 1;
+
+ if (always_initialize_class_p)
+ {
+ init = build (CALL_EXPR, void_type_node,
+ build_address_of (soft_initclass_node),
+ build_tree_list (NULL_TREE, build_class_ref (clas)),
+ NULL_TREE);
+ TREE_SIDE_EFFECTS (init) = 1;
+ }
+ else
+ {
+ ite = (struct init_test_hash_entry *)
+ hash_lookup (&DECL_FUNCTION_INIT_TEST_TABLE (current_function_decl),
+ (const hash_table_key) clas,
+ TRUE, NULL);
+
+ if (ite->init_test_decl == 0)
+ ite->init_test_decl = build_decl (VAR_DECL, NULL_TREE,
+ boolean_type_node);
+ /* Tell the check-init code to ignore this decl. */
+ DECL_BIT_INDEX(ite->init_test_decl) = -1;
+
+ init = build (CALL_EXPR, void_type_node,
+ build_address_of (soft_initclass_node),
+ build_tree_list (NULL_TREE, build_class_ref (clas)),
+ NULL_TREE);
+ TREE_SIDE_EFFECTS (init) = 1;
+ call = build (COMPOUND_EXPR, TREE_TYPE (expr), init,
+ build (MODIFY_EXPR, boolean_type_node,
+ ite->init_test_decl, boolean_true_node));
+ TREE_SIDE_EFFECTS (call) = 1;
+ init = build (COND_EXPR, void_type_node,
+ build (EQ_EXPR, boolean_type_node,
+ ite->init_test_decl, boolean_false_node),
+ call, integer_zero_node);
+ TREE_SIDE_EFFECTS (init) = 1;
+ }
+
if (expr != NULL_TREE)
{
expr = build (COMPOUND_EXPR, TREE_TYPE (expr), init, expr);
diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h
index 288a6cbc479..536fdc18682 100644
--- a/gcc/java/java-tree.h
+++ b/gcc/java/java-tree.h
@@ -25,6 +25,8 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
/* Hacked by Per Bothner <bothner@cygnus.com> February 1996. */
+#include "hash.h"
+
/* Java language-specific tree codes. */
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
enum java_tree_code {
@@ -368,6 +370,12 @@ struct lang_identifier
/* How specific the function is (for method selection - Java source
code front-end */
#define DECL_SPECIFIC_COUNT(DECL) DECL_ARG_SLOT_COUNT(DECL)
+/* For each function decl, init_test_table contains a hash table whose
+ entries are keyed on class names, and whose values are local
+ boolean decls. The variables are intended to be TRUE when the
+ class has been initialized in this function, and FALSE otherwise. */
+#define DECL_FUNCTION_INIT_TEST_TABLE(DECL) \
+ (DECL_LANG_SPECIFIC(DECL)->init_test_table)
/* In a LABEL_DECL, a TREE_VEC that saves the type_map at that point. */
#define LABEL_TYPE_STATE(NODE) (DECL_INITIAL (NODE))
@@ -429,6 +437,11 @@ struct lang_identifier
#define DECL_LOCAL_SLOT_CHAIN(NODE) \
(((struct lang_decl_var*)DECL_LANG_SPECIFIC(NODE))->slot_chain)
+/* For a local VAR_DECL, holds the index into a words bitstring that
+ specifies if this decl is definitively assigned.
+ A DECL_BIT_INDEX of -1 means we no longer care. */
+#define DECL_BIT_INDEX(DECL) DECL_FIELD_SIZE(DECL)
+
/* DECL_LANG_SPECIFIC for FUNCTION_DECLs. */
struct lang_decl
{
@@ -443,8 +456,18 @@ struct lang_decl
tree function_decl_body; /* Hold all function's statements */
tree called_constructor; /* When decl is a constructor, the
list of other constructor it calls. */
+ struct hash_table init_test_table;
+ /* Class initialization test variables. */
+};
+
+/* init_test_table hash table entry structure. */
+struct init_test_hash_entry
+{
+ struct hash_entry root;
+ tree init_test_decl;
};
+
/* DECL_LANG_SPECIFIC for VAR_DECL and PARM_DECL. */
struct lang_decl_var
{
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index a10f605cb75..770cec6bc9b 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -57,6 +57,10 @@ extern struct obstack *saveable_obstack;
extern struct obstack temporary_obstack;
extern struct obstack permanent_obstack;
+/* Set to non-zero value in order to emit class initilization code
+ before static field references. */
+extern int always_initialize_class_p;
+
/* The class we are currently processing. */
tree current_class = NULL_TREE;
@@ -646,6 +650,10 @@ parse_class_file ()
debug_start_source_file (input_filename);
init_outgoing_cpool ();
+ /* Currently we always have to emit calls to _Jv_InitClass when
+ compiling from class files. */
+ always_initialize_class_p = 1;
+
for ( method = TYPE_METHODS (CLASS_TO_HANDLE_TYPE (current_class));
method != NULL_TREE; method = TREE_CHAIN (method))
{
diff --git a/gcc/java/parse.c b/gcc/java/parse.c
index 3341847700f..f8b97b8e4e2 100644
--- a/gcc/java/parse.c
+++ b/gcc/java/parse.c
@@ -1,6 +1,7 @@
/* A Bison parser, made from ./parse.y
- by GNU Bison version 1.28 */
+ by GNU Bison version 1.25
+ */
#define YYBISON 1 /* Identify Bison output. */
@@ -11,113 +12,113 @@
#define yychar java_char
#define yydebug java_debug
#define yynerrs java_nerrs
-#define PLUS_TK 257
-#define MINUS_TK 258
-#define MULT_TK 259
-#define DIV_TK 260
-#define REM_TK 261
-#define LS_TK 262
-#define SRS_TK 263
-#define ZRS_TK 264
-#define AND_TK 265
-#define XOR_TK 266
-#define OR_TK 267
-#define BOOL_AND_TK 268
-#define BOOL_OR_TK 269
-#define EQ_TK 270
-#define NEQ_TK 271
-#define GT_TK 272
-#define GTE_TK 273
-#define LT_TK 274
-#define LTE_TK 275
-#define PLUS_ASSIGN_TK 276
-#define MINUS_ASSIGN_TK 277
-#define MULT_ASSIGN_TK 278
-#define DIV_ASSIGN_TK 279
-#define REM_ASSIGN_TK 280
-#define LS_ASSIGN_TK 281
-#define SRS_ASSIGN_TK 282
-#define ZRS_ASSIGN_TK 283
-#define AND_ASSIGN_TK 284
-#define XOR_ASSIGN_TK 285
-#define OR_ASSIGN_TK 286
-#define PUBLIC_TK 287
-#define PRIVATE_TK 288
-#define PROTECTED_TK 289
-#define STATIC_TK 290
-#define FINAL_TK 291
-#define SYNCHRONIZED_TK 292
-#define VOLATILE_TK 293
-#define TRANSIENT_TK 294
-#define NATIVE_TK 295
-#define PAD_TK 296
-#define ABSTRACT_TK 297
-#define MODIFIER_TK 298
-#define DECR_TK 299
-#define INCR_TK 300
-#define DEFAULT_TK 301
-#define IF_TK 302
-#define THROW_TK 303
-#define BOOLEAN_TK 304
-#define DO_TK 305
-#define IMPLEMENTS_TK 306
-#define THROWS_TK 307
-#define BREAK_TK 308
-#define IMPORT_TK 309
-#define ELSE_TK 310
-#define INSTANCEOF_TK 311
-#define RETURN_TK 312
-#define VOID_TK 313
-#define CATCH_TK 314
-#define INTERFACE_TK 315
-#define CASE_TK 316
-#define EXTENDS_TK 317
-#define FINALLY_TK 318
-#define SUPER_TK 319
-#define WHILE_TK 320
-#define CLASS_TK 321
-#define SWITCH_TK 322
-#define CONST_TK 323
-#define TRY_TK 324
-#define FOR_TK 325
-#define NEW_TK 326
-#define CONTINUE_TK 327
-#define GOTO_TK 328
-#define PACKAGE_TK 329
-#define THIS_TK 330
-#define BYTE_TK 331
-#define SHORT_TK 332
-#define INT_TK 333
-#define LONG_TK 334
-#define CHAR_TK 335
-#define INTEGRAL_TK 336
-#define FLOAT_TK 337
-#define DOUBLE_TK 338
-#define FP_TK 339
-#define ID_TK 340
-#define REL_QM_TK 341
-#define REL_CL_TK 342
-#define NOT_TK 343
-#define NEG_TK 344
-#define ASSIGN_ANY_TK 345
-#define ASSIGN_TK 346
-#define OP_TK 347
-#define CP_TK 348
-#define OCB_TK 349
-#define CCB_TK 350
-#define OSB_TK 351
-#define CSB_TK 352
-#define SC_TK 353
-#define C_TK 354
-#define DOT_TK 355
-#define STRING_LIT_TK 356
-#define CHAR_LIT_TK 357
-#define INT_LIT_TK 358
-#define FP_LIT_TK 359
-#define TRUE_TK 360
-#define FALSE_TK 361
-#define BOOL_LIT_TK 362
-#define NULL_TK 363
+#define PLUS_TK 258
+#define MINUS_TK 259
+#define MULT_TK 260
+#define DIV_TK 261
+#define REM_TK 262
+#define LS_TK 263
+#define SRS_TK 264
+#define ZRS_TK 265
+#define AND_TK 266
+#define XOR_TK 267
+#define OR_TK 268
+#define BOOL_AND_TK 269
+#define BOOL_OR_TK 270
+#define EQ_TK 271
+#define NEQ_TK 272
+#define GT_TK 273
+#define GTE_TK 274
+#define LT_TK 275
+#define LTE_TK 276
+#define PLUS_ASSIGN_TK 277
+#define MINUS_ASSIGN_TK 278
+#define MULT_ASSIGN_TK 279
+#define DIV_ASSIGN_TK 280
+#define REM_ASSIGN_TK 281
+#define LS_ASSIGN_TK 282
+#define SRS_ASSIGN_TK 283
+#define ZRS_ASSIGN_TK 284
+#define AND_ASSIGN_TK 285
+#define XOR_ASSIGN_TK 286
+#define OR_ASSIGN_TK 287
+#define PUBLIC_TK 288
+#define PRIVATE_TK 289
+#define PROTECTED_TK 290
+#define STATIC_TK 291
+#define FINAL_TK 292
+#define SYNCHRONIZED_TK 293
+#define VOLATILE_TK 294
+#define TRANSIENT_TK 295
+#define NATIVE_TK 296
+#define PAD_TK 297
+#define ABSTRACT_TK 298
+#define MODIFIER_TK 299
+#define DECR_TK 300
+#define INCR_TK 301
+#define DEFAULT_TK 302
+#define IF_TK 303
+#define THROW_TK 304
+#define BOOLEAN_TK 305
+#define DO_TK 306
+#define IMPLEMENTS_TK 307
+#define THROWS_TK 308
+#define BREAK_TK 309
+#define IMPORT_TK 310
+#define ELSE_TK 311
+#define INSTANCEOF_TK 312
+#define RETURN_TK 313
+#define VOID_TK 314
+#define CATCH_TK 315
+#define INTERFACE_TK 316
+#define CASE_TK 317
+#define EXTENDS_TK 318
+#define FINALLY_TK 319
+#define SUPER_TK 320
+#define WHILE_TK 321
+#define CLASS_TK 322
+#define SWITCH_TK 323
+#define CONST_TK 324
+#define TRY_TK 325
+#define FOR_TK 326
+#define NEW_TK 327
+#define CONTINUE_TK 328
+#define GOTO_TK 329
+#define PACKAGE_TK 330
+#define THIS_TK 331
+#define BYTE_TK 332
+#define SHORT_TK 333
+#define INT_TK 334
+#define LONG_TK 335
+#define CHAR_TK 336
+#define INTEGRAL_TK 337
+#define FLOAT_TK 338
+#define DOUBLE_TK 339
+#define FP_TK 340
+#define ID_TK 341
+#define REL_QM_TK 342
+#define REL_CL_TK 343
+#define NOT_TK 344
+#define NEG_TK 345
+#define ASSIGN_ANY_TK 346
+#define ASSIGN_TK 347
+#define OP_TK 348
+#define CP_TK 349
+#define OCB_TK 350
+#define CCB_TK 351
+#define OSB_TK 352
+#define CSB_TK 353
+#define SC_TK 354
+#define C_TK 355
+#define DOT_TK 356
+#define STRING_LIT_TK 357
+#define CHAR_LIT_TK 358
+#define INT_LIT_TK 359
+#define FP_LIT_TK 360
+#define TRUE_TK 361
+#define FALSE_TK 362
+#define BOOL_LIT_TK 363
+#define NULL_TK 364
#line 48 "./parse.y"
@@ -448,7 +449,7 @@ typedef union {
#define YYFLAG -32768
#define YYNTBASE 110
-#define YYTRANSLATE(x) ((unsigned)(x) <= 363 ? yytranslate[x] : 267)
+#define YYTRANSLATE(x) ((unsigned)(x) <= 364 ? yytranslate[x] : 267)
static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -476,18 +477,18 @@ static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
- 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
- 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
- 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
- 107, 108, 109
+ 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
+ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ 76, 77, 78, 79, 80, 81, 82, 83, 84, 85,
+ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
+ 106, 107, 108, 109
};
#if YYDEBUG != 0
@@ -2291,8 +2292,7 @@ static const short yycheck[] = { 3,
#define YYPURE 1
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/usr/lib/bison.simple"
-/* This file comes from bison-1.28. */
+#line 3 "/usr/cygnus/gnupro-98r1/share/bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@@ -2309,66 +2309,46 @@ static const short yycheck[] = { 3,
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
-/* This is the parser code that is written into each bison parser
- when the %semantic_parser declaration is not specified in the grammar.
- It was written by Richard Stallman by simplifying the hairy parser
- used when %semantic_parser is specified. */
-
-#ifndef YYSTACK_USE_ALLOCA
-#ifdef alloca
-#define YYSTACK_USE_ALLOCA
-#else /* alloca not defined */
+#ifndef alloca
#ifdef __GNUC__
-#define YYSTACK_USE_ALLOCA
#define alloca __builtin_alloca
#else /* not GNU C. */
-#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
-#define YYSTACK_USE_ALLOCA
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
-/* We think this test detects Watcom and Microsoft C. */
-/* This used to test MSDOS, but that is a bad idea
- since that symbol is in the user namespace. */
-#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
-#if 0 /* No need for malloc.h, which pollutes the namespace;
- instead, just don't use alloca. */
+#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
-#endif
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
-/* I don't know what this was needed for, but it pollutes the namespace.
- So I turned it off. rms, 2 May 1997. */
-/* #include <malloc.h> */
+#include <malloc.h>
#pragma alloca
-#define YYSTACK_USE_ALLOCA
-#else /* not MSDOS, or __TURBOC__, or _AIX */
-#if 0
-#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
- and on HPUX 10. Eventually we can turn this on. */
-#define YYSTACK_USE_ALLOCA
-#define alloca __builtin_alloca
+#else /* not MSDOS, __TURBOC__, or _AIX */
+#ifdef __hpux
+#ifdef __cplusplus
+extern "C" {
+void *alloca (unsigned int);
+};
+#else /* not __cplusplus */
+void *alloca ();
+#endif /* not __cplusplus */
#endif /* __hpux */
-#endif
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
-#endif /* not sparc */
-#endif /* not GNU C */
-#endif /* alloca not defined */
-#endif /* YYSTACK_USE_ALLOCA not defined */
+#endif /* not sparc. */
+#endif /* not GNU C. */
+#endif /* alloca not defined. */
-#ifdef YYSTACK_USE_ALLOCA
-#define YYSTACK_ALLOC alloca
-#else
-#define YYSTACK_ALLOC malloc
-#endif
+/* This is the parser code that is written into each bison parser
+ when the %semantic_parser declaration is not specified in the grammar.
+ It was written by Richard Stallman by simplifying the hairy parser
+ used when %semantic_parser is specified. */
/* Note: there must be only one dollar sign in this file.
It is replaced by the list of actions, each action
@@ -2378,8 +2358,8 @@ static const short yycheck[] = { 3,
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
+#define YYACCEPT return(0)
+#define YYABORT return(1)
#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror.
This remains here temporarily to ease the
@@ -2460,12 +2440,12 @@ int yydebug; /* nonzero means print parse trace */
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif
-
-/* Define __yy_memcpy. Note that the size argument
- should be passed with type unsigned int, because that is what the non-GCC
- definitions require. With GCC, __builtin_memcpy takes an arg
- of type size_t, but it can handle unsigned int. */
+/* Prevent warning if -Wstrict-prototypes. */
+#ifdef __GNUC__
+int yyparse (void);
+#endif
+
#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
#else /* not GNU C or C++ */
@@ -2477,7 +2457,7 @@ static void
__yy_memcpy (to, from, count)
char *to;
char *from;
- unsigned int count;
+ int count;
{
register char *f = from;
register char *t = to;
@@ -2492,10 +2472,10 @@ __yy_memcpy (to, from, count)
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
static void
-__yy_memcpy (char *to, char *from, unsigned int count)
+__yy_memcpy (char *to, char *from, int count)
{
- register char *t = to;
register char *f = from;
+ register char *t = to;
register int i = count;
while (i-- > 0)
@@ -2505,7 +2485,7 @@ __yy_memcpy (char *to, char *from, unsigned int count)
#endif
#endif
-#line 217 "/usr/lib/bison.simple"
+#line 196 "/usr/cygnus/gnupro-98r1/share/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
@@ -2526,15 +2506,6 @@ __yy_memcpy (char *to, char *from, unsigned int count)
#define YYPARSE_PARAM_DECL
#endif /* not YYPARSE_PARAM */
-/* Prevent warning if -Wstrict-prototypes. */
-#ifdef __GNUC__
-#ifdef YYPARSE_PARAM
-int yyparse (void *);
-#else
-int yyparse (void);
-#endif
-#endif
-
int
yyparse(YYPARSE_PARAM_ARG)
YYPARSE_PARAM_DECL
@@ -2563,7 +2534,6 @@ yyparse(YYPARSE_PARAM_ARG)
#endif
int yystacksize = YYINITDEPTH;
- int yyfree_stacks = 0;
#ifdef YYPURE
int yychar;
@@ -2648,32 +2618,18 @@ yynewstate:
if (yystacksize >= YYMAXDEPTH)
{
yyerror("parser stack overflow");
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
-#ifdef YYLSP_NEEDED
- free (yyls);
-#endif
- }
return 2;
}
yystacksize *= 2;
if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
-#ifndef YYSTACK_USE_ALLOCA
- yyfree_stacks = 1;
-#endif
- yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
- __yy_memcpy ((char *)yyss, (char *)yyss1,
- size * (unsigned int) sizeof (*yyssp));
- yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
- __yy_memcpy ((char *)yyvs, (char *)yyvs1,
- size * (unsigned int) sizeof (*yyvsp));
+ yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
+ __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
+ yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
+ __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
- yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
- __yy_memcpy ((char *)yyls, (char *)yyls1,
- size * (unsigned int) sizeof (*yylsp));
+ yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
+ __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
#endif
#endif /* no yyoverflow */
@@ -4841,7 +4797,7 @@ case 496:
break;}
}
/* the action file gets copied in in place of this dollarsign */
-#line 543 "/usr/lib/bison.simple"
+#line 498 "/usr/cygnus/gnupro-98r1/share/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;
@@ -5036,30 +4992,6 @@ yyerrhandle:
yystate = yyn;
goto yynewstate;
-
- yyacceptlab:
- /* YYACCEPT comes here. */
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
-#ifdef YYLSP_NEEDED
- free (yyls);
-#endif
- }
- return 0;
-
- yyabortlab:
- /* YYABORT comes here. */
- if (yyfree_stacks)
- {
- free (yyss);
- free (yyvs);
-#ifdef YYLSP_NEEDED
- free (yyls);
-#endif
- }
- return 1;
}
#line 2375 "./parse.y"
@@ -9222,7 +9154,7 @@ resolve_expression_name (id, orig)
qualify_ambiguous_name (id);
/* 15.10.1 Field Access Using a Primary and/or Expression Name */
/* 15.10.2: Accessing Superclass Members using super */
- return resolve_field_access (id, NULL, NULL);
+ return resolve_field_access (id, orig, NULL);
}
/* We've got an error here */
@@ -9295,21 +9227,7 @@ resolve_field_access (qual_wfl, field_decl, field_type)
return error_mark_node;
if (is_static && !static_final_found
&& !flag_emit_class_files && !flag_emit_xref)
- {
- field_ref = build_class_init (type_found, field_ref);
- /* If the static field was identified by an expression that
- needs to be generated, make the field access a compound
- expression whose first part is the evaluation of the
- field selector part. */
- if (where_found && TREE_CODE (where_found) != TYPE_DECL
- && TREE_CODE (where_found) != RECORD_TYPE)
- {
- tree type = QUAL_DECL_TYPE (field_ref);
- if (TREE_CODE (type) == RECORD_TYPE)
- type = build_pointer_type (type);
- field_ref = build (COMPOUND_EXPR, type, where_found, field_ref);
- }
- }
+ field_ref = build_class_init (type_found, field_ref);
}
else
field_ref = decl;