From 855dd2bcff9e32e053bf66e336405ded26e9c927 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 8 Feb 2006 18:06:11 +0000 Subject: re PR java/22578 (should inline floatToIntBits et al) gcc/java PR java/22578: * check-init.c (check_init): Handle VIEW_CONVERT_EXPR. * builtins.c (convert_real): New function. (java_builtins): Handle Float.intBitsToFloat, Float.floatToRawIntBits, Double.longBitsToDouble, Double.doubleToRawLongBits. libjava PR java/22578: * gcj/javaprims.h: Updated. * sources.am, Makefile.in: Rebuilt. * java/lang/natDouble.cc (doubleToLongBits): Moved to VMDouble. (doubleToRawLongBits): Likewise. (longBitsToDouble): Likewise. (toString): Likewise. (parseDouble): Likewise. * java/lang/natFloat.cc (floatToIntBits): Moved to VMFloat. (floatToRawIntBits): Likewise. (intBitsToFloat): Likewise. * java/lang/VMDouble.java: New file. * java/lang/VMFloat.java: New file. * java/lang/Float.java, java/lang/Double.java: Removed. From-SVN: r110759 --- gcc/java/ChangeLog | 9 +++++++++ gcc/java/builtins.c | 12 ++++++++++++ gcc/java/check-init.c | 3 ++- 3 files changed, 23 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index eb05ec0..89cef7c 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,12 @@ +2006-02-08 Tom Tromey + + PR java/22578: + * check-init.c (check_init): Handle VIEW_CONVERT_EXPR. + * builtins.c (convert_real): New function. + (java_builtins): Handle Float.intBitsToFloat, + Float.floatToRawIntBits, Double.longBitsToDouble, + Double.doubleToRawLongBits. + 2006-02-07 Andrew Haley * expr.c (expand_invoke): (BC mode.) If we find a method in a diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c index 5082cd0..bd7e696 100644 --- a/gcc/java/builtins.c +++ b/gcc/java/builtins.c @@ -39,6 +39,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ static tree max_builtin (tree, tree); static tree min_builtin (tree, tree); static tree abs_builtin (tree, tree); +static tree convert_real (tree, tree); static tree java_build_function_call_expr (tree, tree); @@ -85,6 +86,10 @@ static GTY(()) struct builtin_record java_builtins[] = { { "java.lang.Math" }, { "sin" }, NULL, BUILT_IN_SIN }, { { "java.lang.Math" }, { "sqrt" }, NULL, BUILT_IN_SQRT }, { { "java.lang.Math" }, { "tan" }, NULL, BUILT_IN_TAN }, + { { "java.lang.Float" }, { "intBitsToFloat" }, convert_real, 0 }, + { { "java.lang.Double" }, { "longBitsToDouble" }, convert_real, 0 }, + { { "java.lang.Float" }, { "floatToRawIntBits" }, convert_real, 0 }, + { { "java.lang.Double" }, { "doubleToRawLongBits" }, convert_real, 0 }, { { NULL }, { NULL }, NULL, END_BUILTINS } }; @@ -131,6 +136,13 @@ java_build_function_call_expr (tree fn, tree arglist) call_expr, arglist, NULL_TREE); } +static tree +convert_real (tree method_return_type, tree method_arguments) +{ + return build1 (VIEW_CONVERT_EXPR, method_return_type, + TREE_VALUE (method_arguments)); +} + #define BUILTIN_NOTHROW 1 diff --git a/gcc/java/check-init.c b/gcc/java/check-init.c index 312bd7b..6eb1f16 100644 --- a/gcc/java/check-init.c +++ b/gcc/java/check-init.c @@ -1,5 +1,5 @@ /* Code to test for "definitive [un]assignment". - Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, + Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GCC. @@ -806,6 +806,7 @@ check_init (tree exp, words before) case TRUTH_NOT_EXPR: case BIT_NOT_EXPR: case CONVERT_EXPR: + case VIEW_CONVERT_EXPR: case BIT_FIELD_REF: case FLOAT_EXPR: case FIX_TRUNC_EXPR: -- cgit v1.1