mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-04 17:24:15 +08:00
decl.c (java_init_decl_processing): Create char_type_node as a regular INTEGER_TYPE node.
* decl.c (java_init_decl_processing): Create char_type_node as a regular INTEGER_TYPE node. (push_promoted_type): Preserve TYPE_STRING_FLAG on types. * typeck.c (convert): No longer check for CHAR_TYPEs but instead test for char_type_node and promoted_char_type_node as special instances of INTEGER_TYPE tree codes. (promote_type,build_java_signature): Likewise. * jcf-write.c (adjust_typed_op): Likewise. * mangle.c (mangle_type): Likewise. * parse.y (do_unary_numeric_promotion): No longer handle CHAR_TYPE. * parse.h (JINTEGRAL_TYPE_P): Likewise. From-SVN: r110592
This commit is contained in:
parent
dd4ebf6ae9
commit
5460aa9c92
@ -1,3 +1,17 @@
|
|||||||
|
2006-02-04 Roger Sayle <roger@eyesopen.com>
|
||||||
|
|
||||||
|
* decl.c (java_init_decl_processing): Create char_type_node as a
|
||||||
|
regular INTEGER_TYPE node.
|
||||||
|
(push_promoted_type): Preserve TYPE_STRING_FLAG on types.
|
||||||
|
* typeck.c (convert): No longer check for CHAR_TYPEs but instead
|
||||||
|
test for char_type_node and promoted_char_type_node as special
|
||||||
|
instances of INTEGER_TYPE tree codes.
|
||||||
|
(promote_type,build_java_signature): Likewise.
|
||||||
|
* jcf-write.c (adjust_typed_op): Likewise.
|
||||||
|
* mangle.c (mangle_type): Likewise.
|
||||||
|
* parse.y (do_unary_numeric_promotion): No longer handle CHAR_TYPE.
|
||||||
|
* parse.h (JINTEGRAL_TYPE_P): Likewise.
|
||||||
|
|
||||||
2006-02-04 Andreas Tobler <a.tobler@schweiz.ch>
|
2006-02-04 Andreas Tobler <a.tobler@schweiz.ch>
|
||||||
|
|
||||||
* expr.c (java_stack_swap): Revert gcc_assert patch.
|
* expr.c (java_stack_swap): Revert gcc_assert patch.
|
||||||
|
@ -538,6 +538,7 @@ push_promoted_type (const char *name, tree actual_type)
|
|||||||
TYPE_MAX_VALUE (type) = copy_node (in_max);
|
TYPE_MAX_VALUE (type) = copy_node (in_max);
|
||||||
TREE_TYPE (TYPE_MAX_VALUE (type)) = type;
|
TREE_TYPE (TYPE_MAX_VALUE (type)) = type;
|
||||||
TYPE_PRECISION (type) = TYPE_PRECISION (int_type_node);
|
TYPE_PRECISION (type) = TYPE_PRECISION (int_type_node);
|
||||||
|
TYPE_STRING_FLAG (type) = TYPE_STRING_FLAG (actual_type);
|
||||||
layout_type (type);
|
layout_type (type);
|
||||||
pushdecl (build_decl (TYPE_DECL, get_identifier (name), type));
|
pushdecl (build_decl (TYPE_DECL, get_identifier (name), type));
|
||||||
return type;
|
return type;
|
||||||
@ -738,7 +739,8 @@ java_init_decl_processing (void)
|
|||||||
initializations of __FUNCTION__ and __PRETTY_FUNCTION__. */
|
initializations of __FUNCTION__ and __PRETTY_FUNCTION__. */
|
||||||
short_array_type_node = build_prim_array_type (short_type_node, 200);
|
short_array_type_node = build_prim_array_type (short_type_node, 200);
|
||||||
#endif
|
#endif
|
||||||
char_type_node = make_node (CHAR_TYPE);
|
char_type_node = make_node (INTEGER_TYPE);
|
||||||
|
TYPE_STRING_FLAG (char_type_node) = 1;
|
||||||
TYPE_PRECISION (char_type_node) = 16;
|
TYPE_PRECISION (char_type_node) = 16;
|
||||||
fixup_unsigned_type (char_type_node);
|
fixup_unsigned_type (char_type_node);
|
||||||
pushdecl (build_decl (TYPE_DECL, get_identifier ("char"), char_type_node));
|
pushdecl (build_decl (TYPE_DECL, get_identifier ("char"), char_type_node));
|
||||||
|
@ -875,9 +875,9 @@ adjust_typed_op (tree type, int max)
|
|||||||
case RECORD_TYPE: return 4;
|
case RECORD_TYPE: return 4;
|
||||||
case BOOLEAN_TYPE:
|
case BOOLEAN_TYPE:
|
||||||
return TYPE_PRECISION (type) == 32 || max < 5 ? 0 : 5;
|
return TYPE_PRECISION (type) == 32 || max < 5 ? 0 : 5;
|
||||||
case CHAR_TYPE:
|
|
||||||
return TYPE_PRECISION (type) == 32 || max < 6 ? 0 : 6;
|
|
||||||
case INTEGER_TYPE:
|
case INTEGER_TYPE:
|
||||||
|
if (type == char_type_node || type == promoted_char_type_node)
|
||||||
|
return TYPE_PRECISION (type) == 32 || max < 6 ? 0 : 6;
|
||||||
switch (TYPE_PRECISION (type))
|
switch (TYPE_PRECISION (type))
|
||||||
{
|
{
|
||||||
case 8: return max < 5 ? 0 : 5;
|
case 8: return max < 5 ? 0 : 5;
|
||||||
|
@ -243,9 +243,13 @@ mangle_type (tree type)
|
|||||||
{
|
{
|
||||||
char code;
|
char code;
|
||||||
case BOOLEAN_TYPE: code = 'b'; goto primitive;
|
case BOOLEAN_TYPE: code = 'b'; goto primitive;
|
||||||
case CHAR_TYPE: code = 'w'; goto primitive;
|
|
||||||
case VOID_TYPE: code = 'v'; goto primitive;
|
case VOID_TYPE: code = 'v'; goto primitive;
|
||||||
case INTEGER_TYPE:
|
case INTEGER_TYPE:
|
||||||
|
if (type == char_type_node || type == promoted_char_type_node)
|
||||||
|
{
|
||||||
|
code = 'w';
|
||||||
|
goto primitive;
|
||||||
|
}
|
||||||
/* Get the original type instead of the arguments promoted type.
|
/* Get the original type instead of the arguments promoted type.
|
||||||
Avoid symbol name clashes. Should call a function to do that.
|
Avoid symbol name clashes. Should call a function to do that.
|
||||||
FIXME. */
|
FIXME. */
|
||||||
|
@ -196,8 +196,7 @@ extern void parse_error_context (tree cl, const char *gmsgid, ...) ATTRIBUTE_GCC
|
|||||||
/* Types classification, according to the JLS, section 4.2 */
|
/* Types classification, according to the JLS, section 4.2 */
|
||||||
#define JFLOAT_TYPE_P(TYPE) (TYPE && TREE_CODE ((TYPE)) == REAL_TYPE)
|
#define JFLOAT_TYPE_P(TYPE) (TYPE && TREE_CODE ((TYPE)) == REAL_TYPE)
|
||||||
#define JINTEGRAL_TYPE_P(TYPE) ((TYPE) \
|
#define JINTEGRAL_TYPE_P(TYPE) ((TYPE) \
|
||||||
&& (TREE_CODE ((TYPE)) == INTEGER_TYPE \
|
&& (TREE_CODE ((TYPE)) == INTEGER_TYPE))
|
||||||
|| TREE_CODE ((TYPE)) == CHAR_TYPE))
|
|
||||||
#define JNUMERIC_TYPE_P(TYPE) ((TYPE) \
|
#define JNUMERIC_TYPE_P(TYPE) ((TYPE) \
|
||||||
&& (JFLOAT_TYPE_P ((TYPE)) \
|
&& (JFLOAT_TYPE_P ((TYPE)) \
|
||||||
|| JINTEGRAL_TYPE_P ((TYPE))))
|
|| JINTEGRAL_TYPE_P ((TYPE))))
|
||||||
|
@ -13331,8 +13331,7 @@ static tree
|
|||||||
do_unary_numeric_promotion (tree arg)
|
do_unary_numeric_promotion (tree arg)
|
||||||
{
|
{
|
||||||
tree type = TREE_TYPE (arg);
|
tree type = TREE_TYPE (arg);
|
||||||
if ((TREE_CODE (type) == INTEGER_TYPE && TYPE_PRECISION (type) < 32)
|
if (TREE_CODE (type) == INTEGER_TYPE && TYPE_PRECISION (type) < 32)
|
||||||
|| TREE_CODE (type) == CHAR_TYPE)
|
|
||||||
arg = convert (int_type_node, arg);
|
arg = convert (int_type_node, arg);
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
@ -125,10 +125,12 @@ convert (tree type, tree expr)
|
|||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
if (code == VOID_TYPE)
|
if (code == VOID_TYPE)
|
||||||
return build1 (CONVERT_EXPR, type, expr);
|
return build1 (CONVERT_EXPR, type, expr);
|
||||||
if (code == BOOLEAN_TYPE || code == CHAR_TYPE)
|
if (code == BOOLEAN_TYPE)
|
||||||
return fold_convert (type, expr);
|
return fold_convert (type, expr);
|
||||||
if (code == INTEGER_TYPE)
|
if (code == INTEGER_TYPE)
|
||||||
{
|
{
|
||||||
|
if (type == char_type_node || type == promoted_char_type_node)
|
||||||
|
return fold_convert (type, expr);
|
||||||
if ((really_constant_p (expr)
|
if ((really_constant_p (expr)
|
||||||
|| (! flag_unsafe_math_optimizations
|
|| (! flag_unsafe_math_optimizations
|
||||||
&& ! flag_emit_class_files))
|
&& ! flag_emit_class_files))
|
||||||
@ -430,11 +432,9 @@ promote_type (tree type)
|
|||||||
if (type == boolean_type_node)
|
if (type == boolean_type_node)
|
||||||
return promoted_boolean_type_node;
|
return promoted_boolean_type_node;
|
||||||
goto handle_int;
|
goto handle_int;
|
||||||
case CHAR_TYPE:
|
case INTEGER_TYPE:
|
||||||
if (type == char_type_node)
|
if (type == char_type_node)
|
||||||
return promoted_char_type_node;
|
return promoted_char_type_node;
|
||||||
goto handle_int;
|
|
||||||
case INTEGER_TYPE:
|
|
||||||
handle_int:
|
handle_int:
|
||||||
if (TYPE_PRECISION (type) < TYPE_PRECISION (int_type_node))
|
if (TYPE_PRECISION (type) < TYPE_PRECISION (int_type_node))
|
||||||
{
|
{
|
||||||
@ -601,9 +601,13 @@ build_java_signature (tree type)
|
|||||||
switch (TREE_CODE (type))
|
switch (TREE_CODE (type))
|
||||||
{
|
{
|
||||||
case BOOLEAN_TYPE: sg[0] = 'Z'; goto native;
|
case BOOLEAN_TYPE: sg[0] = 'Z'; goto native;
|
||||||
case CHAR_TYPE: sg[0] = 'C'; goto native;
|
|
||||||
case VOID_TYPE: sg[0] = 'V'; goto native;
|
case VOID_TYPE: sg[0] = 'V'; goto native;
|
||||||
case INTEGER_TYPE:
|
case INTEGER_TYPE:
|
||||||
|
if (type == char_type_node || type == promoted_char_type_node)
|
||||||
|
{
|
||||||
|
sg[0] = 'C';
|
||||||
|
goto native;
|
||||||
|
}
|
||||||
switch (TYPE_PRECISION (type))
|
switch (TYPE_PRECISION (type))
|
||||||
{
|
{
|
||||||
case 8: sg[0] = 'B'; goto native;
|
case 8: sg[0] = 'B'; goto native;
|
||||||
|
Loading…
Reference in New Issue
Block a user