This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[Java] Last set of cleanups
- From: "Ben Elliston" <bje at au1 dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: java-patches at gcc dot gnu dot org
- Date: 24 Nov 2004 17:05:28 +1100
- Subject: [Java] Last set of cleanups
These are the last of my cleanups in the java/ subdirectory. Tested
with a bootstrap and libjava build on i686-pc-linux-gnu.
Okay for mainline?
2004-11-24 Ben Elliston <bje@au.ibm.com>
* java-tree.h (force_poplevels): Remove declaration.
* decl.c (force_poplevels): Remove.
* lex.c (java_new_lexer): Make static.
* convert.h (convert_to_boolean): Remove declaration.
(convert_to_char): Likewise.
* typeck.c (convert_to_boolean): Make static.
(convert_to_char): Likewise.
* java-tree.h (merge_type_state): Remove extern.
* verify.c (merge_type_state): Make static.
* java-tree.h (find_methodref_index): Remove extern.
(build_internal_class_name): Likewise.
* constants.c (build_internal_class_name): Make static.
(find_methodref_index): Remove.
* java-tree.h (process_jvm_instruction): Remove extern.
(build_get_class): Likewise.
(build_newarray, build_anewarray): Likewise.
* expr.c (process_jvm_instruction): Make static.
(build_newarray, build_anewarray): Likewise.
(build_get_class): Likewise.
Index: constants.c
===================================================================
RCS file: /home/bje/gcc-cvs/gcc/gcc/java/constants.c,v
retrieving revision 1.40
diff -u -p -r1.40 constants.c
--- constants.c 25 Aug 2004 09:52:50 -0000 1.40
+++ constants.c 24 Nov 2004 06:03:39 -0000
@@ -39,6 +39,7 @@ static int find_name_and_type_constant (
static tree get_tag_node (int);
static tree build_constant_data_ref (void);
static CPool *cpool_for_class (tree);
+static tree build_internal_class_name (tree);
/* Set the INDEX'th constant in CPOOL to have the given TAG and VALUE. */
@@ -191,15 +192,6 @@ find_fieldref_index (CPool *cpool, tree
(class_index << 16) | name_type_index);
}
-/* Find (or create) a CONSTANT_Methodref for DECL (a FUNCTION_DECL).
- Return its index in the constant pool CPOOL. */
-
-int
-find_methodref_index (CPool *cpool, tree decl)
-{
- return find_methodref_with_class_index (cpool, decl, DECL_CONTEXT (decl));
-}
-
int
find_methodref_with_class_index (CPool *cpool, tree decl, tree mclass)
{
@@ -358,7 +350,7 @@ alloc_name_constant (int tag, tree name)
/* Build an identifier for the internal name of reference type TYPE. */
-tree
+static tree
build_internal_class_name (tree type)
{
tree name;
Index: convert.h
===================================================================
RCS file: /home/bje/gcc-cvs/gcc/gcc/java/convert.h,v
retrieving revision 1.6
diff -u -p -r1.6 convert.h
--- convert.h 9 Jan 2003 23:16:50 -0000 1.6
+++ convert.h 24 Nov 2004 06:03:39 -0000
@@ -20,8 +20,6 @@ Boston, MA 02111-1307, USA. */
/* Written by Jeffrey Hsu <hsu@cygnus.com> */
-extern tree convert_to_boolean (tree, tree);
-extern tree convert_to_char (tree, tree);
extern tree convert_to_integer (tree type, tree expr);
extern tree convert_to_real (tree type, tree expr);
extern tree convert_to_pointer (tree type, tree expr);
Index: decl.c
===================================================================
RCS file: /home/bje/gcc-cvs/gcc/gcc/java/decl.c,v
retrieving revision 1.203
diff -u -p -r1.203 decl.c
--- decl.c 15 Nov 2004 21:31:47 -0000 1.203
+++ decl.c 24 Nov 2004 06:03:39 -0000
@@ -1636,24 +1636,6 @@ maybe_poplevels (int pc)
poplevel (1, 0, 0);
}
-/* Terminate any binding which began during the range beginning at
- start_pc. This tidies up improperly nested local variable ranges
- and exception handlers; a variable declared within an exception
- range is forcibly terminated when that exception ends. */
-
-void
-force_poplevels (int start_pc)
-{
- while (current_binding_level->start_pc > start_pc)
- {
- if (pedantic && current_binding_level->start_pc > start_pc)
- warning ("%JIn %D: overlapped variable and exception ranges at %d",
- current_function_decl, current_function_decl,
- current_binding_level->start_pc);
- poplevel (1, 0, 0);
- }
-}
-
/* Insert BLOCK at the end of the list of subblocks of the
current binding level. This is used when a BIND_EXPR is expanded,
to handle the BLOCK node inside the BIND_EXPR. */
Index: expr.c
===================================================================
RCS file: /home/bje/gcc-cvs/gcc/gcc/java/expr.c,v
retrieving revision 1.210
diff -u -p -r1.210 expr.c
--- expr.c 9 Nov 2004 14:33:31 -0000 1.210
+++ expr.c 24 Nov 2004 06:03:39 -0000
@@ -86,6 +86,7 @@ static void java_stack_pop (int);
static tree build_java_throw_out_of_bounds_exception (tree);
static tree build_java_check_indexed_type (tree, tree);
static unsigned char peek_opcode_at_pc (struct JCF *, int, int);
+static int process_jvm_instruction (int PC, const unsigned char* byte_ops, long length ATTRIBUTE_UNUSED);
static GTY(()) tree operand_type[59];
@@ -894,7 +895,7 @@ build_java_check_indexed_type (tree arra
called with an integer code (the type of array to create), and the length
of the array to create. */
-tree
+static tree
build_newarray (int atype_value, tree length)
{
tree type_arg;
@@ -924,7 +925,7 @@ build_newarray (int atype_value, tree le
/* Generates anewarray from a given CLASS_TYPE. Gets from the stack the size
of the dimension. */
-tree
+static tree
build_anewarray (tree class_type, tree length)
{
tree type
@@ -1175,7 +1176,7 @@ expand_java_NEW (tree type)
/* This returns an expression which will extract the class of an
object. */
-tree
+static tree
build_get_class (tree value)
{
tree class_field = lookup_field (&dtable_type, get_identifier ("class"));
@@ -2738,7 +2739,7 @@ java_push_constant_from_pool (JCF *jcf,
push_value (c);
}
-int
+static int
process_jvm_instruction (int PC, const unsigned char* byte_ops,
long length ATTRIBUTE_UNUSED)
{
Index: java-tree.h
===================================================================
RCS file: /home/bje/gcc-cvs/gcc/gcc/java/java-tree.h,v
retrieving revision 1.220
diff -u -p -r1.220 java-tree.h
--- java-tree.h 5 Oct 2004 17:07:13 -0000 1.220
+++ java-tree.h 24 Nov 2004 06:03:39 -0000
@@ -1153,7 +1153,6 @@ extern tree layout_class_method (tree, t
extern void layout_class_methods (tree);
extern tree build_class_ref (tree);
extern tree build_dtable_decl (tree);
-extern tree build_internal_class_name (tree);
extern tree build_constants_constructor (void);
extern tree build_ref_from_constant_pool (int);
extern tree build_utf8_ref (tree);
@@ -1209,14 +1208,11 @@ extern tree build_java_soft_divmod (enum
extern tree binary_numeric_promotion (tree, tree, tree *, tree *);
extern tree build_java_arrayaccess (tree, tree, tree);
extern tree build_java_arraystore_check (tree, tree);
-extern tree build_newarray (int, tree);
-extern tree build_anewarray (tree, tree);
extern tree build_new_array (tree, tree);
extern tree build_java_array_length_access (tree);
extern tree build_java_arraynull_check (tree, tree, tree);
extern tree build_java_indirect_ref (tree, tree, int);
extern tree java_check_reference (tree, int);
-extern tree build_get_class (tree);
extern tree build_instanceof (tree, tree);
extern tree create_label_decl (tree);
extern void push_labeled_block (tree);
@@ -1264,11 +1260,8 @@ extern int class_depth (tree);
extern int verify_jvm_instructions (struct JCF *, const unsigned char *, long);
extern void maybe_pushlevels (int);
extern void maybe_poplevels (int);
-extern void force_poplevels (int);
-extern int process_jvm_instruction (int, const unsigned char *, long);
extern int maybe_adjust_start_pc (struct JCF *, int, int, int);
extern void set_local_type (int, tree);
-extern int merge_type_state (tree);
extern int push_type_0 (tree);
extern void push_type (tree);
extern void load_type_state (tree);
@@ -1290,7 +1283,6 @@ extern int find_utf8_constant (struct CP
extern int find_string_constant (struct CPool *, tree);
extern int find_class_constant (struct CPool *, tree);
extern int find_fieldref_index (struct CPool *, tree);
-extern int find_methodref_index (struct CPool *, tree);
extern int find_methodref_with_class_index (struct CPool *, tree, tree);
extern void write_constant_pool (struct CPool *, unsigned char *, int);
extern int count_constant_pool_bytes (struct CPool *);
Index: lex.c
===================================================================
RCS file: /home/bje/gcc-cvs/gcc/gcc/java/lex.c,v
retrieving revision 1.118
diff -u -p -r1.118 lex.c
--- lex.c 16 Oct 2004 18:27:32 -0000 1.118
+++ lex.c 24 Nov 2004 06:03:39 -0000
@@ -67,7 +67,7 @@ static int java_read_unicode (java_lexer
static int utf8_cmp (const unsigned char *, int, const char *);
#endif
-java_lexer *java_new_lexer (FILE *, const char *);
+static java_lexer *java_new_lexer (FILE *, const char *);
#ifndef JC1_LITE
static void error_if_numeric_overflow (tree);
#endif
@@ -155,7 +155,7 @@ java_sprint_unicode (int c)
/* Create a new lexer object. */
-java_lexer *
+static java_lexer *
java_new_lexer (FILE *finput, const char *encoding)
{
java_lexer *lex = xmalloc (sizeof (java_lexer));
Index: typeck.c
===================================================================
RCS file: /home/bje/gcc-cvs/gcc/gcc/java/typeck.c,v
retrieving revision 1.72
diff -u -p -r1.72 typeck.c
--- typeck.c 25 Aug 2004 09:52:53 -0000 1.72
+++ typeck.c 24 Nov 2004 06:03:39 -0000
@@ -39,6 +39,8 @@ The Free Software Foundation is independ
#include "toplev.h"
#include "ggc.h"
+static tree convert_to_boolean (tree, tree);
+static tree convert_to_char (tree, tree);
static tree convert_ieee_real_to_integer (tree, tree);
static tree parse_signature_type (const unsigned char **,
const unsigned char *);
@@ -160,13 +162,13 @@ convert (tree type, tree expr)
}
-tree
+static tree
convert_to_char (tree type, tree expr)
{
return build1 (NOP_EXPR, type, expr);
}
-tree
+static tree
convert_to_boolean (tree type, tree expr)
{
return build1 (NOP_EXPR, type, expr);
Index: verify.c
===================================================================
RCS file: /home/bje/gcc-cvs/gcc/gcc/java/verify.c,v
retrieving revision 1.66
diff -u -p -r1.66 verify.c
--- verify.c 17 Oct 2004 22:51:35 -0000 1.66
+++ verify.c 24 Nov 2004 06:03:39 -0000
@@ -47,6 +47,7 @@ static const char *check_pending_block (
static void type_stack_dup (int, int);
static int start_pc_cmp (const void *, const void *);
static char *pop_argument_types (tree);
+static int merge_type_state (tree label);
extern int stack_pointer;
@@ -246,7 +247,7 @@ merge_types (tree type1, tree type2)
Return -1 if the states are incompatible (i.e. on error),
0 if there was no change, and 1 if there was a change. */
-int
+static int
merge_type_state (tree label)
{
int nlocals = DECL_MAX_LOCALS (current_function_decl);