Loks of changes so we can better compile from source.
8 Loks of changes so we can better compile from source. See ChangeLog. From-SVN: r24280
This commit is contained in:
parent
502f194fa0
commit
63a212ed3e
|
@ -1643,7 +1643,7 @@ expand_java_field_op (is_static, is_putting, field_ref_index)
|
|||
this is also needed to avoid circularities in the implementation
|
||||
of these fields in libjava. */
|
||||
if (field_name == TYPE_identifier_node && ! is_putting
|
||||
&& field_type == class_ptr_type
|
||||
&& ! flag_emit_class_files && field_type == class_ptr_type
|
||||
&& strncmp (self_name, "java.lang.", 10) == 0)
|
||||
{
|
||||
tree typ = build_primtype_type_ref (self_name);
|
||||
|
|
|
@ -419,9 +419,6 @@ struct lang_identifier
|
|||
slot_number in decl_map. */
|
||||
#define DECL_LOCAL_SLOT_CHAIN(NODE) \
|
||||
(((struct lang_decl_var*)DECL_LANG_SPECIFIC(NODE))->slot_chain)
|
||||
/* For a static field seen from the parser, it holds its associated
|
||||
value, the one returned when the field is looked up. */
|
||||
#define DECL_LOCAL_STATIC_VALUE(NODE) DECL_LOCAL_SLOT_CHAIN (NODE)
|
||||
|
||||
/* DECL_LANG_SPECIFIC for FUNCTION_DECLs. */
|
||||
struct lang_decl
|
||||
|
|
|
@ -55,6 +55,11 @@ extern struct obstack *saveable_obstack;
|
|||
extern struct obstack temporary_obstack;
|
||||
extern struct obstack permanent_obstack;
|
||||
|
||||
/* This is true if the user specified a `.java' file on the command
|
||||
line. Otherwise it is 0. FIXME: this is temporary, until our
|
||||
.java parser is fully working. */
|
||||
int saw_java_source = 0;
|
||||
|
||||
/* The class we are currently processing. */
|
||||
tree current_class = NULL_TREE;
|
||||
|
||||
|
@ -477,8 +482,13 @@ load_class (class_or_name, verbose)
|
|||
/* Search in current zip first. */
|
||||
if (find_in_current_zip (IDENTIFIER_POINTER (name),
|
||||
IDENTIFIER_LENGTH (name), &jcf) == 0)
|
||||
/* FIXME: until the `.java' parser is fully working, we only
|
||||
look for a .java file when one was mentioned on the
|
||||
command line. This lets us test the .java parser fairly
|
||||
easily, without compromising our ability to use the
|
||||
.class parser without fear. */
|
||||
if (find_class (IDENTIFIER_POINTER (name), IDENTIFIER_LENGTH (name),
|
||||
&this_jcf, 1) == 0)
|
||||
&this_jcf, saw_java_source) == 0)
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
|
@ -739,7 +749,6 @@ yyparse ()
|
|||
if (list[0])
|
||||
{
|
||||
char *value, len;
|
||||
extern int saw_java_source; /* FIXME: temporary. */
|
||||
|
||||
len = strlen (list);
|
||||
/* FIXME: this test is only needed until our .java parser is
|
||||
|
@ -961,7 +970,8 @@ DEFUN(jcf_figure_file_type, (jcf),
|
|||
return JCF_CLASS;
|
||||
|
||||
/* FIXME: is it a system file? */
|
||||
if (!open_in_zip (jcf, input_filename, NULL, 0))
|
||||
if (magic == (JCF_u4)ZIPMAGIC
|
||||
&& !open_in_zip (jcf, input_filename, NULL, 0))
|
||||
{
|
||||
localToFile = ALLOC (sizeof (struct ZipFileCache));
|
||||
bcopy (SeenZipFiles, localToFile, sizeof (struct ZipFileCache));
|
||||
|
|
|
@ -410,7 +410,13 @@ put_linenumber (line, state)
|
|||
int line;
|
||||
struct jcf_partial *state;
|
||||
{
|
||||
(get_jcf_label_here (state))->linenumber = line;
|
||||
struct jcf_block *label = get_jcf_label_here (state);
|
||||
if (label->linenumber > 0)
|
||||
{
|
||||
label = gen_jcf_label (state);
|
||||
define_jcf_label (label, state);
|
||||
}
|
||||
label->linenumber = line;
|
||||
state->linenumber_count++;
|
||||
}
|
||||
|
||||
|
@ -1276,12 +1282,15 @@ generate_bytecode_insns (exp, target, state)
|
|||
case EXPR_WITH_FILE_LOCATION:
|
||||
{
|
||||
char *saved_input_filename = input_filename;
|
||||
tree body = EXPR_WFL_NODE (exp);
|
||||
int saved_lineno = lineno;
|
||||
if (body == empty_stmt_node)
|
||||
break;
|
||||
input_filename = EXPR_WFL_FILENAME (exp);
|
||||
lineno = EXPR_WFL_LINENO (exp);
|
||||
if (EXPR_WFL_EMIT_LINE_NOTE (exp))
|
||||
put_linenumber (EXPR_WFL_LINENO (exp), state);
|
||||
generate_bytecode_insns (EXPR_WFL_NODE (exp), target, state);
|
||||
if (EXPR_WFL_EMIT_LINE_NOTE (exp) && lineno > 0)
|
||||
put_linenumber (lineno, state);
|
||||
generate_bytecode_insns (body, target, state);
|
||||
input_filename = saved_input_filename;
|
||||
lineno = saved_lineno;
|
||||
}
|
||||
|
@ -1703,7 +1712,7 @@ generate_bytecode_insns (exp, target, state)
|
|||
emit_dup (1, 0, state);
|
||||
/* Stack: ..., objectref, objectref. */
|
||||
field_op (TREE_OPERAND (exp, 1), OPCODE_getfield, state);
|
||||
NOTE_PUSH (size);
|
||||
NOTE_PUSH (size-1);
|
||||
/* Stack: ..., objectref, oldvalue. */
|
||||
offset = 1;
|
||||
}
|
||||
|
@ -1742,7 +1751,9 @@ generate_bytecode_insns (exp, target, state)
|
|||
emit_binop (OPCODE_iadd + adjust_typed_op (type, 3), type, state);
|
||||
if (target != IGNORE_TARGET && ! post_op)
|
||||
emit_dup (size, offset, state);
|
||||
/* Stack: ..., [result,] newvalue. */
|
||||
/* Stack, if ARRAY_REF: ..., [result, ] array, index, newvalue. */
|
||||
/* Stack, if COMPONENT_REF: ..., [result, ] objectref, newvalue. */
|
||||
/* Stack, otherwise: ..., [result, ] newvalue. */
|
||||
goto finish_assignment;
|
||||
|
||||
case MODIFY_EXPR:
|
||||
|
@ -1817,11 +1828,10 @@ generate_bytecode_insns (exp, target, state)
|
|||
if (! FIELD_STATIC (field))
|
||||
NOTE_POP (1);
|
||||
field_op (field,
|
||||
FIELD_STATIC (field) ? OPCODE_putstatic
|
||||
: OPCODE_putfield,
|
||||
FIELD_STATIC (field) ? OPCODE_putstatic : OPCODE_putfield,
|
||||
state);
|
||||
|
||||
NOTE_PUSH (TYPE_IS_WIDE (TREE_TYPE (field)) ? 2 : 1);
|
||||
NOTE_POP (TYPE_IS_WIDE (TREE_TYPE (field)) ? 2 : 1);
|
||||
}
|
||||
else if (TREE_CODE (exp) == VAR_DECL
|
||||
|| TREE_CODE (exp) == PARM_DECL)
|
||||
|
@ -1829,18 +1839,17 @@ generate_bytecode_insns (exp, target, state)
|
|||
if (FIELD_STATIC (exp))
|
||||
{
|
||||
field_op (exp, OPCODE_putstatic, state);
|
||||
NOTE_PUSH (TYPE_IS_WIDE (TREE_TYPE (exp)) ? 2 : 1);
|
||||
NOTE_POP (TYPE_IS_WIDE (TREE_TYPE (exp)) ? 2 : 1);
|
||||
}
|
||||
else
|
||||
emit_store (exp, state);
|
||||
}
|
||||
else if (TREE_CODE (exp) == ARRAY_REF)
|
||||
{
|
||||
NOTE_POP (2);
|
||||
jopcode = OPCODE_iastore + adjust_typed_op (TREE_TYPE (exp), 7);
|
||||
RESERVE(1);
|
||||
OP1 (jopcode);
|
||||
NOTE_PUSH (TYPE_IS_WIDE (TREE_TYPE (exp)) ? 2 : 1);
|
||||
NOTE_POP (TYPE_IS_WIDE (TREE_TYPE (exp)) ? 4 : 3);
|
||||
}
|
||||
else
|
||||
fatal ("internal error (bad lhs to MODIFY_EXPR)");
|
||||
|
@ -1883,8 +1892,11 @@ generate_bytecode_insns (exp, target, state)
|
|||
generate_bytecode_insns (arg0, target, state);
|
||||
generate_bytecode_insns (arg1, target, state);
|
||||
}
|
||||
/* For most binary operations, both operands and the result have the
|
||||
same type. Shift operations are different. Using arg1's type
|
||||
gets us the correct SP adjustment in all casesd. */
|
||||
if (target == STACK_TARGET)
|
||||
emit_binop (jopcode, type, state);
|
||||
emit_binop (jopcode, TREE_TYPE (arg1), state);
|
||||
break;
|
||||
}
|
||||
case TRUTH_NOT_EXPR:
|
||||
|
@ -2054,10 +2066,16 @@ generate_bytecode_insns (exp, target, state)
|
|||
break;
|
||||
case NEW_ARRAY_INIT:
|
||||
{
|
||||
tree values;
|
||||
tree values = CONSTRUCTOR_ELTS (TREE_OPERAND (exp, 0));
|
||||
tree array_type = TREE_TYPE (TREE_TYPE (exp));
|
||||
tree element_type = TYPE_ARRAY_ELEMENT (array_type);
|
||||
HOST_WIDE_INT length = java_array_type_length (array_type);
|
||||
if (target == IGNORE_TARGET)
|
||||
{
|
||||
for ( ; values != NULL_TREE; values = TREE_CHAIN (values))
|
||||
generate_bytecode_insns (TREE_VALUE (values), target, state);
|
||||
break;
|
||||
}
|
||||
push_int_const (length, state);
|
||||
NOTE_PUSH (1);
|
||||
RESERVE (3);
|
||||
|
@ -2074,7 +2092,6 @@ generate_bytecode_insns (exp, target, state)
|
|||
OP1 (OPCODE_anewarray);
|
||||
OP2 (index);
|
||||
}
|
||||
values = CONSTRUCTOR_ELTS (TREE_OPERAND (exp, 0));
|
||||
offset = 0;
|
||||
jopcode = OPCODE_iastore + adjust_typed_op (element_type, 7);
|
||||
for ( ; values != NULL_TREE; values = TREE_CHAIN (values), offset++)
|
||||
|
@ -2082,6 +2099,7 @@ generate_bytecode_insns (exp, target, state)
|
|||
int save_SP = state->code_SP;
|
||||
emit_dup (1, 0, state);
|
||||
push_int_const (offset, state);
|
||||
NOTE_PUSH (1);
|
||||
generate_bytecode_insns (TREE_VALUE (values), STACK_TARGET, state);
|
||||
RESERVE (1);
|
||||
OP1 (jopcode);
|
||||
|
@ -2183,11 +2201,11 @@ generate_bytecode_insns (exp, target, state)
|
|||
int index = find_methodref_index (&state->cpool, f);
|
||||
int interface = 0;
|
||||
RESERVE (5);
|
||||
if (DECL_CONSTRUCTOR_P (f) || CALL_USING_SUPER (exp)
|
||||
if (METHOD_STATIC (f))
|
||||
OP1 (OPCODE_invokestatic);
|
||||
else if (DECL_CONSTRUCTOR_P (f) || CALL_USING_SUPER (exp)
|
||||
|| METHOD_PRIVATE (f))
|
||||
OP1 (OPCODE_invokespecial);
|
||||
else if (METHOD_STATIC (f))
|
||||
OP1 (OPCODE_invokestatic);
|
||||
else if (CLASS_INTERFACE (TYPE_NAME (DECL_CONTEXT (f))))
|
||||
{
|
||||
OP1 (OPCODE_invokeinterface);
|
||||
|
@ -2496,7 +2514,7 @@ generate_classfile (clas, state)
|
|||
for (part = TYPE_FIELDS (clas); part; part = TREE_CHAIN (part))
|
||||
{
|
||||
int have_value;
|
||||
if (DECL_NAME (part) == NULL_TREE)
|
||||
if (DECL_NAME (part) == NULL_TREE || DECL_ARTIFICIAL (part))
|
||||
continue;
|
||||
ptr = append_chunk (NULL, 8, state);
|
||||
i = get_access_flags (part); PUT2 (i);
|
||||
|
@ -2533,6 +2551,8 @@ generate_classfile (clas, state)
|
|||
tree name = DECL_CONSTRUCTOR_P (part) ? init_identifier_node
|
||||
: DECL_NAME (part);
|
||||
tree type = TREE_TYPE (part);
|
||||
tree save_function = current_function_decl;
|
||||
current_function_decl = part;
|
||||
ptr = append_chunk (NULL, 8, state);
|
||||
i = get_access_flags (part); PUT2 (i);
|
||||
i = find_utf8_constant (&state->cpool, name); PUT2 (i);
|
||||
|
@ -2653,6 +2673,7 @@ generate_classfile (clas, state)
|
|||
}
|
||||
}
|
||||
methods_count++;
|
||||
current_function_decl = save_function;
|
||||
}
|
||||
ptr = methods_count_ptr; PUT2 (methods_count);
|
||||
|
||||
|
|
1342
gcc/java/parse.c
1342
gcc/java/parse.c
File diff suppressed because it is too large
Load Diff
286
gcc/java/parse.y
286
gcc/java/parse.y
|
@ -68,6 +68,7 @@ definitions and other extensions. */
|
|||
#include "parse.h"
|
||||
#include "zipfile.h"
|
||||
#include "convert.h"
|
||||
#include "buffer.h"
|
||||
|
||||
/* Local function prototypes */
|
||||
static char *java_accstring_lookup PROTO ((int));
|
||||
|
@ -593,11 +594,7 @@ type_import_on_demand_declaration:
|
|||
{
|
||||
tree name = EXPR_WFL_NODE ($2);
|
||||
tree node = build_tree_list ($2, NULL_TREE);
|
||||
if (!IS_AN_IMPORT_ON_DEMAND_P (name))
|
||||
{
|
||||
read_import_dir ($2);
|
||||
IS_AN_IMPORT_ON_DEMAND_P (name) = 1;
|
||||
}
|
||||
read_import_dir ($2);
|
||||
TREE_CHAIN (node) = ctxp->import_demand_list;
|
||||
ctxp->import_demand_list = node;
|
||||
}
|
||||
|
@ -4864,70 +4861,22 @@ find_in_imports (class_type)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Process a import on demand statement (lazy) */
|
||||
|
||||
static int
|
||||
read_import_entry (jcf, dirp, returned_name)
|
||||
JCF *jcf;
|
||||
DIR *dirp;
|
||||
char **returned_name;
|
||||
note_possible_classname (name, len)
|
||||
char *name;
|
||||
int len;
|
||||
{
|
||||
if (dirp)
|
||||
{
|
||||
struct dirent *direntp = readdir (dirp);
|
||||
if (!direntp)
|
||||
{
|
||||
*returned_name = NULL;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*returned_name = direntp->d_name;
|
||||
return (strlen (direntp->d_name));
|
||||
}
|
||||
}
|
||||
tree node;
|
||||
if (len > 5 && strncmp (&name [len-5], ".java", 5) == 0)
|
||||
len = len - 5;
|
||||
else if (len > 6 && strncmp (&name [len-6], ".class", 6) == 0)
|
||||
len = len - 6;
|
||||
else
|
||||
{
|
||||
int current_dir_len = strlen (jcf->classname);
|
||||
char *current_entry;
|
||||
int current_entry_len;
|
||||
|
||||
/* Here we read a zip directory as a file directory. The files
|
||||
we're selecting must have the same root than the directory
|
||||
we're examining. */
|
||||
|
||||
ZipDirectory *zipd = (ZipDirectory *)jcf->zipd;
|
||||
|
||||
while (zipd)
|
||||
{
|
||||
current_entry = ZIPDIR_FILENAME (zipd);
|
||||
current_entry_len = zipd->filename_length;
|
||||
while (current_entry_len && current_entry [current_entry_len] != '/')
|
||||
current_entry_len--;
|
||||
/* If the path of the current file doesn't match the directory we're
|
||||
scanning, that the end of the search */
|
||||
current_entry_len++;
|
||||
if (strncmp (jcf->classname, current_entry, current_dir_len))
|
||||
{
|
||||
*returned_name = NULL;
|
||||
return 0;
|
||||
}
|
||||
/* Ok, we have at least the same path. The position of the last '/'
|
||||
of the current file we're examining should match the size of
|
||||
name of the directory we're browsing, otherwise that an entry
|
||||
belonging to a sub directory, we want to skip it. */
|
||||
if (current_entry_len != current_dir_len)
|
||||
zipd = ZIPDIR_NEXT (zipd);
|
||||
else
|
||||
{
|
||||
jcf->zipd = ZIPDIR_NEXT (zipd); /* Prepare next read */
|
||||
*returned_name = ¤t_entry [current_entry_len];
|
||||
return (zipd->filename_length - current_entry_len);
|
||||
}
|
||||
}
|
||||
*returned_name = NULL;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
node = ident_subst (name, len, "", '/', '.', "");
|
||||
IS_A_CLASSFILE_NAME (node) = 1; /* Or soon to be */
|
||||
QUALIFIED_P (node) = 1; /* As soon as we turn / into . */
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Read a import directory, gathering potential match for further type
|
||||
|
@ -4938,24 +4887,104 @@ static void
|
|||
read_import_dir (wfl)
|
||||
tree wfl;
|
||||
{
|
||||
char *name = IDENTIFIER_POINTER (EXPR_WFL_NODE (wfl));
|
||||
int name_len = IDENTIFIER_LENGTH (EXPR_WFL_NODE (wfl)), reclen;
|
||||
tree package_id = EXPR_WFL_NODE (wfl);
|
||||
char *package_name = IDENTIFIER_POINTER (package_id);
|
||||
int package_length = IDENTIFIER_LENGTH (package_id);
|
||||
DIR *dirp = NULL;
|
||||
JCF jcfr, *jcf, *saved_jcf = current_jcf;
|
||||
char *founddirname, *d_name;
|
||||
|
||||
jcf = &jcfr;
|
||||
if (!(founddirname = find_class (name, name_len, jcf, 0)))
|
||||
fatal ("Can't import `%s'", name);
|
||||
if (jcf->outofsynch)
|
||||
jcf_out_of_synch (jcf);
|
||||
if (jcf->seen_in_zip)
|
||||
jcf->zipd = ZIPDIR_NEXT ((ZipDirectory *)jcf->zipd);
|
||||
int found = 0;
|
||||
int k;
|
||||
void *entry;
|
||||
struct buffer filename[1];
|
||||
|
||||
else if (founddirname)
|
||||
dirp = opendir (founddirname);
|
||||
|
||||
if (!founddirname && !dirp)
|
||||
if (IS_AN_IMPORT_ON_DEMAND_P (package_id))
|
||||
return;
|
||||
IS_AN_IMPORT_ON_DEMAND_P (package_id) = 1;
|
||||
|
||||
BUFFER_INIT (filename);
|
||||
buffer_grow (filename, package_length + 100);
|
||||
|
||||
for (entry = jcf_path_start (); entry != NULL; entry = jcf_path_next (entry))
|
||||
{
|
||||
char *entry_name = jcf_path_name (entry);
|
||||
int entry_length = strlen (entry_name);
|
||||
if (jcf_path_is_zipfile (entry))
|
||||
{
|
||||
ZipFile *zipf;
|
||||
buffer_grow (filename, entry_length);
|
||||
memcpy (filename->data, entry_name, entry_length - 1);
|
||||
filename->data[entry_length-1] = '\0';
|
||||
zipf = opendir_in_zip (filename->data, jcf_path_is_system (entry));
|
||||
if (zipf == NULL)
|
||||
error ("malformed .zip archive in CLASSPATH: %s", entry_name);
|
||||
else
|
||||
{
|
||||
ZipDirectory *zipd = (ZipDirectory *) zipf->central_directory;
|
||||
BUFFER_RESET (filename);
|
||||
for (k = 0; k < package_length; k++)
|
||||
{
|
||||
char ch = package_name[k];
|
||||
*filename->ptr++ = ch == '.' ? '/' : ch;
|
||||
}
|
||||
*filename->ptr++ = '/';
|
||||
|
||||
for (; k < zipf->count; k++, zipd = ZIPDIR_NEXT (zipd))
|
||||
{
|
||||
char *current_entry = ZIPDIR_FILENAME (zipd);
|
||||
int current_entry_len = zipd->filename_length;
|
||||
|
||||
if (strncmp (filename->data, current_entry,
|
||||
BUFFER_LENGTH (filename)) != 0)
|
||||
continue;
|
||||
found += note_possible_classname (current_entry,
|
||||
current_entry_len);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
BUFFER_RESET (filename);
|
||||
buffer_grow (filename, entry_length + package_length + 4);
|
||||
strcpy (filename->data, entry_name);
|
||||
filename->ptr = filename->data + entry_length;
|
||||
for (k = 0; k < package_length; k++)
|
||||
{
|
||||
char ch = package_name[k];
|
||||
*filename->ptr++ = ch == '.' ? '/' : ch;
|
||||
}
|
||||
*filename->ptr = '\0';
|
||||
|
||||
dirp = opendir (filename->data);
|
||||
if (dirp == NULL)
|
||||
continue;
|
||||
*filename->ptr++ = '/';
|
||||
for (;;)
|
||||
{
|
||||
int java_or_class = 0;
|
||||
int len;
|
||||
char *d_name;
|
||||
struct dirent *direntp = readdir (dirp);
|
||||
if (!direntp)
|
||||
break;
|
||||
d_name = direntp->d_name;
|
||||
len = strlen (direntp->d_name);
|
||||
buffer_grow (filename, len+1);
|
||||
strcpy (filename->ptr, d_name);
|
||||
found += note_possible_classname (filename->data + entry_length,
|
||||
package_length+len+1);
|
||||
}
|
||||
if (dirp)
|
||||
closedir (dirp);
|
||||
}
|
||||
}
|
||||
|
||||
free (filename->data);
|
||||
|
||||
/* Here we should have a unified way of retrieving an entry, to be
|
||||
indexed. */
|
||||
if (!found)
|
||||
{
|
||||
static int first = 1;
|
||||
if (first)
|
||||
|
@ -4963,55 +4992,17 @@ read_import_dir (wfl)
|
|||
char buffer [256];
|
||||
sprintf (buffer, "Can't find default package `%s'. Check "
|
||||
"the CLASSPATH environment variable and the access to the "
|
||||
"archives.", name);
|
||||
"archives.", package_name);
|
||||
error (buffer);
|
||||
java_error_count++;
|
||||
first = 0;
|
||||
}
|
||||
else
|
||||
parse_error_context (wfl, "Package `%s' not found in import", name);
|
||||
parse_error_context (wfl, "Package `%s' not found in import",
|
||||
package_name);
|
||||
current_jcf = saved_jcf;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Here we should have a unified way of retrieving an entry, to be
|
||||
indexed. */
|
||||
while ((reclen = read_import_entry (jcf, dirp, &d_name)))
|
||||
{
|
||||
int java_or_class = 0;
|
||||
int len;
|
||||
if ((reclen > 5)
|
||||
&& !strcmp (&d_name [reclen-5], ".java"))
|
||||
{
|
||||
java_or_class = 1;
|
||||
len = reclen - 5;
|
||||
}
|
||||
|
||||
if (!java_or_class && (reclen > 6) &&
|
||||
!strcmp (&d_name [reclen-6], ".class"))
|
||||
{
|
||||
java_or_class = 2;
|
||||
len = reclen - 6;
|
||||
}
|
||||
|
||||
if (java_or_class)
|
||||
{
|
||||
char *id_name;
|
||||
tree node;
|
||||
|
||||
obstack_grow (&temporary_obstack, name, name_len);
|
||||
obstack_1grow (&temporary_obstack, '/');
|
||||
obstack_grow0 (&temporary_obstack, d_name, len);
|
||||
id_name = obstack_finish (&temporary_obstack);
|
||||
|
||||
node = get_identifier (id_name);
|
||||
IS_A_CLASSFILE_NAME (node) = 1; /* Or soon to be */
|
||||
QUALIFIED_P (node) = 1; /* As soon as we turn / into . */
|
||||
}
|
||||
}
|
||||
if (dirp)
|
||||
closedir (dirp);
|
||||
|
||||
current_jcf = saved_jcf;
|
||||
}
|
||||
|
||||
|
@ -5033,7 +5024,7 @@ find_in_imports_on_demand (class_type)
|
|||
obstack_grow (&temporary_obstack,
|
||||
IDENTIFIER_POINTER (EXPR_WFL_NODE (TREE_PURPOSE (import))),
|
||||
IDENTIFIER_LENGTH (EXPR_WFL_NODE (TREE_PURPOSE (import))));
|
||||
obstack_1grow (&temporary_obstack, '/');
|
||||
obstack_1grow (&temporary_obstack, '.');
|
||||
obstack_grow0 (&temporary_obstack,
|
||||
IDENTIFIER_POINTER (TYPE_NAME (class_type)),
|
||||
IDENTIFIER_LENGTH (TYPE_NAME (class_type)));
|
||||
|
@ -5066,9 +5057,7 @@ find_in_imports_on_demand (class_type)
|
|||
tree decl;
|
||||
int saved_lineno = lineno;
|
||||
lineno = EXPR_WFL_LINENO (cl);
|
||||
TYPE_NAME (class_type) = ident_subst (IDENTIFIER_POINTER (node_to_use),
|
||||
IDENTIFIER_LENGTH (node_to_use),
|
||||
"", '/', '.', "");
|
||||
TYPE_NAME (class_type) = node_to_use;
|
||||
QUALIFIED_P (TYPE_NAME (class_type)) = 1;
|
||||
decl = IDENTIFIER_CLASS_VALUE (TYPE_NAME (class_type));
|
||||
/* If there is no DECL set for the class or if the class isn't
|
||||
|
@ -5617,8 +5606,13 @@ java_complete_expand_methods ()
|
|||
|
||||
/* Make the class data, register it and run the rest of decl
|
||||
compilation on it */
|
||||
if (!java_error_count && ! flag_emit_class_files)
|
||||
finish_class (current_class);
|
||||
if (!java_error_count)
|
||||
{
|
||||
if (flag_emit_class_files)
|
||||
write_classfile (current_class);
|
||||
else
|
||||
finish_class (current_class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5809,8 +5803,6 @@ java_expand_classes ()
|
|||
java_parse_abort_on_error ();
|
||||
java_check_final (); /* Check unitialized final */
|
||||
java_parse_abort_on_error ();
|
||||
if (flag_emit_class_files)
|
||||
write_classfile (current_class);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7860,12 +7852,32 @@ java_complete_tree (node)
|
|||
TREE_OPERAND (node, 1) = save_expr (TREE_OPERAND (node, 1));
|
||||
return patch_array_ref (node);
|
||||
|
||||
#if 0
|
||||
COMPONENT_REF:
|
||||
/* Planned re-write FIXME */
|
||||
case RECORD_TYPE:
|
||||
return node;;
|
||||
|
||||
case COMPONENT_REF:
|
||||
/* The first step in the re-write of qualified name handling. FIXME.
|
||||
So far, this is only to support PRIMTYPE.class -> PRIMCLASS.TYPE. */
|
||||
TREE_OPERAND (node, 0) = java_complete_tree (TREE_OPERAND (node, 0));
|
||||
if (TREE_CODE (TREE_OPERAND (node, 0)) == RECORD_TYPE)
|
||||
{
|
||||
tree name = TREE_OPERAND (node, 1);
|
||||
tree field = lookup_field_wrapper (TREE_OPERAND (node, 0), name);
|
||||
if (field == NULL_TREE)
|
||||
{
|
||||
error ("missing static field `%s'", IDENTIFIER_POINTER (name));
|
||||
return error_mark_node;
|
||||
}
|
||||
if (! FIELD_STATIC (field))
|
||||
{
|
||||
error ("not a static field `%s'", IDENTIFIER_POINTER (name));
|
||||
return error_mark_node;
|
||||
}
|
||||
return field;
|
||||
}
|
||||
else
|
||||
fatal ("unimplemented java_complete_tree for COMPONENT_REF");
|
||||
break;
|
||||
#endif
|
||||
|
||||
case THIS_EXPR:
|
||||
/* Can't use THIS in a static environment */
|
||||
|
@ -10726,9 +10738,13 @@ patch_synchronized_statement (node, wfl_op1)
|
|||
BUILD_MONITOR_ENTER (stmt, expr);
|
||||
compound = add_stmt_to_compound (NULL_TREE, int_type_node, stmt);
|
||||
compound = add_stmt_to_compound (compound, void_type_node, block);
|
||||
BUILD_MONITOR_EXIT (stmt, expr);
|
||||
compound = add_stmt_to_compound (compound, int_type_node, stmt);
|
||||
if (CAN_COMPLETE_NORMALLY (block))
|
||||
{
|
||||
BUILD_MONITOR_EXIT (stmt, expr);
|
||||
compound = add_stmt_to_compound (compound, int_type_node, stmt);
|
||||
}
|
||||
try_block = build_expr_block (compound, NULL_TREE);
|
||||
CAN_COMPLETE_NORMALLY (try_block) = CAN_COMPLETE_NORMALLY (block);
|
||||
|
||||
/* CATCH_ALL block */
|
||||
decl = build_decl (VAR_DECL, generate_name (), ptr_type_node);
|
||||
|
@ -10744,7 +10760,7 @@ patch_synchronized_statement (node, wfl_op1)
|
|||
|
||||
/* TRY-CATCH statement */
|
||||
compound = build (TRY_EXPR, void_type_node, try_block, catch_all, NULL_TREE);
|
||||
CAN_COMPLETE_NORMALLY (compound) = CAN_COMPLETE_NORMALLY (block);
|
||||
CAN_COMPLETE_NORMALLY (compound) = CAN_COMPLETE_NORMALLY (try_block);
|
||||
return compound;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue