aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/expr.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>1999-03-21 06:09:25 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>1999-03-21 06:09:25 +0000
commit4bcde32e86ac492878fe06625c7c67139c9c85cc (patch)
tree9f1d36a20bdefbffdac55462d09c82614184fc52 /gcc/java/expr.c
parent9f12f2f3d923f0374f41cf1b90c256bc6afd21e4 (diff)
downloadgcc-4bcde32e86ac492878fe06625c7c67139c9c85cc.zip
gcc-4bcde32e86ac492878fe06625c7c67139c9c85cc.tar.gz
gcc-4bcde32e86ac492878fe06625c7c67139c9c85cc.tar.bz2
Makefile.in (jcf-dump.o): Depend on $(CONFIG_H) $(srcdir)/../system.h and $(JAVA_TREE_H).
* Makefile.in (jcf-dump.o): Depend on $(CONFIG_H) $(srcdir)/../system.h and $(JAVA_TREE_H). (jcf-io.o): Depend on $(JAVA_TREE_H). (mangle.o): Likewise. * check-init.c (check_cond_init): Add static prototype. * class.c (build_java_method_type, hashUtf8String, make_field_value, get_dispatch_vector, get_dispatch_table, append_gpp_mangled_type, mangle_static_field): Likewise. (strLengthUtf8): Hide unused definition. (hashUtf8String): Const-ify. (make_field_value): Un-ANSI-fy. * constants.c: Move inclusion of jcf.h above java-tree.h. (set_constant_entry, find_class_or_string_constant, find_name_and_type_constant, get_tag_node, build_constant_data_ref): Add static prototype. * decl.c (push_jvm_slot, builtin_function, lookup_name_current_level): Likewise. (builtin_function): Const-ify. * except.c (expand_start_java_handler, expand_end_java_handler): Add static prototype. * expr.c (flush_quick_stack, push_value, pop_value, java_stack_swap, java_stack_dup, build_java_athrow, build_java_jsr, build_java_ret, expand_java_multianewarray, expand_java_arraystore, expand_java_arrayload, expand_java_array_length, build_java_monitor, expand_java_pushc, expand_java_return, expand_java_NEW, expand_java_INSTANCEOF, expand_java_CHECKCAST, expand_iinc, expand_java_binop, note_label, expand_compare, expand_test, expand_cond, expand_java_goto, expand_java_call, expand_java_ret, pop_arguments, expand_invoke, expand_java_field_op, java_push_constant_from_pool): Likewise. (decode_newarray_type, expand_iinc): Un-ANSI-fy. (build_java_arraynull_check): Mark parameters `node' and `type' with ATTRIBUTE_UNUSED. (note_label): Likewise for parameter `current_pc'. (expand_java_call, expand_java_ret): Hide unused definition. * java-tree.h (make_class, build_constants_constructor, java_set_exception_lang_code, pop_labeled_block, emit_handlers, init_outgoing_cpool, register_class, emit_register_classes, java_layout_seen_class_methods): Prototype. (unicode_mangling_length): Const-ify. (append_gpp_mangled_name, append_gpp_mangled_classtype, emit_unicode_mangled_name, format_int, format_uint, jcf_trim_old_input, jcf_print_utf8, jcf_print_char, jcf_print_utf8_replace, open_class): Prototype. * jcf-dump.c: Include "config.h", not <config.h>. Don't include <stdio.h>. Include tree.h/java-tree.h. (utf8_equal_string usage, process_class): Add static prototype. (open_class): Don't prototype this here. (utf8_equal_string): Match arguments to format specifiers. (HANDLE_CODE_ATTRIBUTE, BRANCH, JSR, RET, LOOKUP_SWITCH, TABLE_SWITCH, disassemble_method): Likewise. * jcf-io.c: Include tree.h/java-tree.h. (open_class, find_classfile, jcf_print_utf8, jcf_print_utf8_replace): Const-ify. * jcf-parse.c (parse_zip_file_entries, process_zip_dir, parse_class_file): Add static prototype. (find_in_current_zip): Match definition to existing static prototype. * jcf-write.c: Include jcf.h before tree.h/java-tree.h. (alloc_chunk, append_chunk, append_chunk_copy, gen_jcf_label, finish_jcf_block, define_jcf_label, get_jcf_label_here, put_linenumber, localvar_alloc, localvar_free, get_access_flags, write_chunks, adjust_typed_op, generate_bytecode_conditional, generate_bytecode_return, perform_relocations, init_jcf_state, init_jcf_method, release_jcf_state, generate_classfile): Add static prototype. (emit_unop): Mark parameter `type' with ATTRIBUTE_UNUSED. (make_class_file_name): Const-ify. * jcf.h (find_classfile): Const-ify. * jv-scan.c (reset_report): Remove prototype. * jvgenmain.c: Include jcf.h/tree.h/java-tree.h. (error): Rewrite to allow varargs. * lang.c (lang_f_options): Const-ify. * lex.c (java_parse_escape_sequence): Add static prototype. (java_allocate_new_line): Match definition to existing static prototype. * mangle.c Include tree.h/java-tree.h. (unicode_mangling_length, emit_unicode_mangled_name, append_gpp_mangled_name, append_gpp_mangled_classtype): Const-ify. * parse.h (jdep_code): Remove trailing comma in enumeration. (java_get_line_col): Move prototype outside of !JC1_LITE test. (reset_report): Add prototype. * verify.c (push_pending_label, merge_types): Add static prototypes. * zipfile.h (opendir_in_zip, open_in_zip): Prototype. From-SVN: r25878
Diffstat (limited to 'gcc/java/expr.c')
-rw-r--r--gcc/java/expr.c118
1 files changed, 79 insertions, 39 deletions
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 15ac0c2..268861d 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -40,6 +40,40 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "toplev.h"
#include "except.h"
+static void flush_quick_stack PROTO ((void));
+static void push_value PROTO ((tree));
+static tree pop_value PROTO ((tree));
+static void java_stack_swap PROTO ((void));
+static void java_stack_dup PROTO ((int, int));
+static tree build_java_athrow PROTO ((tree));
+static void build_java_jsr PROTO ((tree, tree));
+static void build_java_ret PROTO ((tree));
+static void expand_java_multianewarray PROTO ((tree, int));
+static void expand_java_arraystore PROTO ((tree));
+static void expand_java_arrayload PROTO ((tree));
+static void expand_java_array_length PROTO ((void));
+static tree build_java_monitor PROTO ((tree, tree));
+static void expand_java_pushc PROTO ((int, tree));
+static void expand_java_return PROTO ((tree));
+static void expand_java_NEW PROTO ((tree));
+static void expand_java_INSTANCEOF PROTO ((tree));
+static void expand_java_CHECKCAST PROTO ((tree));
+static void expand_iinc PROTO ((unsigned int, int, int));
+static void expand_java_binop PROTO ((tree, enum tree_code));
+static void note_label PROTO ((int, int));
+static void expand_compare PROTO ((enum tree_code, tree, tree, int));
+static void expand_test PROTO ((enum tree_code, tree, int));
+static void expand_cond PROTO ((enum tree_code, tree, int));
+static void expand_java_goto PROTO ((int));
+#if 0
+static void expand_java_call PROTO ((int, int));
+static void expand_java_ret PROTO ((tree));
+#endif
+static tree pop_arguments PROTO ((tree));
+static void expand_invoke PROTO ((int, int, int));
+static void expand_java_field_op PROTO ((int, int, int));
+static void java_push_constant_from_pool PROTO ((struct JCF *, int));
+
static tree operand_type[59];
extern struct obstack permanent_obstack;
@@ -168,7 +202,7 @@ unhand_expr (expr)
that the expression for a slot may contain decls for stack slots with
higher (or the same) index, but not lower. */
-void
+static void
flush_quick_stack ()
{
int stack_index = stack_pointer;
@@ -216,7 +250,7 @@ push_type (type)
stack_type_map[stack_pointer++] = TYPE_SECOND;
}
-void
+static void
push_value (value)
tree value;
{
@@ -353,7 +387,7 @@ can_widen_reference_to (source_type, target_type)
}
}
-tree
+static tree
pop_value (type)
tree type;
{
@@ -374,7 +408,7 @@ pop_value (type)
/* Pop and discrad the top COUNT stack slots. */
-void
+static void
java_stack_pop (count)
int count;
{
@@ -398,7 +432,7 @@ java_stack_pop (count)
/* Implement the 'swap' operator (to swap two top stack slots). */
-void
+static void
java_stack_swap ()
{
tree type1, type2;
@@ -422,7 +456,7 @@ java_stack_swap ()
stack_type_map[stack_pointer - 2] = type1;
}
-void
+static void
java_stack_dup (size, offset)
int size, offset;
{
@@ -467,7 +501,7 @@ java_stack_dup (size, offset)
/* Calls _Jv_Throw. Discard the contents of the value stack. */
-tree
+static tree
build_java_athrow (node)
tree node;
{
@@ -485,7 +519,7 @@ build_java_athrow (node)
/* Implementation for jsr/ret */
-void
+static void
build_java_jsr (where, ret)
tree where;
tree ret;
@@ -497,7 +531,7 @@ build_java_jsr (where, ret)
expand_label (ret);
}
-void
+static void
build_java_ret (location)
tree location;
{
@@ -515,7 +549,8 @@ build_java_ret (location)
size_int (BITS_PER_UNIT))
tree
-decode_newarray_type (int atype)
+decode_newarray_type (atype)
+ int atype;
{
switch (atype)
{
@@ -599,9 +634,9 @@ build_java_array_length_access (node)
tree
build_java_arraynull_check (node, expr, type)
- tree node;
- tree expr;
- tree type;
+ tree node ATTRIBUTE_UNUSED;
+ tree expr;
+ tree type ATTRIBUTE_UNUSED;
{
#if 0
static int java_array_access_throws_null_exception = 0;
@@ -768,7 +803,7 @@ build_new_array (type, length)
class pointer, a number of dimensions and the matching number of
dimensions. The argument list is NULL terminated. */
-void
+static void
expand_java_multianewarray (class_type, ndim)
tree class_type;
int ndim;
@@ -798,7 +833,7 @@ expand_java_multianewarray (class_type, ndim)
to make sure that the RHS can be assigned to the array element
type. It is not necessary to generate this code if ARRAY is final. */
-void
+static void
expand_java_arraystore (rhs_type_node)
tree rhs_type_node;
{
@@ -840,7 +875,7 @@ expand_java_arraystore (rhs_type_node)
BOOLEAN/SHORT, we push a promoted type back to the stack.
*/
-void
+static void
expand_java_arrayload (lhs_type_node )
tree lhs_type_node;
{
@@ -864,7 +899,7 @@ expand_java_arrayload (lhs_type_node )
/* Expands .length. Makes sure that we deal with and array and may expand
a NULL check on the array object. */
-void
+static void
expand_java_array_length ()
{
tree array = pop_value (ptr_type_node);
@@ -876,7 +911,7 @@ expand_java_array_length ()
/* Emit code for the call to _Jv_Monitor{Enter,Exit}. CALL can be
either soft_monitorenter_node or soft_monitorexit_node. */
-tree
+static tree
build_java_monitor (call, object)
tree call;
tree object;
@@ -890,7 +925,7 @@ build_java_monitor (call, object)
/* Emit code for one of the PUSHC instructions. */
-void
+static void
expand_java_pushc (ival, type)
int ival;
tree type;
@@ -918,7 +953,7 @@ expand_java_pushc (ival, type)
push_value (value);
}
-void
+static void
expand_java_return (type)
tree type;
{
@@ -941,7 +976,7 @@ build_address_of (value)
return build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (value)), value);
}
-void
+static void
expand_java_NEW (type)
tree type;
{
@@ -956,7 +991,7 @@ expand_java_NEW (type)
NULL_TREE));
}
-void
+static void
expand_java_INSTANCEOF (type)
tree type;
{
@@ -970,7 +1005,7 @@ expand_java_INSTANCEOF (type)
push_value (value);
}
-void
+static void
expand_java_CHECKCAST (type)
tree type;
{
@@ -983,8 +1018,11 @@ expand_java_CHECKCAST (type)
push_value (value);
}
-void
-expand_iinc (unsigned int local_var_index, int ival, int pc)
+static void
+expand_iinc (local_var_index, ival, pc)
+ unsigned int local_var_index;
+ int ival;
+ int pc;
{
tree local_var, res;
tree constant_value;
@@ -1070,7 +1108,7 @@ build_java_binop (op, type, arg1, arg2)
return fold (build (op, type, arg1, arg2));
}
-void
+static void
expand_java_binop (type, op)
tree type; enum tree_code op;
{
@@ -1205,9 +1243,9 @@ create_label_decl (name)
/* This maps a bytecode offset (PC) to various flags. */
char *instruction_bits;
-void
+static void
note_label (current_pc, target_pc)
- int current_pc, target_pc;
+ int current_pc ATTRIBUTE_UNUSED, target_pc;
{
lookup_label (target_pc);
instruction_bits [target_pc] |= BCODE_JUMP_TARGET;
@@ -1216,7 +1254,7 @@ note_label (current_pc, target_pc)
/* Emit code to jump to TARGET_PC if VALUE1 CONDITION VALUE2,
where CONDITION is one of one the compare operators. */
-void
+static void
expand_compare (condition, value1, value2, target_pc)
enum tree_code condition;
tree value1, value2;
@@ -1231,7 +1269,7 @@ expand_compare (condition, value1, value2, target_pc)
/* Emit code for a TEST-type opcode. */
-void
+static void
expand_test (condition, type, target_pc)
enum tree_code condition;
tree type;
@@ -1246,7 +1284,7 @@ expand_test (condition, type, target_pc)
/* Emit code for a COND-type opcode. */
-void
+static void
expand_cond (condition, type, target_pc)
enum tree_code condition;
tree type;
@@ -1261,7 +1299,7 @@ expand_cond (condition, type, target_pc)
expand_compare (condition, value1, value2, target_pc);
}
-void
+static void
expand_java_goto (target_pc)
int target_pc;
{
@@ -1270,7 +1308,8 @@ expand_java_goto (target_pc)
expand_goto (target_label);
}
-void
+#if 0
+static void
expand_java_call (target_pc, return_address)
int target_pc, return_address;
{
@@ -1281,9 +1320,9 @@ expand_java_call (target_pc, return_address)
expand_goto (target_label);
}
-void
+static void
expand_java_ret (return_address)
- tree return_address;
+ tree return_address ATTRIBUTE_UNUSED;
{
warning ("ret instruction not implemented");
#if 0
@@ -1292,6 +1331,7 @@ expand_java_ret (return_address)
expand_goto (target_label);
#endif
}
+#endif
/* Recursive helper function to pop argument types during verifiation. */
@@ -1310,7 +1350,7 @@ pop_argument_types (arg_types)
abort ();
}
-tree
+static tree
pop_arguments (arg_types)
tree arg_types;
{
@@ -1492,7 +1532,7 @@ build_invokeinterface (dtable, method_name, method_signature)
METHOD_REF_INDEX is an index into the constant pool.
NARGS is the number of arguments, or -1 if not specified. */
-void
+static void
expand_invoke (opcode, method_ref_index, nargs)
int opcode;
int method_ref_index;
@@ -1599,7 +1639,7 @@ expand_invoke (opcode, method_ref_index, nargs)
IS_PUTTING is 1 for putting into a field; 0 for getting from the field.
FIELD_REF_INDEX is an index into the constant pool. */
-void
+static void
expand_java_field_op (is_static, is_putting, field_ref_index)
int is_static;
int is_putting;
@@ -2131,7 +2171,7 @@ expand_byte_code (jcf, method)
} /* for */
}
-void
+static void
java_push_constant_from_pool (jcf, index)
JCF *jcf;
int index;