#include "input.h"
#include "javaop.h"
#include "java-tree.h"
-#include "toplev.h"
+#include "diagnostic-core.h"
#include "parse.h"
#include "ggc.h"
#include "debug.h"
-#include "assert.h"
#include "cgraph.h"
#include "vecprim.h"
#include "bitmap.h"
+#include "target.h"
#ifdef HAVE_LOCALE_H
#include <locale.h>
/* The METHOD_DECL for the current method. */
#define current_method parse_roots[1]
-/* A list of TRANSLATION_UNIT_DECLs for the files to be compiled. */
-static GTY(()) VEC(tree,gc) *current_file_list;
-
/* Line 0 in current file, if compiling from bytecode. */
static location_t file_start_location;
case CONSTANT_Long:
index = handle_long_constant (jcf, cpool, CONSTANT_Long, index,
- WORDS_BIG_ENDIAN);
+ targetm.words_big_endian ());
break;
case CONSTANT_Double:
index = handle_long_constant (jcf, cpool, CONSTANT_Double, index,
- FLOAT_WORDS_BIG_ENDIAN);
+ targetm.float_words_big_endian ());
break;
case CONSTANT_Float:
hi = JPOOL_UINT (jcf, index);
lo = JPOOL_UINT (jcf, index+1);
- if (FLOAT_WORDS_BIG_ENDIAN)
+ if (targetm.float_words_big_endian ())
buf[0] = hi, buf[1] = lo;
else
buf[0] = lo, buf[1] = hi;
gen_indirect_dispatch_tables (current_class);
for (method = TYPE_METHODS (current_class);
- method != NULL_TREE; method = TREE_CHAIN (method))
+ method != NULL_TREE; method = DECL_CHAIN (method))
{
JCF *jcf = current_jcf;
unsigned ix;
tree f;
- for (ix = 0; VEC_iterate (tree, predefined_filenames, ix, f); ix++)
+ FOR_EACH_VEC_ELT (tree, predefined_filenames, ix, f)
if (f == node)
return 1;
tree decl
= build_decl (input_location, FUNCTION_DECL, name,
- build_function_type (void_type_node, void_list_node));
+ build_function_type_list (void_type_node, NULL_TREE));
tree resdecl = build_decl (input_location,
RESULT_DECL, NULL_TREE, void_type_node);
void
-java_parse_file (int set_yydebug ATTRIBUTE_UNUSED)
+java_parse_file (void)
{
int filename_count = 0;
location_t save_location = input_location;
int avail = 2000;
finput = fopen (main_input_filename, "r");
if (finput == NULL)
- fatal_error ("can't open %s: %m", input_filename);
+ fatal_error ("can%'t open %s: %m", input_filename);
list = XNEWVEC (char, avail);
next = list;
for (;;)
duplicate_class_warning (IDENTIFIER_POINTER (node));
else
{
- tree file_decl = build_decl (input_location,
- TRANSLATION_UNIT_DECL, node, NULL);
- VEC_safe_push (tree, gc, current_file_list, file_decl);
+ build_translation_unit_decl (node);
IS_A_COMMAND_LINE_FILENAME_P (node) = 1;
}
}
const char *resource_filename;
/* Only one resource file may be compiled at a time. */
- assert (VEC_length (tree, current_file_list) == 1);
+ gcc_assert (VEC_length (tree, all_translation_units) == 1);
- resource_filename = IDENTIFIER_POINTER (DECL_NAME (VEC_index (tree, current_file_list, 0)));
+ resource_filename
+ = IDENTIFIER_POINTER
+ (DECL_NAME (VEC_index (tree, all_translation_units, 0)));
compile_resource_file (resource_name, resource_filename);
goto finish;
}
current_jcf = main_jcf;
- for (ix = 0; VEC_iterate (tree, current_file_list, ix, node); ix++)
+ FOR_EACH_VEC_ELT (tree, all_translation_units, ix, node)
{
unsigned char magic_string[4];
char *real_path;
/* Close previous descriptor, if any */
if (finput && fclose (finput))
- fatal_error ("can't close input file %s: %m", main_input_filename);
+ fatal_error ("can%'t close input file %s: %m", main_input_filename);
finput = fopen (filename, "rb");
if (finput == NULL)
- fatal_error ("can't open %s: %m", filename);
+ fatal_error ("can%'t open %s: %m", filename);
#ifdef IO_BUFFER_SIZE
setvbuf (finput, xmalloc (IO_BUFFER_SIZE),
if (magic == 0xcafebabe)
{
CLASS_FILE_P (node) = 1;
- current_jcf = GGC_NEW (JCF);
- JCF_ZERO (current_jcf);
+ current_jcf = ggc_alloc_cleared_JCF ();
current_jcf->read_state = finput;
current_jcf->filbuf = jcf_filbuf_from_stdio;
jcf_parse (current_jcf);
}
else if (magic == (JCF_u4)ZIPMAGIC)
{
- main_jcf = GGC_NEW (JCF);
- JCF_ZERO (main_jcf);
+ main_jcf = ggc_alloc_cleared_JCF ();
main_jcf->read_state = finput;
main_jcf->filbuf = jcf_filbuf_from_stdio;
linemap_add (line_table, LC_ENTER, false, filename, 0);
}
}
- for (ix = 0; VEC_iterate (tree, current_file_list, ix, node); ix++)
+ FOR_EACH_VEC_ELT (tree, all_translation_units, ix, node)
{
input_location = DECL_SOURCE_LOCATION (node);
if (CLASS_FILE_P (node))
class_name = compute_class_name (zdir);
file_name = XNEWVEC (char, zdir->filename_length+1);
- jcf = GGC_NEW (JCF);
- JCF_ZERO (jcf);
+ jcf = ggc_alloc_cleared_JCF ();
strncpy (file_name, class_name_in_zip_dir, zdir->filename_length);
file_name [zdir->filename_length] = '\0';