Commit 7e57923c by Andrew Haley Committed by Andrew Haley

class.c (build_utf8_ref): Back out broken patch which was intended to to output…

class.c (build_utf8_ref): Back out broken patch which was intended to to output signatures using '.' as a...

1999-02-09  Andrew Haley  <aph@cygnus.com>
        * class.c (build_utf8_ref): Back out broken patch which was
        intended to to output signatures using '.' as a separator.
        * class.c (make_class_data): Output signatures using '.' as a
        separator, rather than '/'.
        (mangled_classname): Likewise.
        (make_field_value): Likewise.
        (make_method_value): Likewise.
        * constants.c (alloc_class_constant): Likewise.
        * expr.c (build_invokeinterface): Likewise.

From-SVN: r25260
parent 04f7a12f
1999-02-17 Andrew Haley <aph@cygnus.com>
* class.c (build_utf8_ref): Back out broken patch which was
intended to to output signatures using '.' as a separator.
* class.c (make_class_data): Output signatures using '.' as a
separator, rather than '/'.
(mangled_classname): Likewise.
(make_field_value): Likewise.
(make_method_value): Likewise.
* constants.c (alloc_class_constant): Likewise.
* expr.c (build_invokeinterface): Likewise.
Thu Feb 11 21:25:51 1999 Alexandre Petit-Bianco <apbianco@cygnus.com> Thu Feb 11 21:25:51 1999 Alexandre Petit-Bianco <apbianco@cygnus.com>
* parse.y (valid_builtin_assignconv_identity_widening_p): Got rid * parse.y (valid_builtin_assignconv_identity_widening_p): Got rid
......
...@@ -103,7 +103,7 @@ mangled_classname (prefix, type) ...@@ -103,7 +103,7 @@ mangled_classname (prefix, type)
tree ident = TYPE_NAME (type); tree ident = TYPE_NAME (type);
if (TREE_CODE (ident) != IDENTIFIER_NODE) if (TREE_CODE (ident) != IDENTIFIER_NODE)
ident = DECL_NAME (ident); ident = DECL_NAME (ident);
return identifier_subst (ident, prefix, '/', '_', ""); return identifier_subst (ident, prefix, '.', '_', "");
} }
tree tree
...@@ -557,21 +557,10 @@ build_utf8_ref (name) ...@@ -557,21 +557,10 @@ build_utf8_ref (name)
PUSH_FIELD (ctype, field, "data", str_type); PUSH_FIELD (ctype, field, "data", str_type);
FINISH_RECORD (ctype); FINISH_RECORD (ctype);
START_RECORD_CONSTRUCTOR (cinit, ctype); START_RECORD_CONSTRUCTOR (cinit, ctype);
{ name_hash = hashUtf8String (name_ptr, name_len) & 0xFFFF;
int i; PUSH_FIELD_VALUE (cinit, "hash", build_int_2 (name_hash, 0));
/* Rewrite .class file internal form to canonical Java form. */ PUSH_FIELD_VALUE (cinit, "length", build_int_2 (name_len, 0));
#ifdef __GNUC__ string = build_string (name_len, name_ptr);
char buffer[name_len];
#else
char *buffer = (char *)alloca (name_len);
#endif
for (i = 0; i < name_len; i++)
buffer[i] = (name_ptr[i] == '/' ? '.' : name_ptr[i]);
name_hash = hashUtf8String (buffer, name_len) & 0xFFFF;
PUSH_FIELD_VALUE (cinit, "hash", build_int_2 (name_hash, 0));
PUSH_FIELD_VALUE (cinit, "length", build_int_2 (name_len, 0));
string = build_string (name_len, buffer);
}
TREE_TYPE (string) = str_type; TREE_TYPE (string) = str_type;
PUSH_FIELD_VALUE (cinit, "data", string); PUSH_FIELD_VALUE (cinit, "data", string);
FINISH_RECORD_CONSTRUCTOR (cinit); FINISH_RECORD_CONSTRUCTOR (cinit);
...@@ -851,7 +840,12 @@ make_field_value (tree fdecl) ...@@ -851,7 +840,12 @@ make_field_value (tree fdecl)
if (resolved) if (resolved)
type = build_class_ref (type); type = build_class_ref (type);
else else
type = build_utf8_ref (build_java_signature (type)); {
tree signature = build_java_signature (type);
type = build_utf8_ref (unmangle_classname
(IDENTIFIER_POINTER(signature),
IDENTIFIER_LENGTH(signature)));
}
PUSH_FIELD_VALUE (finit, "type", type); PUSH_FIELD_VALUE (finit, "type", type);
flags = get_access_flags_from_decl (fdecl); flags = get_access_flags_from_decl (fdecl);
if (! resolved) if (! resolved)
...@@ -897,8 +891,14 @@ make_method_value (mdecl, this_class_addr) ...@@ -897,8 +891,14 @@ make_method_value (mdecl, this_class_addr)
build_utf8_ref (DECL_CONSTRUCTOR_P (mdecl) ? build_utf8_ref (DECL_CONSTRUCTOR_P (mdecl) ?
init_identifier_node init_identifier_node
: DECL_NAME (mdecl))); : DECL_NAME (mdecl)));
PUSH_FIELD_VALUE (minit, "signature", {
build_utf8_ref (build_java_signature (TREE_TYPE (mdecl)))); tree signature = build_java_signature (TREE_TYPE (mdecl));
PUSH_FIELD_VALUE (minit, "signature",
(build_utf8_ref
(unmangle_classname
(IDENTIFIER_POINTER(signature),
IDENTIFIER_LENGTH(signature)))));
}
PUSH_FIELD_VALUE (minit, "accflags", build_int_2 (accflags, 0)); PUSH_FIELD_VALUE (minit, "accflags", build_int_2 (accflags, 0));
PUSH_FIELD_VALUE (minit, "ncode", code); PUSH_FIELD_VALUE (minit, "ncode", code);
FINISH_RECORD_CONSTRUCTOR (minit); FINISH_RECORD_CONSTRUCTOR (minit);
......
...@@ -368,9 +368,12 @@ int ...@@ -368,9 +368,12 @@ int
alloc_class_constant (clas) alloc_class_constant (clas)
tree clas; tree clas;
{ {
tree class_name = build_internal_class_name (clas);
return alloc_name_constant (CONSTANT_Class, return alloc_name_constant (CONSTANT_Class,
build_internal_class_name (clas)); (unmangle_classname
(IDENTIFIER_POINTER(class_name),
IDENTIFIER_LENGTH(class_name))));
} }
/* Return a reference to the data array of the current constant pool. */ /* Return a reference to the data array of the current constant pool. */
......
...@@ -1473,7 +1473,11 @@ build_invokeinterface (dtable, method_name, method_signature) ...@@ -1473,7 +1473,11 @@ build_invokeinterface (dtable, method_name, method_signature)
dtable = build1 (INDIRECT_REF, dtable_type, dtable); dtable = build1 (INDIRECT_REF, dtable_type, dtable);
dtable = build (COMPONENT_REF, class_ptr_type, dtable, dtable = build (COMPONENT_REF, class_ptr_type, dtable,
lookup_field (&dtable_type, class_ident)); lookup_field (&dtable_type, class_ident));
lookup_arg = build_tree_list (NULL_TREE, build_utf8_ref (method_signature)); lookup_arg = build_tree_list (NULL_TREE,
(build_utf8_ref
(unmangle_classname
(IDENTIFIER_POINTER(method_signature),
IDENTIFIER_LENGTH(method_signature)))));
lookup_arg = tree_cons (NULL_TREE, dtable, lookup_arg = tree_cons (NULL_TREE, dtable,
tree_cons (NULL_TREE, build_utf8_ref (method_name), tree_cons (NULL_TREE, build_utf8_ref (method_name),
lookup_arg)); lookup_arg));
......
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