Commit 4bcde32e by Kaveh R. Ghazi Committed by Kaveh Ghazi

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
parent 9f12f2f3
Sun Mar 21 08:30:30 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* 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.
1999-03-19 Alexandre Petit-Bianco <apbianco@cygnus.com> 1999-03-19 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (find_applicable_accessible_methods_list): Extend the * parse.y (find_applicable_accessible_methods_list): Extend the
......
...@@ -274,7 +274,8 @@ clean: mostlyclean ...@@ -274,7 +274,8 @@ clean: mostlyclean
force: force:
parse.o : $(PARSE_C) jcf-reader.c $(CONFIG_H) $(srcdir)/../system.h parse.o : $(PARSE_C) jcf-reader.c $(CONFIG_H) $(srcdir)/../system.h
jcf-dump.o : jcf-dump.c jcf-reader.c jcf.h javaop.h javaop.def jcf-dump.o : $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H) jcf-dump.c \
jcf-reader.c jcf.h javaop.h javaop.def
gjavah.o : $(CONFIG_H) $(srcdir)/../system.h gjavah.c \ gjavah.o : $(CONFIG_H) $(srcdir)/../system.h gjavah.c \
jcf-reader.c jcf.h javaop.h jcf-reader.c jcf.h javaop.h
buffer.o : buffer.c $(CONFIG_H) buffer.h $(srcdir)/../gansidecl.h \ buffer.o : buffer.c $(CONFIG_H) buffer.h $(srcdir)/../gansidecl.h \
...@@ -297,7 +298,7 @@ expr.o : expr.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \ ...@@ -297,7 +298,7 @@ expr.o : expr.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \
java-except.h java-except.h parse.h $(srcdir)/../toplev.h \ java-except.h java-except.h parse.h $(srcdir)/../toplev.h \
$(srcdir)/../system.h $(srcdir)/../system.h
jcf-depend.o : jcf-depend.c $(CONFIG_H) $(srcdir)/../system.h jcf.h jcf-depend.o : jcf-depend.c $(CONFIG_H) $(srcdir)/../system.h jcf.h
jcf-io.o : jcf-io.c $(CONFIG_H) $(srcdir)/../system.h jcf-io.o : jcf-io.c $(CONFIG_H) $(srcdir)/../system.h $(JAVA_TREE_H)
jcf-parse.o : jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(srcdir)/../flags.h \ jcf-parse.o : jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../input.h java-except.h $(srcdir)/../system.h \ $(srcdir)/../input.h java-except.h $(srcdir)/../system.h \
$(srcdir)/../toplev.h $(PARSE_H) $(srcdir)/../toplev.h $(PARSE_H)
...@@ -307,7 +308,7 @@ jv-scan.o : jv-scan.c $(CONFIG_H) $(srcdir)/../system.h ...@@ -307,7 +308,7 @@ jv-scan.o : jv-scan.c $(CONFIG_H) $(srcdir)/../system.h
jvgenmain.o : jvgenmain.c $(CONFIG_H) $(srcdir)/../system.h jvgenmain.o : jvgenmain.c $(CONFIG_H) $(srcdir)/../system.h
lang.o : lang.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../input.h \ lang.o : lang.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../input.h \
$(srcdir)/../toplev.h $(srcdir)/../system.h $(srcdir)/../toplev.h $(srcdir)/../system.h
mangle.o : mangle.c $(CONFIG_H) jcf.h $(srcdir)/../system.h \ mangle.o : mangle.c $(CONFIG_H) jcf.h $(JAVA_TREE_H) $(srcdir)/../system.h \
$(srcdir)/../toplev.h $(srcdir)/../toplev.h
parse-scan.o : $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../toplev.h parse-scan.o : $(CONFIG_H) $(srcdir)/../system.h $(srcdir)/../toplev.h
typeck.o : typeck.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h convert.h \ typeck.o : typeck.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h convert.h \
......
...@@ -99,6 +99,7 @@ static tree wfl; ...@@ -99,6 +99,7 @@ static tree wfl;
static void check_bool_init PROTO ((tree, words, words, words)); static void check_bool_init PROTO ((tree, words, words, words));
static void check_init PROTO ((tree, words)); static void check_init PROTO ((tree, words));
static void check_cond_init PROTO ((tree, tree, tree, words, words, words));
#if 0 #if 0
#define ALLOC_WORDS(NUM) ((word*) xmalloc ((NUM) * sizeof (word))) #define ALLOC_WORDS(NUM) ((word*) xmalloc ((NUM) * sizeof (word)))
...@@ -123,7 +124,7 @@ static void check_init PROTO ((tree, words)); ...@@ -123,7 +124,7 @@ static void check_init PROTO ((tree, words));
definite assignment. definite assignment.
BEFORE, WHEN_FALSE, and WHEN_TRUE are as in check_bool_init. */ BEFORE, WHEN_FALSE, and WHEN_TRUE are as in check_bool_init. */
void static void
check_cond_init (test_exp, then_exp, else_exp, check_cond_init (test_exp, then_exp, else_exp,
before, when_false, when_true) before, when_false, when_true)
tree test_exp, then_exp, else_exp; tree test_exp, then_exp, else_exp;
......
...@@ -38,6 +38,13 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -38,6 +38,13 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
static tree mangle_class_field PROTO ((tree class)); static tree mangle_class_field PROTO ((tree class));
static tree make_method_value PROTO ((tree)); static tree make_method_value PROTO ((tree));
static tree build_java_method_type PROTO ((tree, tree, int));
static int32 hashUtf8String PROTO ((const char *, int));
static tree make_field_value PROTO ((tree));
static tree get_dispatch_vector PROTO ((tree));
static tree get_dispatch_table PROTO ((tree, tree));
static void append_gpp_mangled_type PROTO ((struct obstack *, tree));
static tree mangle_static_field PROTO ((tree));
static rtx registerClass_libfunc; static rtx registerClass_libfunc;
...@@ -382,7 +389,7 @@ find_named_method (list, name) ...@@ -382,7 +389,7 @@ find_named_method (list, name)
} }
#endif #endif
tree static tree
build_java_method_type (fntype, this_class, access_flags) build_java_method_type (fntype, this_class, access_flags)
tree fntype; tree fntype;
tree this_class; tree this_class;
...@@ -503,6 +510,7 @@ set_constant_value (field, constant) ...@@ -503,6 +510,7 @@ set_constant_value (field, constant)
/* Count the number of Unicode chars encoded in a given Ut8 string. */ /* Count the number of Unicode chars encoded in a given Ut8 string. */
#if 0
int int
strLengthUtf8 (str, len) strLengthUtf8 (str, len)
char *str; char *str;
...@@ -517,19 +525,20 @@ strLengthUtf8 (str, len) ...@@ -517,19 +525,20 @@ strLengthUtf8 (str, len)
} }
return str_length; return str_length;
} }
#endif
/* Calculate a hash value for a string encoded in Utf8 format. /* Calculate a hash value for a string encoded in Utf8 format.
* This returns the same hash value as specified for java.lang.String.hashCode. * This returns the same hash value as specified for java.lang.String.hashCode.
*/ */
int32 static int32
hashUtf8String (str, len) hashUtf8String (str, len)
char *str; const char *str;
int len; int len;
{ {
register unsigned char* ptr = (unsigned char*) str; register const unsigned char* ptr = (const unsigned char*) str;
register unsigned char *limit = ptr + len; register const unsigned char *limit = ptr + len;
int32 hash = 0; int32 hash = 0;
for (; ptr < limit;) for (; ptr < limit;)
{ {
...@@ -841,8 +850,9 @@ get_access_flags_from_decl (decl) ...@@ -841,8 +850,9 @@ get_access_flags_from_decl (decl)
abort (); abort ();
} }
tree static tree
make_field_value (tree fdecl) make_field_value (fdecl)
tree fdecl;
{ {
tree finit, info; tree finit, info;
int bsize, flags; int bsize, flags;
...@@ -917,7 +927,7 @@ make_method_value (mdecl) ...@@ -917,7 +927,7 @@ make_method_value (mdecl)
return minit; return minit;
} }
tree static tree
get_dispatch_vector (type) get_dispatch_vector (type)
tree type; tree type;
{ {
...@@ -950,7 +960,7 @@ get_dispatch_vector (type) ...@@ -950,7 +960,7 @@ get_dispatch_vector (type)
return vtable; return vtable;
} }
tree static tree
get_dispatch_table (type, this_class_addr) get_dispatch_table (type, this_class_addr)
tree type, this_class_addr; tree type, this_class_addr;
{ {
...@@ -1258,7 +1268,7 @@ is_compiled_class (class) ...@@ -1258,7 +1268,7 @@ is_compiled_class (class)
/* Append the mangled name of TYPE onto OBSTACK. */ /* Append the mangled name of TYPE onto OBSTACK. */
void static void
append_gpp_mangled_type (obstack, type) append_gpp_mangled_type (obstack, type)
struct obstack *obstack; struct obstack *obstack;
tree type; tree type;
...@@ -1333,7 +1343,7 @@ mangle_class_field (class) ...@@ -1333,7 +1343,7 @@ mangle_class_field (class)
/* Build the mangled (assembly-level) name of the static field FIELD. */ /* Build the mangled (assembly-level) name of the static field FIELD. */
tree static tree
mangle_static_field (field) mangle_static_field (field)
tree field; tree field;
{ {
......
...@@ -23,16 +23,22 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -23,16 +23,22 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
#include "jcf.h"
#include "tree.h" #include "tree.h"
#include "java-tree.h" #include "java-tree.h"
#include "jcf.h"
#include "toplev.h" #include "toplev.h"
extern struct obstack permanent_obstack; extern struct obstack permanent_obstack;
static void set_constant_entry PROTO ((CPool *, int, int, jword));
static int find_class_or_string_constant PROTO ((CPool *, int, tree));
static int find_name_and_type_constant PROTO ((CPool *, tree, tree));
static tree get_tag_node PROTO ((int));
static tree build_constant_data_ref PROTO ((void));
/* Set the INDEX'th constant in CPOOL to have the given TAG and VALUE. */ /* Set the INDEX'th constant in CPOOL to have the given TAG and VALUE. */
void static void
set_constant_entry (cpool, index, tag, value) set_constant_entry (cpool, index, tag, value)
CPool *cpool; CPool *cpool;
int index; int index;
...@@ -113,7 +119,7 @@ find_utf8_constant (cpool, name) ...@@ -113,7 +119,7 @@ find_utf8_constant (cpool, name)
return find_constant1 (cpool, CONSTANT_Utf8, (jword) name); return find_constant1 (cpool, CONSTANT_Utf8, (jword) name);
} }
int static int
find_class_or_string_constant (cpool, tag, name) find_class_or_string_constant (cpool, tag, name)
CPool *cpool; CPool *cpool;
int tag; int tag;
...@@ -155,7 +161,7 @@ find_string_constant (cpool, string) ...@@ -155,7 +161,7 @@ find_string_constant (cpool, string)
/* Find (or create) a CONSTANT_NameAndType matching NAME and TYPE. /* Find (or create) a CONSTANT_NameAndType matching NAME and TYPE.
Return its index in the constant pool CPOOL. */ Return its index in the constant pool CPOOL. */
int static int
find_name_and_type_constant (cpool, name, type) find_name_and_type_constant (cpool, name, type)
CPool *cpool; CPool *cpool;
tree name; tree name;
...@@ -316,7 +322,7 @@ tree current_constant_pool_data_ref; ...@@ -316,7 +322,7 @@ tree current_constant_pool_data_ref;
/* A Cache for build_int_2 (CONSTANT_XXX, 0). */ /* A Cache for build_int_2 (CONSTANT_XXX, 0). */
static tree tag_nodes[13]; static tree tag_nodes[13];
tree static tree
get_tag_node (tag) get_tag_node (tag)
int tag; int tag;
{ {
...@@ -378,7 +384,7 @@ alloc_class_constant (clas) ...@@ -378,7 +384,7 @@ alloc_class_constant (clas)
/* Return a reference to the data array of the current constant pool. */ /* Return a reference to the data array of the current constant pool. */
tree static tree
build_constant_data_ref () build_constant_data_ref ()
{ {
if (current_constant_pool_data_ref == NULL_TREE) if (current_constant_pool_data_ref == NULL_TREE)
......
...@@ -33,6 +33,11 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -33,6 +33,11 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "jcf.h" #include "jcf.h"
#include "toplev.h" #include "toplev.h"
static tree push_jvm_slot PROTO ((int, tree));
static tree builtin_function PROTO ((const char *, tree,
enum built_in_function, const char *));
static tree lookup_name_current_level PROTO ((tree));
#ifndef INT_TYPE_SIZE #ifndef INT_TYPE_SIZE
#define INT_TYPE_SIZE BITS_PER_WORD #define INT_TYPE_SIZE BITS_PER_WORD
#endif #endif
...@@ -55,7 +60,7 @@ tree pending_local_decls = NULL_TREE; ...@@ -55,7 +60,7 @@ tree pending_local_decls = NULL_TREE;
/* Push a local variable or stack slot into the decl_map, /* Push a local variable or stack slot into the decl_map,
and assign it an rtl. */ and assign it an rtl. */
tree static tree
push_jvm_slot (index, decl) push_jvm_slot (index, decl)
int index; int index;
tree decl; tree decl;
...@@ -396,12 +401,12 @@ tree integer_negative_one_node; ...@@ -396,12 +401,12 @@ tree integer_negative_one_node;
If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME, If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
the name to be called if we can't opencode the function. */ the name to be called if we can't opencode the function. */
tree static tree
builtin_function (name, type, function_code, library_name) builtin_function (name, type, function_code, library_name)
char *name; const char *name;
tree type; tree type;
enum built_in_function function_code; enum built_in_function function_code;
char *library_name; const char *library_name;
{ {
tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type); tree decl = build_decl (FUNCTION_DECL, get_identifier (name), type);
DECL_EXTERNAL (decl) = 1; DECL_EXTERNAL (decl) = 1;
...@@ -811,7 +816,7 @@ lookup_name (name) ...@@ -811,7 +816,7 @@ lookup_name (name)
/* Similar to `lookup_name' but look only at current binding level and /* Similar to `lookup_name' but look only at current binding level and
the previous one if its the parameter level. */ the previous one if its the parameter level. */
tree static tree
lookup_name_current_level (name) lookup_name_current_level (name)
tree name; tree name;
{ {
......
...@@ -36,6 +36,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -36,6 +36,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "eh-common.h" #include "eh-common.h"
#include "toplev.h" #include "toplev.h"
static void expand_start_java_handler PROTO ((struct eh_range *));
static void expand_end_java_handler PROTO ((struct eh_range *));
extern struct obstack permanent_obstack; extern struct obstack permanent_obstack;
struct eh_range *current_method_handlers; struct eh_range *current_method_handlers;
...@@ -182,7 +185,7 @@ add_handler (start_pc, end_pc, handler, type) ...@@ -182,7 +185,7 @@ add_handler (start_pc, end_pc, handler, type)
/* if there are any handlers for this range, issue start of region */ /* if there are any handlers for this range, issue start of region */
void static void
expand_start_java_handler (range) expand_start_java_handler (range)
struct eh_range *range ATTRIBUTE_UNUSED; struct eh_range *range ATTRIBUTE_UNUSED;
{ {
...@@ -217,7 +220,7 @@ prepare_eh_table_type (type) ...@@ -217,7 +220,7 @@ prepare_eh_table_type (type)
/* if there are any handlers for this range, isssue end of range, /* if there are any handlers for this range, isssue end of range,
and then all handler blocks */ and then all handler blocks */
void static void
expand_end_java_handler (range) expand_end_java_handler (range)
struct eh_range *range; struct eh_range *range;
{ {
......
...@@ -40,6 +40,40 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -40,6 +40,40 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "toplev.h" #include "toplev.h"
#include "except.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]; static tree operand_type[59];
extern struct obstack permanent_obstack; extern struct obstack permanent_obstack;
...@@ -168,7 +202,7 @@ unhand_expr (expr) ...@@ -168,7 +202,7 @@ unhand_expr (expr)
that the expression for a slot may contain decls for stack slots with that the expression for a slot may contain decls for stack slots with
higher (or the same) index, but not lower. */ higher (or the same) index, but not lower. */
void static void
flush_quick_stack () flush_quick_stack ()
{ {
int stack_index = stack_pointer; int stack_index = stack_pointer;
...@@ -216,7 +250,7 @@ push_type (type) ...@@ -216,7 +250,7 @@ push_type (type)
stack_type_map[stack_pointer++] = TYPE_SECOND; stack_type_map[stack_pointer++] = TYPE_SECOND;
} }
void static void
push_value (value) push_value (value)
tree value; tree value;
{ {
...@@ -353,7 +387,7 @@ can_widen_reference_to (source_type, target_type) ...@@ -353,7 +387,7 @@ can_widen_reference_to (source_type, target_type)
} }
} }
tree static tree
pop_value (type) pop_value (type)
tree type; tree type;
{ {
...@@ -374,7 +408,7 @@ pop_value (type) ...@@ -374,7 +408,7 @@ pop_value (type)
/* Pop and discrad the top COUNT stack slots. */ /* Pop and discrad the top COUNT stack slots. */
void static void
java_stack_pop (count) java_stack_pop (count)
int count; int count;
{ {
...@@ -398,7 +432,7 @@ java_stack_pop (count) ...@@ -398,7 +432,7 @@ java_stack_pop (count)
/* Implement the 'swap' operator (to swap two top stack slots). */ /* Implement the 'swap' operator (to swap two top stack slots). */
void static void
java_stack_swap () java_stack_swap ()
{ {
tree type1, type2; tree type1, type2;
...@@ -422,7 +456,7 @@ java_stack_swap () ...@@ -422,7 +456,7 @@ java_stack_swap ()
stack_type_map[stack_pointer - 2] = type1; stack_type_map[stack_pointer - 2] = type1;
} }
void static void
java_stack_dup (size, offset) java_stack_dup (size, offset)
int size, offset; int size, offset;
{ {
...@@ -467,7 +501,7 @@ java_stack_dup (size, offset) ...@@ -467,7 +501,7 @@ java_stack_dup (size, offset)
/* Calls _Jv_Throw. Discard the contents of the value stack. */ /* Calls _Jv_Throw. Discard the contents of the value stack. */
tree static tree
build_java_athrow (node) build_java_athrow (node)
tree node; tree node;
{ {
...@@ -485,7 +519,7 @@ build_java_athrow (node) ...@@ -485,7 +519,7 @@ build_java_athrow (node)
/* Implementation for jsr/ret */ /* Implementation for jsr/ret */
void static void
build_java_jsr (where, ret) build_java_jsr (where, ret)
tree where; tree where;
tree ret; tree ret;
...@@ -497,7 +531,7 @@ build_java_jsr (where, ret) ...@@ -497,7 +531,7 @@ build_java_jsr (where, ret)
expand_label (ret); expand_label (ret);
} }
void static void
build_java_ret (location) build_java_ret (location)
tree location; tree location;
{ {
...@@ -515,7 +549,8 @@ build_java_ret (location) ...@@ -515,7 +549,8 @@ build_java_ret (location)
size_int (BITS_PER_UNIT)) size_int (BITS_PER_UNIT))
tree tree
decode_newarray_type (int atype) decode_newarray_type (atype)
int atype;
{ {
switch (atype) switch (atype)
{ {
...@@ -599,9 +634,9 @@ build_java_array_length_access (node) ...@@ -599,9 +634,9 @@ build_java_array_length_access (node)
tree tree
build_java_arraynull_check (node, expr, type) build_java_arraynull_check (node, expr, type)
tree node; tree node ATTRIBUTE_UNUSED;
tree expr; tree expr;
tree type; tree type ATTRIBUTE_UNUSED;
{ {
#if 0 #if 0
static int java_array_access_throws_null_exception = 0; static int java_array_access_throws_null_exception = 0;
...@@ -768,7 +803,7 @@ build_new_array (type, length) ...@@ -768,7 +803,7 @@ build_new_array (type, length)
class pointer, a number of dimensions and the matching number of class pointer, a number of dimensions and the matching number of
dimensions. The argument list is NULL terminated. */ dimensions. The argument list is NULL terminated. */
void static void
expand_java_multianewarray (class_type, ndim) expand_java_multianewarray (class_type, ndim)
tree class_type; tree class_type;
int ndim; int ndim;
...@@ -798,7 +833,7 @@ expand_java_multianewarray (class_type, ndim) ...@@ -798,7 +833,7 @@ expand_java_multianewarray (class_type, ndim)
to make sure that the RHS can be assigned to the array element 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. */ type. It is not necessary to generate this code if ARRAY is final. */
void static void
expand_java_arraystore (rhs_type_node) expand_java_arraystore (rhs_type_node)
tree rhs_type_node; tree rhs_type_node;
{ {
...@@ -840,7 +875,7 @@ expand_java_arraystore (rhs_type_node) ...@@ -840,7 +875,7 @@ expand_java_arraystore (rhs_type_node)
BOOLEAN/SHORT, we push a promoted type back to the stack. BOOLEAN/SHORT, we push a promoted type back to the stack.
*/ */
void static void
expand_java_arrayload (lhs_type_node ) expand_java_arrayload (lhs_type_node )
tree lhs_type_node; tree lhs_type_node;
{ {
...@@ -864,7 +899,7 @@ expand_java_arrayload (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 /* Expands .length. Makes sure that we deal with and array and may expand
a NULL check on the array object. */ a NULL check on the array object. */
void static void
expand_java_array_length () expand_java_array_length ()
{ {
tree array = pop_value (ptr_type_node); tree array = pop_value (ptr_type_node);
...@@ -876,7 +911,7 @@ expand_java_array_length () ...@@ -876,7 +911,7 @@ expand_java_array_length ()
/* Emit code for the call to _Jv_Monitor{Enter,Exit}. CALL can be /* Emit code for the call to _Jv_Monitor{Enter,Exit}. CALL can be
either soft_monitorenter_node or soft_monitorexit_node. */ either soft_monitorenter_node or soft_monitorexit_node. */
tree static tree
build_java_monitor (call, object) build_java_monitor (call, object)
tree call; tree call;
tree object; tree object;
...@@ -890,7 +925,7 @@ build_java_monitor (call, object) ...@@ -890,7 +925,7 @@ build_java_monitor (call, object)
/* Emit code for one of the PUSHC instructions. */ /* Emit code for one of the PUSHC instructions. */
void static void
expand_java_pushc (ival, type) expand_java_pushc (ival, type)
int ival; int ival;
tree type; tree type;
...@@ -918,7 +953,7 @@ expand_java_pushc (ival, type) ...@@ -918,7 +953,7 @@ expand_java_pushc (ival, type)
push_value (value); push_value (value);
} }
void static void
expand_java_return (type) expand_java_return (type)
tree type; tree type;
{ {
...@@ -941,7 +976,7 @@ build_address_of (value) ...@@ -941,7 +976,7 @@ build_address_of (value)
return build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (value)), value); return build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (value)), value);
} }
void static void
expand_java_NEW (type) expand_java_NEW (type)
tree type; tree type;
{ {
...@@ -956,7 +991,7 @@ expand_java_NEW (type) ...@@ -956,7 +991,7 @@ expand_java_NEW (type)
NULL_TREE)); NULL_TREE));
} }
void static void
expand_java_INSTANCEOF (type) expand_java_INSTANCEOF (type)
tree type; tree type;
{ {
...@@ -970,7 +1005,7 @@ expand_java_INSTANCEOF (type) ...@@ -970,7 +1005,7 @@ expand_java_INSTANCEOF (type)
push_value (value); push_value (value);
} }
void static void
expand_java_CHECKCAST (type) expand_java_CHECKCAST (type)
tree type; tree type;
{ {
...@@ -983,8 +1018,11 @@ expand_java_CHECKCAST (type) ...@@ -983,8 +1018,11 @@ expand_java_CHECKCAST (type)
push_value (value); push_value (value);
} }
void static void
expand_iinc (unsigned int local_var_index, int ival, int pc) expand_iinc (local_var_index, ival, pc)
unsigned int local_var_index;
int ival;
int pc;
{ {
tree local_var, res; tree local_var, res;
tree constant_value; tree constant_value;
...@@ -1070,7 +1108,7 @@ build_java_binop (op, type, arg1, arg2) ...@@ -1070,7 +1108,7 @@ build_java_binop (op, type, arg1, arg2)
return fold (build (op, type, arg1, arg2)); return fold (build (op, type, arg1, arg2));
} }
void static void
expand_java_binop (type, op) expand_java_binop (type, op)
tree type; enum tree_code op; tree type; enum tree_code op;
{ {
...@@ -1205,9 +1243,9 @@ create_label_decl (name) ...@@ -1205,9 +1243,9 @@ create_label_decl (name)
/* This maps a bytecode offset (PC) to various flags. */ /* This maps a bytecode offset (PC) to various flags. */
char *instruction_bits; char *instruction_bits;
void static void
note_label (current_pc, target_pc) note_label (current_pc, target_pc)
int current_pc, target_pc; int current_pc ATTRIBUTE_UNUSED, target_pc;
{ {
lookup_label (target_pc); lookup_label (target_pc);
instruction_bits [target_pc] |= BCODE_JUMP_TARGET; instruction_bits [target_pc] |= BCODE_JUMP_TARGET;
...@@ -1216,7 +1254,7 @@ note_label (current_pc, target_pc) ...@@ -1216,7 +1254,7 @@ note_label (current_pc, target_pc)
/* Emit code to jump to TARGET_PC if VALUE1 CONDITION VALUE2, /* Emit code to jump to TARGET_PC if VALUE1 CONDITION VALUE2,
where CONDITION is one of one the compare operators. */ where CONDITION is one of one the compare operators. */
void static void
expand_compare (condition, value1, value2, target_pc) expand_compare (condition, value1, value2, target_pc)
enum tree_code condition; enum tree_code condition;
tree value1, value2; tree value1, value2;
...@@ -1231,7 +1269,7 @@ expand_compare (condition, value1, value2, target_pc) ...@@ -1231,7 +1269,7 @@ expand_compare (condition, value1, value2, target_pc)
/* Emit code for a TEST-type opcode. */ /* Emit code for a TEST-type opcode. */
void static void
expand_test (condition, type, target_pc) expand_test (condition, type, target_pc)
enum tree_code condition; enum tree_code condition;
tree type; tree type;
...@@ -1246,7 +1284,7 @@ expand_test (condition, type, target_pc) ...@@ -1246,7 +1284,7 @@ expand_test (condition, type, target_pc)
/* Emit code for a COND-type opcode. */ /* Emit code for a COND-type opcode. */
void static void
expand_cond (condition, type, target_pc) expand_cond (condition, type, target_pc)
enum tree_code condition; enum tree_code condition;
tree type; tree type;
...@@ -1261,7 +1299,7 @@ expand_cond (condition, type, target_pc) ...@@ -1261,7 +1299,7 @@ expand_cond (condition, type, target_pc)
expand_compare (condition, value1, value2, target_pc); expand_compare (condition, value1, value2, target_pc);
} }
void static void
expand_java_goto (target_pc) expand_java_goto (target_pc)
int target_pc; int target_pc;
{ {
...@@ -1270,7 +1308,8 @@ expand_java_goto (target_pc) ...@@ -1270,7 +1308,8 @@ expand_java_goto (target_pc)
expand_goto (target_label); expand_goto (target_label);
} }
void #if 0
static void
expand_java_call (target_pc, return_address) expand_java_call (target_pc, return_address)
int target_pc, return_address; int target_pc, return_address;
{ {
...@@ -1281,9 +1320,9 @@ expand_java_call (target_pc, return_address) ...@@ -1281,9 +1320,9 @@ expand_java_call (target_pc, return_address)
expand_goto (target_label); expand_goto (target_label);
} }
void static void
expand_java_ret (return_address) expand_java_ret (return_address)
tree return_address; tree return_address ATTRIBUTE_UNUSED;
{ {
warning ("ret instruction not implemented"); warning ("ret instruction not implemented");
#if 0 #if 0
...@@ -1292,6 +1331,7 @@ expand_java_ret (return_address) ...@@ -1292,6 +1331,7 @@ expand_java_ret (return_address)
expand_goto (target_label); expand_goto (target_label);
#endif #endif
} }
#endif
/* Recursive helper function to pop argument types during verifiation. */ /* Recursive helper function to pop argument types during verifiation. */
...@@ -1310,7 +1350,7 @@ pop_argument_types (arg_types) ...@@ -1310,7 +1350,7 @@ pop_argument_types (arg_types)
abort (); abort ();
} }
tree static tree
pop_arguments (arg_types) pop_arguments (arg_types)
tree arg_types; tree arg_types;
{ {
...@@ -1492,7 +1532,7 @@ build_invokeinterface (dtable, method_name, method_signature) ...@@ -1492,7 +1532,7 @@ build_invokeinterface (dtable, method_name, method_signature)
METHOD_REF_INDEX is an index into the constant pool. METHOD_REF_INDEX is an index into the constant pool.
NARGS is the number of arguments, or -1 if not specified. */ NARGS is the number of arguments, or -1 if not specified. */
void static void
expand_invoke (opcode, method_ref_index, nargs) expand_invoke (opcode, method_ref_index, nargs)
int opcode; int opcode;
int method_ref_index; int method_ref_index;
...@@ -1599,7 +1639,7 @@ expand_invoke (opcode, method_ref_index, nargs) ...@@ -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. 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. */ FIELD_REF_INDEX is an index into the constant pool. */
void static void
expand_java_field_op (is_static, is_putting, field_ref_index) expand_java_field_op (is_static, is_putting, field_ref_index)
int is_static; int is_static;
int is_putting; int is_putting;
...@@ -2131,7 +2171,7 @@ expand_byte_code (jcf, method) ...@@ -2131,7 +2171,7 @@ expand_byte_code (jcf, method)
} /* for */ } /* for */
} }
void static void
java_push_constant_from_pool (jcf, index) java_push_constant_from_pool (jcf, index)
JCF *jcf; JCF *jcf;
int index; int index;
......
...@@ -482,7 +482,7 @@ extern void jcf_parse PROTO ((struct JCF*)); ...@@ -482,7 +482,7 @@ extern void jcf_parse PROTO ((struct JCF*));
extern tree add_field PROTO ((tree, tree, tree, int)); extern tree add_field PROTO ((tree, tree, tree, int));
extern tree add_method PROTO ((tree, int, tree, tree)); extern tree add_method PROTO ((tree, int, tree, tree));
extern tree add_method_1 PROTO ((tree, int, tree, tree)); extern tree add_method_1 PROTO ((tree, int, tree, tree));
extern tree make_class (); extern tree make_class PROTO ((void));
extern tree push_class PROTO ((tree, tree)); extern tree push_class PROTO ((tree, tree));
extern tree unmangle_classname PROTO ((const char *name, int name_length)); extern tree unmangle_classname PROTO ((const char *name, int name_length));
extern tree parse_signature_string PROTO ((const unsigned char *, int)); extern tree parse_signature_string PROTO ((const unsigned char *, int));
...@@ -490,11 +490,10 @@ extern tree get_type_from_signature PROTO ((tree)); ...@@ -490,11 +490,10 @@ extern tree get_type_from_signature PROTO ((tree));
extern void layout_class PROTO ((tree)); extern void layout_class PROTO ((tree));
extern tree layout_class_method PROTO ((tree, tree, tree, tree)); extern tree layout_class_method PROTO ((tree, tree, tree, tree));
extern void layout_class_methods PROTO ((tree)); extern void layout_class_methods PROTO ((tree));
extern tree make_class ();
extern tree build_class_ref PROTO ((tree)); extern tree build_class_ref PROTO ((tree));
extern tree build_dtable_decl PROTO ((tree)); extern tree build_dtable_decl PROTO ((tree));
extern tree build_internal_class_name PROTO ((tree)); extern tree build_internal_class_name PROTO ((tree));
extern tree build_constants_constructor (); extern tree build_constants_constructor PROTO ((void));
extern tree build_ref_from_constant_pool PROTO ((int)); extern tree build_ref_from_constant_pool PROTO ((int));
extern tree build_utf8_ref PROTO ((tree)); extern tree build_utf8_ref PROTO ((tree));
extern tree ident_subst PROTO ((const char*, int, extern tree ident_subst PROTO ((const char*, int,
...@@ -541,9 +540,9 @@ extern tree build_java_arraynull_check PROTO ((tree, tree, tree)); ...@@ -541,9 +540,9 @@ extern tree build_java_arraynull_check PROTO ((tree, tree, tree));
extern tree create_label_decl PROTO ((tree)); extern tree create_label_decl PROTO ((tree));
extern void push_labeled_block PROTO ((tree)); extern void push_labeled_block PROTO ((tree));
extern tree prepare_eh_table_type PROTO ((tree)); extern tree prepare_eh_table_type PROTO ((tree));
extern void java_set_exception_lang_code PROTO (()); extern void java_set_exception_lang_code PROTO ((void));
extern tree generate_name PROTO ((void)); extern tree generate_name PROTO ((void));
extern void pop_labeled_block PROTO (()); extern void pop_labeled_block PROTO ((void));
extern char *lang_printable_name PROTO ((tree, int)); extern char *lang_printable_name PROTO ((tree, int));
extern tree maybe_add_interface PROTO ((tree, tree)); extern tree maybe_add_interface PROTO ((tree, tree));
extern void set_super_info PROTO ((int, tree, tree, int)); extern void set_super_info PROTO ((int, tree, tree, int));
...@@ -552,12 +551,12 @@ extern int interface_of_p PROTO ((tree, tree)); ...@@ -552,12 +551,12 @@ extern int interface_of_p PROTO ((tree, tree));
extern int inherits_from_p PROTO ((tree, tree)); extern int inherits_from_p PROTO ((tree, tree));
extern void complete_start_java_method PROTO ((tree)); extern void complete_start_java_method PROTO ((tree));
extern tree build_result_decl PROTO ((tree)); extern tree build_result_decl PROTO ((tree));
extern void emit_handlers PROTO (()); extern void emit_handlers PROTO ((void));
extern void init_outgoing_cpool PROTO (()); extern void init_outgoing_cpool PROTO ((void));
extern void make_class_data PROTO ((tree)); extern void make_class_data PROTO ((tree));
extern void register_class PROTO (()); extern void register_class PROTO ((void));
extern int alloc_name_constant PROTO ((int, tree)); extern int alloc_name_constant PROTO ((int, tree));
extern void emit_register_classes PROTO (()); extern void emit_register_classes PROTO ((void));
extern void lang_init_source PROTO ((int)); extern void lang_init_source PROTO ((int));
extern void write_classfile PROTO ((tree)); extern void write_classfile PROTO ((tree));
extern char *print_int_node PROTO ((tree)); extern char *print_int_node PROTO ((tree));
...@@ -566,12 +565,12 @@ extern void parse_error_context PVPROTO ((tree cl, const char *, ...)) ...@@ -566,12 +565,12 @@ extern void parse_error_context PVPROTO ((tree cl, const char *, ...))
extern tree build_primtype_type_ref PROTO ((char *)); extern tree build_primtype_type_ref PROTO ((char *));
extern tree java_get_real_method_name PROTO ((tree)); extern tree java_get_real_method_name PROTO ((tree));
extern void finish_class PROTO ((tree)); extern void finish_class PROTO ((tree));
extern void java_layout_seen_class_methods PROTO (()); extern void java_layout_seen_class_methods PROTO ((void));
extern void check_for_initialization PROTO ((tree)); extern void check_for_initialization PROTO ((tree));
extern tree pushdecl_top_level PROTO ((tree)); extern tree pushdecl_top_level PROTO ((tree));
extern int alloc_class_constant PROTO ((tree)); extern int alloc_class_constant PROTO ((tree));
extern int unicode_mangling_length PROTO ((char *, int)); extern int unicode_mangling_length PROTO ((const char *, int));
extern void init_expr_processing PROTO ((void)); extern void init_expr_processing PROTO ((void));
extern void push_super_field PROTO ((tree, tree)); extern void push_super_field PROTO ((tree, tree));
extern void init_class_processing PROTO ((void)); extern void init_class_processing PROTO ((void));
...@@ -586,8 +585,9 @@ extern int merge_type_state PROTO ((tree)); ...@@ -586,8 +585,9 @@ extern int merge_type_state PROTO ((tree));
extern void push_type PROTO ((tree)); extern void push_type PROTO ((tree));
extern void load_type_state PROTO ((tree)); extern void load_type_state PROTO ((tree));
extern void add_interface PROTO ((tree, tree)); extern void add_interface PROTO ((tree, tree));
extern void append_gpp_mangled_classtype PROTO ((struct obstack *, char *)); extern void append_gpp_mangled_name PROTO ((struct obstack *, const char *, int));
extern void emit_unicode_mangled_name PROTO ((struct obstack *, char *, int)); extern void append_gpp_mangled_classtype PROTO ((struct obstack *, const char *));
extern void emit_unicode_mangled_name PROTO ((struct obstack *, const char *, int));
extern tree force_evaluation_order PROTO ((tree)); extern tree force_evaluation_order PROTO ((tree));
extern int verify_constant_pool PROTO ((struct JCF *)); extern int verify_constant_pool PROTO ((struct JCF *));
extern void start_java_method PROTO ((tree)); extern void start_java_method PROTO ((tree));
...@@ -608,6 +608,22 @@ extern int find_methodref_index PROTO ((struct CPool *, tree)); ...@@ -608,6 +608,22 @@ extern int find_methodref_index PROTO ((struct CPool *, tree));
extern void write_constant_pool PROTO ((struct CPool *, unsigned char *, int)); extern void write_constant_pool PROTO ((struct CPool *, unsigned char *, int));
extern int count_constant_pool_bytes PROTO ((struct CPool *)); extern int count_constant_pool_bytes PROTO ((struct CPool *));
extern int encode_newarray_type PROTO ((tree)); extern int encode_newarray_type PROTO ((tree));
#ifdef uint64
extern void format_int PROTO ((char *, jlong, int));
extern void format_uint PROTO ((char *, uint64, int));
#endif
extern void jcf_trim_old_input PROTO ((struct JCF *));
#ifdef BUFSIZ
extern void jcf_print_utf8 PROTO ((FILE *, const unsigned char *, int));
extern void jcf_print_char PROTO ((FILE *, int));
extern void jcf_print_utf8_replace PROTO ((FILE *, const unsigned char *,
int, int, int));
# if JCF_USE_STDIO
extern char* open_class PROTO ((char *, struct JCF *, FILE *, const char *));
# else
extern char* open_class PROTO ((char *, struct JCF *, int, const char *));
# endif /* JCF_USE_STDIO */
#endif
/* Access flags etc for a method (a FUNCTION_DECL): */ /* Access flags etc for a method (a FUNCTION_DECL): */
......
...@@ -46,11 +46,12 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -46,11 +46,12 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
*/ */
#include <config.h> #include "config.h"
#include "system.h" #include "system.h"
#include <stdio.h>
#include "jcf.h" #include "jcf.h"
#include "tree.h"
#include "java-tree.h"
/* Outout file. */ /* Outout file. */
FILE *out; FILE *out;
...@@ -84,15 +85,16 @@ static void print_constant_ref PROTO ((FILE *, JCF *, int)); ...@@ -84,15 +85,16 @@ static void print_constant_ref PROTO ((FILE *, JCF *, int));
static void disassemble_method PROTO ((JCF*, unsigned char *, int)); static void disassemble_method PROTO ((JCF*, unsigned char *, int));
static void print_name PROTO ((FILE*, JCF*, int)); static void print_name PROTO ((FILE*, JCF*, int));
static void print_signature PROTO ((FILE*, JCF*, int, int)); static void print_signature PROTO ((FILE*, JCF*, int, int));
static int utf8_equal_string PROTO ((struct JCF*, int, const char *));
static int usage PROTO ((void));
static void process_class PROTO ((struct JCF *));
#define PRINT_SIGNATURE_RESULT_ONLY 1 #define PRINT_SIGNATURE_RESULT_ONLY 1
#define PRINT_SIGNATURE_ARGS_ONLY 2 #define PRINT_SIGNATURE_ARGS_ONLY 2
extern char* open_class(); static int
int
DEFUN(utf8_equal_string, (jcf, index, value), DEFUN(utf8_equal_string, (jcf, index, value),
JCF *jcf AND int index AND char * value) JCF *jcf AND int index AND const char * value)
{ {
if (CPOOL_INDEX_IN_RANGE (&jcf->cpool, index) if (CPOOL_INDEX_IN_RANGE (&jcf->cpool, index)
&& JPOOL_TAG (jcf, index) == CONSTANT_Utf8) && JPOOL_TAG (jcf, index) == CONSTANT_Utf8)
...@@ -109,8 +111,8 @@ DEFUN(utf8_equal_string, (jcf, index, value), ...@@ -109,8 +111,8 @@ DEFUN(utf8_equal_string, (jcf, index, value),
this_class_index = 0; \ this_class_index = 0; \
if (flag_print_class_info) \ if (flag_print_class_info) \
fprintf (out, \ fprintf (out, \
"Magic number: 0x%0x, minor_version: %d, major_version: %d.\n", \ "Magic number: 0x%0lx, minor_version: %ld, major_version: %ld.\n",\
MAGIC, MINOR, MAJOR) (long) MAGIC, (long) MINOR, (long) MAJOR)
#define HANDLE_START_CONSTANT_POOL(COUNT) \ #define HANDLE_START_CONSTANT_POOL(COUNT) \
if (flag_print_constant_pool) \ if (flag_print_constant_pool) \
...@@ -238,8 +240,8 @@ DEFUN(utf8_equal_string, (jcf, index, value), ...@@ -238,8 +240,8 @@ DEFUN(utf8_equal_string, (jcf, index, value),
#define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \ #define HANDLE_CODE_ATTRIBUTE(MAX_STACK, MAX_LOCALS, CODE_LENGTH) \
{ COMMON_HANDLE_ATTRIBUTE(JCF, attribute_name, attribute_length); \ { COMMON_HANDLE_ATTRIBUTE(JCF, attribute_name, attribute_length); \
fprintf (out, ", max_stack:%d, max_locals:%d, code_length:%d\n", \ fprintf (out, ", max_stack:%ld, max_locals:%ld, code_length:%ld\n", \
MAX_STACK, MAX_LOCALS, CODE_LENGTH); \ (long) MAX_STACK, (long) MAX_LOCALS, (long) CODE_LENGTH); \
disassemble_method (jcf, jcf->read_ptr, CODE_LENGTH); } disassemble_method (jcf, jcf->read_ptr, CODE_LENGTH); }
#define HANDLE_EXCEPTION_TABLE(ENTRIES, COUNT) \ #define HANDLE_EXCEPTION_TABLE(ENTRIES, COUNT) \
...@@ -345,7 +347,7 @@ DEFUN(print_name, (stream, jcf, name_index), ...@@ -345,7 +347,7 @@ DEFUN(print_name, (stream, jcf, name_index),
/* If the type of the constant at INDEX matches EXPECTED, /* If the type of the constant at INDEX matches EXPECTED,
print it tersely, otherwise more verbosely. */ print it tersely, otherwise more verbosely. */
void static void
DEFUN(print_constant_terse, (out, jcf, index, expected), DEFUN(print_constant_terse, (out, jcf, index, expected),
FILE *out AND JCF *jcf AND int index AND int expected) FILE *out AND JCF *jcf AND int index AND int expected)
{ {
...@@ -656,14 +658,14 @@ DEFUN(print_exception_table, (jcf, entries, count), ...@@ -656,14 +658,14 @@ DEFUN(print_exception_table, (jcf, entries, count),
#include "jcf-reader.c" #include "jcf-reader.c"
int static int
DEFUN (usage, (), ) DEFUN (usage, (), )
{ {
fprintf (stderr, "Usage: jcf-dump [-o outputfile] [-c] classname\n"); fprintf (stderr, "Usage: jcf-dump [-o outputfile] [-c] classname\n");
exit(1); exit(1);
} }
void static void
DEFUN(process_class, (jcf), DEFUN(process_class, (jcf),
JCF *jcf) JCF *jcf)
{ {
...@@ -1021,24 +1023,24 @@ DEFUN(disassemble_method, (jcf, byte_ops, len), ...@@ -1021,24 +1023,24 @@ DEFUN(disassemble_method, (jcf, byte_ops, len),
#define BRANCH(OPERAND_TYPE, OPERAND_VALUE) \ #define BRANCH(OPERAND_TYPE, OPERAND_VALUE) \
saw_index = 0, INT_temp = (OPERAND_VALUE); \ saw_index = 0, INT_temp = (OPERAND_VALUE); \
fprintf (out, " %d", saw_index ? INT_temp : oldpc + INT_temp) fprintf (out, " %ld", (long) (saw_index ? INT_temp : oldpc + INT_temp))
#define JSR(OPERAND_TYPE, OPERAND_VALUE) \ #define JSR(OPERAND_TYPE, OPERAND_VALUE) \
saw_index = 0, INT_temp = (OPERAND_VALUE); \ saw_index = 0, INT_temp = (OPERAND_VALUE); \
fprintf (out, " %d", saw_index ? INT_temp : oldpc + INT_temp) fprintf (out, " %ld", (long) (saw_index ? INT_temp : oldpc + INT_temp))
#undef RET /* Defined by config/i386/i386.h */ #undef RET /* Defined by config/i386/i386.h */
#define RET(OPERAND_TYPE, OPERAND_VALUE) \ #define RET(OPERAND_TYPE, OPERAND_VALUE) \
INT_temp = saw_wide ? IMMEDIATE_u2 : (OPERAND_VALUE); \ INT_temp = saw_wide ? IMMEDIATE_u2 : (OPERAND_VALUE); \
saw_wide = 0; \ saw_wide = 0; \
fprintf (out, " %d", INT_temp); fprintf (out, " %ld", (long) INT_temp);
#define SWITCH(OPERAND_TYPE, TABLE_OR_LOOKUP) \ #define SWITCH(OPERAND_TYPE, TABLE_OR_LOOKUP) \
PC = (PC + 3) / 4 * 4; TABLE_OR_LOOKUP##_SWITCH PC = (PC + 3) / 4 * 4; TABLE_OR_LOOKUP##_SWITCH
#define LOOKUP_SWITCH \ #define LOOKUP_SWITCH \
{ jint default_offset = IMMEDIATE_s4; jint npairs = IMMEDIATE_s4; \ { jint default_offset = IMMEDIATE_s4; jint npairs = IMMEDIATE_s4; \
fprintf (out, " npairs=%d, default=%d", npairs, default_offset+oldpc); \ fprintf (out, " npairs=%ld, default=%ld", (long) npairs, (long) default_offset+oldpc); \
while (--npairs >= 0) { \ while (--npairs >= 0) { \
jint match = IMMEDIATE_s4; jint offset = IMMEDIATE_s4; \ jint match = IMMEDIATE_s4; jint offset = IMMEDIATE_s4; \
fprintf (out, "\n%10ld: %ld", (long)match, (long)(offset+oldpc)); } \ fprintf (out, "\n%10ld: %ld", (long)match, (long)(offset+oldpc)); } \
...@@ -1047,8 +1049,8 @@ DEFUN(disassemble_method, (jcf, byte_ops, len), ...@@ -1047,8 +1049,8 @@ DEFUN(disassemble_method, (jcf, byte_ops, len),
#define TABLE_SWITCH \ #define TABLE_SWITCH \
{ jint default_offset = IMMEDIATE_s4; \ { jint default_offset = IMMEDIATE_s4; \
jint low = IMMEDIATE_s4; jint high = IMMEDIATE_s4; \ jint low = IMMEDIATE_s4; jint high = IMMEDIATE_s4; \
fprintf (out, " low=%d, high=%d, default=%d", \ fprintf (out, " low=%ld, high=%ld, default=%ld", \
low, high, default_offset+oldpc); \ (long) low, (long) high, (long) default_offset+oldpc); \
for (; low <= high; low++) { \ for (; low <= high; low++) { \
jint offset = IMMEDIATE_s4; \ jint offset = IMMEDIATE_s4; \
fprintf (out, "\n%10ld: %ld", (long)low, (long)(offset+oldpc)); } \ fprintf (out, "\n%10ld: %ld", (long)low, (long)(offset+oldpc)); } \
...@@ -1085,7 +1087,7 @@ DEFUN(disassemble_method, (jcf, byte_ops, len), ...@@ -1085,7 +1087,7 @@ DEFUN(disassemble_method, (jcf, byte_ops, len),
else else
{ {
saw_wide = 0; saw_wide = 0;
fprintf (out, " %d", INT_temp); fprintf (out, " %ld", (long) INT_temp);
} }
fputc ('\n', out); fputc ('\n', out);
break; break;
......
...@@ -26,6 +26,8 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -26,6 +26,8 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "system.h" #include "system.h"
#include "jcf.h" #include "jcf.h"
#include "tree.h"
#include "java-tree.h"
/* DOS brain-damage */ /* DOS brain-damage */
#ifndef O_BINARY #ifndef O_BINARY
...@@ -182,7 +184,7 @@ DEFUN(open_in_zip, (jcf, zipfile, zipmember, is_system), ...@@ -182,7 +184,7 @@ DEFUN(open_in_zip, (jcf, zipfile, zipmember, is_system),
#if JCF_USE_STDIO #if JCF_USE_STDIO
char* char*
DEFUN(open_class, (filename, jcf, stream, dep_name), DEFUN(open_class, (filename, jcf, stream, dep_name),
char *filename AND JCF *jcf AND FILE* stream AND char *dep_name) char *filename AND JCF *jcf AND FILE* stream AND const char *dep_name)
{ {
if (jcf) if (jcf)
{ {
...@@ -203,7 +205,7 @@ DEFUN(open_class, (filename, jcf, stream, dep_name), ...@@ -203,7 +205,7 @@ DEFUN(open_class, (filename, jcf, stream, dep_name),
#else #else
char* char*
DEFUN(open_class, (filename, jcf, fd, dep_name), DEFUN(open_class, (filename, jcf, fd, dep_name),
char *filename AND JCF *jcf AND int fd AND char *dep_name) char *filename AND JCF *jcf AND int fd AND const char *dep_name)
{ {
if (jcf) if (jcf)
{ {
...@@ -240,7 +242,7 @@ DEFUN(open_class, (filename, jcf, fd, dep_name), ...@@ -240,7 +242,7 @@ DEFUN(open_class, (filename, jcf, fd, dep_name),
char * char *
DEFUN(find_classfile, (filename, jcf, dep_name), DEFUN(find_classfile, (filename, jcf, dep_name),
char *filename AND JCF *jcf AND char *dep_name) char *filename AND JCF *jcf AND const char *dep_name)
{ {
#if JCF_USE_STDIO #if JCF_USE_STDIO
FILE *stream = fopen (filename, "rb"); FILE *stream = fopen (filename, "rb");
...@@ -458,9 +460,9 @@ DEFUN(jcf_print_char, (stream, ch), ...@@ -458,9 +460,9 @@ DEFUN(jcf_print_char, (stream, ch),
void void
DEFUN(jcf_print_utf8, (stream, str, length), DEFUN(jcf_print_utf8, (stream, str, length),
FILE *stream AND register unsigned char *str AND int length) FILE *stream AND register const unsigned char *str AND int length)
{ {
unsigned char* limit = str + length; const unsigned char * limit = str + length;
while (str < limit) while (str < limit)
{ {
int ch = UTF8_GET (str, limit); int ch = UTF8_GET (str, limit);
...@@ -477,7 +479,7 @@ DEFUN(jcf_print_utf8, (stream, str, length), ...@@ -477,7 +479,7 @@ DEFUN(jcf_print_utf8, (stream, str, length),
void void
DEFUN(jcf_print_utf8_replace, (stream, str, length, in_char, out_char), DEFUN(jcf_print_utf8_replace, (stream, str, length, in_char, out_char),
FILE *stream AND unsigned char *str AND int length FILE *stream AND const unsigned char *str AND int length
AND int in_char AND int out_char) AND int in_char AND int out_char)
{ {
......
...@@ -79,12 +79,13 @@ static tree current_method = NULL_TREE; ...@@ -79,12 +79,13 @@ static tree current_method = NULL_TREE;
/* Declarations of some functions used here. */ /* Declarations of some functions used here. */
static tree give_name_to_class PROTO ((JCF *jcf, int index)); static tree give_name_to_class PROTO ((JCF *jcf, int index));
void parse_zip_file_entries PROTO (()); static void parse_zip_file_entries PROTO ((void));
void process_zip_dir PROTO (()); static void process_zip_dir PROTO ((void));
static void parse_source_file PROTO ((tree)); static void parse_source_file PROTO ((tree));
static void jcf_parse_source PROTO ((void)); static void jcf_parse_source PROTO ((void));
static int jcf_figure_file_type PROTO ((JCF *)); static int jcf_figure_file_type PROTO ((JCF *));
static int find_in_current_zip PROTO ((char *, struct JCF **)); static int find_in_current_zip PROTO ((char *, struct JCF **));
static void parse_class_file PROTO ((void));
/* Handle "SourceFile" attribute. */ /* Handle "SourceFile" attribute. */
...@@ -662,7 +663,7 @@ init_outgoing_cpool () ...@@ -662,7 +663,7 @@ init_outgoing_cpool ()
} }
} }
void static void
parse_class_file () parse_class_file ()
{ {
tree method; tree method;
...@@ -854,7 +855,7 @@ yyparse () ...@@ -854,7 +855,7 @@ yyparse ()
static struct ZipFileCache *localToFile; static struct ZipFileCache *localToFile;
/* Process all class entries found in the zip file. */ /* Process all class entries found in the zip file. */
void static void
parse_zip_file_entries (void) parse_zip_file_entries (void)
{ {
struct ZipDirectory *zdir; struct ZipDirectory *zdir;
...@@ -895,7 +896,7 @@ parse_zip_file_entries (void) ...@@ -895,7 +896,7 @@ parse_zip_file_entries (void)
/* Read all the entries of the zip file, creates a class and a JCF. Sets the /* Read all the entries of the zip file, creates a class and a JCF. Sets the
jcf up for further processing and link it to the created class. */ jcf up for further processing and link it to the created class. */
void process_zip_dir() static void process_zip_dir()
{ {
int i; int i;
ZipDirectory *zdir; ZipDirectory *zdir;
...@@ -955,7 +956,7 @@ void process_zip_dir() ...@@ -955,7 +956,7 @@ void process_zip_dir()
/* Lookup class NAME and figure whether is a class already found in the current /* Lookup class NAME and figure whether is a class already found in the current
zip file. */ zip file. */
int static int
DEFUN(find_in_current_zip, (name, length, jcf), DEFUN(find_in_current_zip, (name, length, jcf),
char *name AND JCF **jcf) char *name AND JCF **jcf)
{ {
......
...@@ -23,9 +23,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -23,9 +23,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
#include "jcf.h"
#include "tree.h" #include "tree.h"
#include "java-tree.h" #include "java-tree.h"
#include "jcf.h"
#include "obstack.h" #include "obstack.h"
#undef AND #undef AND
#include "rtl.h" #include "rtl.h"
...@@ -273,6 +273,33 @@ struct jcf_partial ...@@ -273,6 +273,33 @@ struct jcf_partial
}; };
static void generate_bytecode_insns PROTO ((tree, int, struct jcf_partial *)); static void generate_bytecode_insns PROTO ((tree, int, struct jcf_partial *));
static struct chunk * alloc_chunk PROTO ((struct chunk *, unsigned char *,
int, struct obstack *));
static unsigned char * append_chunk PROTO ((unsigned char *, int,
struct jcf_partial *));
static void append_chunk_copy PROTO ((unsigned char *, int,
struct jcf_partial *));
static struct jcf_block * gen_jcf_label PROTO ((struct jcf_partial *));
static void finish_jcf_block PROTO ((struct jcf_partial *));
static void define_jcf_label PROTO ((struct jcf_block *,
struct jcf_partial *));
static struct jcf_block * get_jcf_label_here PROTO ((struct jcf_partial *));
static void put_linenumber PROTO ((int, struct jcf_partial *));
static void localvar_alloc PROTO ((tree, struct jcf_partial *));
static int localvar_free PROTO ((tree, struct jcf_partial *));
static int get_access_flags PROTO ((tree));
static void write_chunks PROTO ((FILE *, struct chunk *));
static int adjust_typed_op PROTO ((tree, int));
static void generate_bytecode_conditional PROTO ((tree, struct jcf_block *,
struct jcf_block *, int,
struct jcf_partial *));
static void generate_bytecode_return PROTO ((tree, struct jcf_partial *));
static void perform_relocations PROTO ((struct jcf_partial *));
static void init_jcf_state PROTO ((struct jcf_partial *, struct obstack *));
static void init_jcf_method PROTO ((struct jcf_partial *, tree));
static void release_jcf_state PROTO ((struct jcf_partial *));
static struct chunk * generate_classfile PROTO ((tree, struct jcf_partial *));
/* Utility macros for appending (big-endian) data to a buffer. /* Utility macros for appending (big-endian) data to a buffer.
We assume a local variable 'ptr' points into where we want to We assume a local variable 'ptr' points into where we want to
...@@ -304,7 +331,7 @@ CHECK_PUT(ptr, state, i) ...@@ -304,7 +331,7 @@ CHECK_PUT(ptr, state, i)
Set the data and size fields to DATA and SIZE, respectively. Set the data and size fields to DATA and SIZE, respectively.
However, if DATA is NULL and SIZE>0, allocate a buffer as well. */ However, if DATA is NULL and SIZE>0, allocate a buffer as well. */
struct chunk * static struct chunk *
alloc_chunk (last, data, size, work) alloc_chunk (last, data, size, work)
struct chunk *last; struct chunk *last;
unsigned char *data; unsigned char *data;
...@@ -339,7 +366,7 @@ CHECK_OP(struct jcf_partial *state) ...@@ -339,7 +366,7 @@ CHECK_OP(struct jcf_partial *state)
#define CHECK_OP(STATE) ((void)0) #define CHECK_OP(STATE) ((void)0)
#endif #endif
unsigned char * static unsigned char *
append_chunk (data, size, state) append_chunk (data, size, state)
unsigned char *data; unsigned char *data;
int size; int size;
...@@ -351,7 +378,7 @@ append_chunk (data, size, state) ...@@ -351,7 +378,7 @@ append_chunk (data, size, state)
return state->chunk->data; return state->chunk->data;
} }
void static void
append_chunk_copy (data, size, state) append_chunk_copy (data, size, state)
unsigned char *data; unsigned char *data;
int size; int size;
...@@ -361,7 +388,7 @@ append_chunk_copy (data, size, state) ...@@ -361,7 +388,7 @@ append_chunk_copy (data, size, state)
memcpy (ptr, data, size); memcpy (ptr, data, size);
} }
struct jcf_block * static struct jcf_block *
gen_jcf_label (state) gen_jcf_label (state)
struct jcf_partial *state; struct jcf_partial *state;
{ {
...@@ -373,7 +400,7 @@ gen_jcf_label (state) ...@@ -373,7 +400,7 @@ gen_jcf_label (state)
return block; return block;
} }
void static void
finish_jcf_block (state) finish_jcf_block (state)
struct jcf_partial *state; struct jcf_partial *state;
{ {
...@@ -400,7 +427,7 @@ finish_jcf_block (state) ...@@ -400,7 +427,7 @@ finish_jcf_block (state)
state->code_length = pc; state->code_length = pc;
} }
void static void
define_jcf_label (label, state) define_jcf_label (label, state)
struct jcf_block *label; struct jcf_block *label;
struct jcf_partial *state; struct jcf_partial *state;
...@@ -417,7 +444,7 @@ define_jcf_label (label, state) ...@@ -417,7 +444,7 @@ define_jcf_label (label, state)
label->u.relocations = NULL; label->u.relocations = NULL;
} }
struct jcf_block * static struct jcf_block *
get_jcf_label_here (state) get_jcf_label_here (state)
struct jcf_partial *state; struct jcf_partial *state;
{ {
...@@ -433,7 +460,7 @@ get_jcf_label_here (state) ...@@ -433,7 +460,7 @@ get_jcf_label_here (state)
/* Note a line number entry for the current PC and given LINE. */ /* Note a line number entry for the current PC and given LINE. */
void static void
put_linenumber (line, state) put_linenumber (line, state)
int line; int line;
struct jcf_partial *state; struct jcf_partial *state;
...@@ -493,7 +520,7 @@ struct localvar_info ...@@ -493,7 +520,7 @@ struct localvar_info
#define localvar_max \ #define localvar_max \
((struct localvar_info**) state->localvars.ptr - localvar_buffer) ((struct localvar_info**) state->localvars.ptr - localvar_buffer)
void static void
localvar_alloc (decl, state) localvar_alloc (decl, state)
tree decl; tree decl;
struct jcf_partial *state; struct jcf_partial *state;
...@@ -540,7 +567,7 @@ localvar_alloc (decl, state) ...@@ -540,7 +567,7 @@ localvar_alloc (decl, state)
} }
} }
int static int
localvar_free (decl, state) localvar_free (decl, state)
tree decl; tree decl;
struct jcf_partial *state; struct jcf_partial *state;
...@@ -571,7 +598,7 @@ localvar_free (decl, state) ...@@ -571,7 +598,7 @@ localvar_free (decl, state)
/* Get the access flags of a class (TYPE_DECL), a method (FUNCTION_DECL), or /* Get the access flags of a class (TYPE_DECL), a method (FUNCTION_DECL), or
a field (FIELD_DECL or VAR_DECL, if static), as encoded in a .class file. */ a field (FIELD_DECL or VAR_DECL, if static), as encoded in a .class file. */
int static int
get_access_flags (decl) get_access_flags (decl)
tree decl; tree decl;
{ {
...@@ -624,7 +651,7 @@ get_access_flags (decl) ...@@ -624,7 +651,7 @@ get_access_flags (decl)
/* Write the list of segments starting at CHUNKS to STREAM. */ /* Write the list of segments starting at CHUNKS to STREAM. */
void static void
write_chunks (stream, chunks) write_chunks (stream, chunks)
FILE* stream; FILE* stream;
struct chunk *chunks; struct chunk *chunks;
...@@ -786,7 +813,7 @@ field_op (field, opcode, state) ...@@ -786,7 +813,7 @@ field_op (field, opcode, state)
reference) to 7 (for 'short') which matches the pattern of how JVM reference) to 7 (for 'short') which matches the pattern of how JVM
opcodes typically depend on the operand type. */ opcodes typically depend on the operand type. */
int static int
adjust_typed_op (type, max) adjust_typed_op (type, max)
tree type; tree type;
int max; int max;
...@@ -940,7 +967,7 @@ emit_store (var, state) ...@@ -940,7 +967,7 @@ emit_store (var, state)
static void static void
emit_unop (opcode, type, state) emit_unop (opcode, type, state)
enum java_opcode opcode; enum java_opcode opcode;
tree type; tree type ATTRIBUTE_UNUSED;
struct jcf_partial *state; struct jcf_partial *state;
{ {
RESERVE(1); RESERVE(1);
...@@ -1044,7 +1071,7 @@ emit_jsr (target, state) ...@@ -1044,7 +1071,7 @@ emit_jsr (target, state)
TRUE_LABEL may follow right after this. (The idea is that we TRUE_LABEL may follow right after this. (The idea is that we
may be able to optimize away GOTO TRUE_LABEL; TRUE_LABEL:) */ may be able to optimize away GOTO TRUE_LABEL; TRUE_LABEL:) */
void static void
generate_bytecode_conditional (exp, true_label, false_label, generate_bytecode_conditional (exp, true_label, false_label,
true_branch_first, state) true_branch_first, state)
tree exp; tree exp;
...@@ -1268,7 +1295,7 @@ call_cleanups (limit, state) ...@@ -1268,7 +1295,7 @@ call_cleanups (limit, state)
} }
} }
void static void
generate_bytecode_return (exp, state) generate_bytecode_return (exp, state)
tree exp; tree exp;
struct jcf_partial *state; struct jcf_partial *state;
...@@ -2448,7 +2475,7 @@ generate_bytecode_insns (exp, target, state) ...@@ -2448,7 +2475,7 @@ generate_bytecode_insns (exp, target, state)
} }
} }
void static void
perform_relocations (state) perform_relocations (state)
struct jcf_partial *state; struct jcf_partial *state;
{ {
...@@ -2616,7 +2643,7 @@ perform_relocations (state) ...@@ -2616,7 +2643,7 @@ perform_relocations (state)
state->code_length = pc; state->code_length = pc;
} }
void static void
init_jcf_state (state, work) init_jcf_state (state, work)
struct jcf_partial *state; struct jcf_partial *state;
struct obstack *work; struct obstack *work;
...@@ -2628,7 +2655,7 @@ init_jcf_state (state, work) ...@@ -2628,7 +2655,7 @@ init_jcf_state (state, work)
BUFFER_INIT (&state->bytecode); BUFFER_INIT (&state->bytecode);
} }
void static void
init_jcf_method (state, method) init_jcf_method (state, method)
struct jcf_partial *state; struct jcf_partial *state;
tree method; tree method;
...@@ -2651,7 +2678,7 @@ init_jcf_method (state, method) ...@@ -2651,7 +2678,7 @@ init_jcf_method (state, method)
state->return_value_decl = NULL_TREE; state->return_value_decl = NULL_TREE;
} }
void static void
release_jcf_state (state) release_jcf_state (state)
struct jcf_partial *state; struct jcf_partial *state;
{ {
...@@ -2663,7 +2690,7 @@ release_jcf_state (state) ...@@ -2663,7 +2690,7 @@ release_jcf_state (state)
in the .class file representation. The list can be written to a in the .class file representation. The list can be written to a
.class file using write_chunks. Allocate chunks from obstack WORK. */ .class file using write_chunks. Allocate chunks from obstack WORK. */
struct chunk * static struct chunk *
generate_classfile (clas, state) generate_classfile (clas, state)
tree clas; tree clas;
struct jcf_partial *state; struct jcf_partial *state;
...@@ -2943,7 +2970,8 @@ static char * ...@@ -2943,7 +2970,8 @@ static char *
make_class_file_name (clas) make_class_file_name (clas)
tree clas; tree clas;
{ {
char *cname, *dname, *slash, *r; const char *dname, *slash;
char *cname, *r;
struct stat sb; struct stat sb;
cname = IDENTIFIER_POINTER (identifier_subst (DECL_NAME (TYPE_NAME (clas)), cname = IDENTIFIER_POINTER (identifier_subst (DECL_NAME (TYPE_NAME (clas)),
......
...@@ -224,7 +224,7 @@ typedef struct JCF { ...@@ -224,7 +224,7 @@ typedef struct JCF {
#define DEFAULT_CLASS_PATH "." #define DEFAULT_CLASS_PATH "."
extern char *find_class PROTO ((const char *, int, JCF*, int)); extern char *find_class PROTO ((const char *, int, JCF*, int));
extern char *find_classfile PROTO ((char *, JCF*, char *)); extern char *find_classfile PROTO ((char *, JCF*, const char *));
extern int jcf_filbuf_from_stdio PROTO ((JCF *jcf, int count)); extern int jcf_filbuf_from_stdio PROTO ((JCF *jcf, int count));
extern void jcf_out_of_synch PROTO((JCF *)); extern void jcf_out_of_synch PROTO((JCF *));
extern int jcf_unexpected_eof PROTO ((JCF*, int)); extern int jcf_unexpected_eof PROTO ((JCF*, int));
......
...@@ -27,7 +27,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -27,7 +27,6 @@ Boston, MA 02111-1307, USA. */
void fatal VPROTO((const char *s, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; void fatal VPROTO((const char *s, ...)) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void warning VPROTO((const char *s, ...)) ATTRIBUTE_PRINTF_1; void warning VPROTO((const char *s, ...)) ATTRIBUTE_PRINTF_1;
void gcc_obstack_init PROTO ((struct obstack *obstack)); void gcc_obstack_init PROTO ((struct obstack *obstack));
extern void reset_report PROTO ((void));
#define JC1_LITE #define JC1_LITE
#include "parse.h" #include "parse.h"
......
...@@ -28,6 +28,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -28,6 +28,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "system.h" #include "system.h"
#include "obstack.h" #include "obstack.h"
#include "gansidecl.h" #include "gansidecl.h"
#include "jcf.h"
#include "tree.h"
#include "java-tree.h"
const char main_method_prefix[] = "main__"; const char main_method_prefix[] = "main__";
const char main_method_suffix[] = "Pt6JArray1ZPQ34java4lang6String"; const char main_method_suffix[] = "Pt6JArray1ZPQ34java4lang6String";
...@@ -35,11 +38,25 @@ const char class_mangling_prefix[] = "_CL_"; ...@@ -35,11 +38,25 @@ const char class_mangling_prefix[] = "_CL_";
struct obstack name_obstack; struct obstack name_obstack;
extern void error PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1;
void void
error (const char *str) error VPROTO((const char *msgid, ...))
{ {
fprintf (stderr, "%s\n", str); #ifndef ANSI_PROTOTYPES
exit (-1); const char *msgid;
#endif
va_list ap;
VA_START (ap, msgid);
#ifndef ANSI_PROTOTYPES
msgid = va_arg (ap, const char *);
#endif
vfprintf (stderr, msgid, ap);
va_end (ap);
} }
void void
......
...@@ -110,7 +110,8 @@ extern int flag_exceptions; ...@@ -110,7 +110,8 @@ extern int flag_exceptions;
if `-fSTRING' is seen as an option. if `-fSTRING' is seen as an option.
(If `-fno-STRING' is seen as an option, the opposite value is stored.) */ (If `-fno-STRING' is seen as an option, the opposite value is stored.) */
static struct { char *string; int *variable; int on_value;} lang_f_options[] = static struct { const char *string; int *variable; int on_value;}
lang_f_options[] =
{ {
{"bounds-check", &flag_bounds_check, 1}, {"bounds-check", &flag_bounds_check, 1},
{"assume-compiled", &flag_assume_compiled, 1}, {"assume-compiled", &flag_assume_compiled, 1},
......
...@@ -61,7 +61,7 @@ static void java_lex_error PROTO ((char *, int)); ...@@ -61,7 +61,7 @@ static void java_lex_error PROTO ((char *, int));
static int java_is_eol PROTO ((FILE *, int)); static int java_is_eol PROTO ((FILE *, int));
#endif #endif
static void java_store_unicode PROTO ((struct java_line *, unicode_t, int)); static void java_store_unicode PROTO ((struct java_line *, unicode_t, int));
static unicode_t java_parse_escape_sequence PROTO (()); static unicode_t java_parse_escape_sequence PROTO ((void));
static int java_letter_or_digit_p PROTO ((unicode_t)); static int java_letter_or_digit_p PROTO ((unicode_t));
static int java_parse_doc_section PROTO ((unicode_t)); static int java_parse_doc_section PROTO ((unicode_t));
static void java_parse_end_comment PROTO ((unicode_t)); static void java_parse_end_comment PROTO ((unicode_t));
...@@ -155,7 +155,7 @@ java_unget_unicode () ...@@ -155,7 +155,7 @@ java_unget_unicode ()
ctxp->c_line->char_col -= JAVA_COLUMN_DELTA (0); ctxp->c_line->char_col -= JAVA_COLUMN_DELTA (0);
} }
void static void
java_allocate_new_line () java_allocate_new_line ()
{ {
unicode_t ahead = (ctxp->c_line ? ctxp->c_line->ahead[0] : '\0'); unicode_t ahead = (ctxp->c_line ? ctxp->c_line->ahead[0] : '\0');
......
...@@ -28,6 +28,8 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -28,6 +28,8 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
#include "jcf.h" #include "jcf.h"
#include "tree.h"
#include "java-tree.h"
#include "obstack.h" #include "obstack.h"
#include "toplev.h" #include "toplev.h"
...@@ -37,15 +39,15 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -37,15 +39,15 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
int int
unicode_mangling_length (name, len) unicode_mangling_length (name, len)
char *name; const char *name;
int len; int len;
{ {
unsigned char *ptr; const unsigned char *ptr;
unsigned char *limit = (unsigned char *)name + len; const unsigned char *limit = (const unsigned char *)name + len;
int need_escapes = 0; int need_escapes = 0;
int num_chars = 0; int num_chars = 0;
int underscores = 0; int underscores = 0;
for (ptr = (unsigned char *) name; ptr < limit; ) for (ptr = (const unsigned char *) name; ptr < limit; )
{ {
int ch = UTF8_GET(ptr, limit); int ch = UTF8_GET(ptr, limit);
if (ch < 0) if (ch < 0)
...@@ -70,12 +72,12 @@ unicode_mangling_length (name, len) ...@@ -70,12 +72,12 @@ unicode_mangling_length (name, len)
void void
emit_unicode_mangled_name (obstack, name, len) emit_unicode_mangled_name (obstack, name, len)
struct obstack *obstack; struct obstack *obstack;
char *name; const char *name;
int len; int len;
{ {
unsigned char *ptr; const unsigned char *ptr;
unsigned char *limit = (unsigned char *)name + len; const unsigned char *limit = (const unsigned char *)name + len;
for (ptr = (unsigned char *) name; ptr < limit; ) for (ptr = (const unsigned char *) name; ptr < limit; )
{ {
int ch = UTF8_GET(ptr, limit); int ch = UTF8_GET(ptr, limit);
int emit_escape; int emit_escape;
...@@ -107,7 +109,7 @@ emit_unicode_mangled_name (obstack, name, len) ...@@ -107,7 +109,7 @@ emit_unicode_mangled_name (obstack, name, len)
void void
append_gpp_mangled_name (obstack, name, len) append_gpp_mangled_name (obstack, name, len)
struct obstack *obstack; struct obstack *obstack;
char *name; const char *name;
int len; int len;
{ {
int encoded_len = unicode_mangling_length (name, len); int encoded_len = unicode_mangling_length (name, len);
...@@ -132,9 +134,9 @@ append_gpp_mangled_name (obstack, name, len) ...@@ -132,9 +134,9 @@ append_gpp_mangled_name (obstack, name, len)
void void
append_gpp_mangled_classtype (obstack, class_name) append_gpp_mangled_classtype (obstack, class_name)
struct obstack *obstack; struct obstack *obstack;
char *class_name; const char *class_name;
{ {
char *ptr; const char *ptr;
int qualifications = 0; int qualifications = 0;
for (ptr = class_name; *ptr != '\0'; ptr++) for (ptr = class_name; *ptr != '\0'; ptr++)
......
...@@ -308,7 +308,7 @@ enum { ...@@ -308,7 +308,7 @@ enum {
INVOKE_NONVIRTUAL, INVOKE_NONVIRTUAL,
INVOKE_SUPER, INVOKE_SUPER,
INVOKE_INTERFACE, INVOKE_INTERFACE,
INVOKE_VIRTUAL, INVOKE_VIRTUAL
}; };
/* We need the resolution stuff only if we compile jc1 */ /* We need the resolution stuff only if we compile jc1 */
...@@ -357,7 +357,7 @@ enum jdep_code { ...@@ -357,7 +357,7 @@ enum jdep_code {
JDEP_TYPE, /* Patch a random tree node type, JDEP_TYPE, /* Patch a random tree node type,
without the need for any specific without the need for any specific
actions */ actions */
JDEP_EXCEPTION, /* Patch exceptions specified by `throws' */ JDEP_EXCEPTION /* Patch exceptions specified by `throws' */
}; };
typedef struct _jdep { typedef struct _jdep {
...@@ -647,11 +647,12 @@ void java_check_circular_reference PROTO ((void)); ...@@ -647,11 +647,12 @@ void java_check_circular_reference PROTO ((void));
void java_check_final PROTO ((void)); void java_check_final PROTO ((void));
void java_layout_classes PROTO ((void)); void java_layout_classes PROTO ((void));
tree java_method_add_stmt PROTO ((tree, tree)); tree java_method_add_stmt PROTO ((tree, tree));
char *java_get_line_col PROTO ((char *, int, int));
void java_expand_switch PROTO ((tree)); void java_expand_switch PROTO ((tree));
int java_report_errors PROTO (()); int java_report_errors PROTO (());
extern tree do_resolve_class PROTO ((tree, tree, tree)); extern tree do_resolve_class PROTO ((tree, tree, tree));
#endif #endif
char *java_get_line_col PROTO ((char *, int, int));
extern void reset_report PROTO ((void));
/* Always in use, no matter what you compile */ /* Always in use, no matter what you compile */
void java_push_parser_context PROTO ((void)); void java_push_parser_context PROTO ((void));
......
...@@ -33,6 +33,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -33,6 +33,9 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "java-except.h" #include "java-except.h"
#include "toplev.h" #include "toplev.h"
static void push_pending_label PROTO ((tree));
static tree merge_types PROTO ((tree, tree));
extern int stack_pointer; extern int stack_pointer;
/* During verification, start of the current subroutine (jsr target). */ /* During verification, start of the current subroutine (jsr target). */
...@@ -45,7 +48,7 @@ tree pending_blocks; ...@@ -45,7 +48,7 @@ tree pending_blocks;
/* Append TARGET_LABEL to the pending_block stack unless already in it. */ /* Append TARGET_LABEL to the pending_block stack unless already in it. */
void static void
push_pending_label (target_label) push_pending_label (target_label)
tree target_label; tree target_label;
{ {
...@@ -102,7 +105,7 @@ check_pending_block (target_label) ...@@ -102,7 +105,7 @@ check_pending_block (target_label)
For reference types, return the common super-class. For reference types, return the common super-class.
Return TYPE_UNKNOWN if the types cannot be merged. */ Return TYPE_UNKNOWN if the types cannot be merged. */
tree static tree
merge_types (type1, type2) merge_types (type1, type2)
tree type1, type2; tree type1, type2;
{ {
......
...@@ -57,5 +57,9 @@ extern struct ZipFileCache *SeenZipFiles; ...@@ -57,5 +57,9 @@ extern struct ZipFileCache *SeenZipFiles;
((ZipDirectory*)((char*)(ZIPD)+(ZIPD)->direntry_size)) ((ZipDirectory*)((char*)(ZIPD)+(ZIPD)->direntry_size))
#define ZIPMAGIC 0x504b0304 #define ZIPMAGIC 0x504b0304
extern ZipFile * opendir_in_zip (); extern ZipFile * opendir_in_zip PROTO ((const char *, int));
extern int read_zip_archive PROTO ((ZipFile *)); extern int read_zip_archive PROTO ((ZipFile *));
#ifdef JCF_ZIP
extern int open_in_zip PROTO ((struct JCF *, const char *,
const char *, int));
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment