Tue, 06 Jan 2009 16:10:11 -0800
Merge
1.1 --- a/src/os/linux/vm/os_linux.cpp Tue Dec 23 19:28:18 2008 -0800 1.2 +++ b/src/os/linux/vm/os_linux.cpp Tue Jan 06 16:10:11 2009 -0800 1.3 @@ -279,7 +279,11 @@ 1.4 * ... 1.5 * 7: The default directories, normally /lib and /usr/lib. 1.6 */ 1.7 +#if defined(AMD64) || defined(_LP64) && (defined(SPARC) || defined(PPC) || defined(S390)) 1.8 +#define DEFAULT_LIBPATH "/usr/lib64:/lib64:/lib:/usr/lib" 1.9 +#else 1.10 #define DEFAULT_LIBPATH "/lib:/usr/lib" 1.11 +#endif 1.12 1.13 #define EXTENSIONS_DIR "/lib/ext" 1.14 #define ENDORSED_DIR "/lib/endorsed"
2.1 --- a/src/share/vm/runtime/sharedRuntime.cpp Tue Dec 23 19:28:18 2008 -0800 2.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp Tue Jan 06 16:10:11 2009 -0800 2.3 @@ -192,64 +192,46 @@ 2.4 2.5 2.6 JRT_LEAF(jint, SharedRuntime::f2i(jfloat x)) 2.7 - if (g_isnan(x)) {return 0;} 2.8 - jlong lltmp = (jlong)x; 2.9 - jint ltmp = (jint)lltmp; 2.10 - if (ltmp == lltmp) { 2.11 - return ltmp; 2.12 - } else { 2.13 - if (x < 0) { 2.14 - return min_jint; 2.15 - } else { 2.16 - return max_jint; 2.17 - } 2.18 - } 2.19 + if (g_isnan(x)) 2.20 + return 0; 2.21 + if (x >= (jfloat) max_jint) 2.22 + return max_jint; 2.23 + if (x <= (jfloat) min_jint) 2.24 + return min_jint; 2.25 + return (jint) x; 2.26 JRT_END 2.27 2.28 2.29 JRT_LEAF(jlong, SharedRuntime::f2l(jfloat x)) 2.30 - if (g_isnan(x)) {return 0;} 2.31 - jlong lltmp = (jlong)x; 2.32 - if (lltmp != min_jlong) { 2.33 - return lltmp; 2.34 - } else { 2.35 - if (x < 0) { 2.36 - return min_jlong; 2.37 - } else { 2.38 - return max_jlong; 2.39 - } 2.40 - } 2.41 + if (g_isnan(x)) 2.42 + return 0; 2.43 + if (x >= (jfloat) max_jlong) 2.44 + return max_jlong; 2.45 + if (x <= (jfloat) min_jlong) 2.46 + return min_jlong; 2.47 + return (jlong) x; 2.48 JRT_END 2.49 2.50 2.51 JRT_LEAF(jint, SharedRuntime::d2i(jdouble x)) 2.52 - if (g_isnan(x)) {return 0;} 2.53 - jlong lltmp = (jlong)x; 2.54 - jint ltmp = (jint)lltmp; 2.55 - if (ltmp == lltmp) { 2.56 - return ltmp; 2.57 - } else { 2.58 - if (x < 0) { 2.59 - return min_jint; 2.60 - } else { 2.61 - return max_jint; 2.62 - } 2.63 - } 2.64 + if (g_isnan(x)) 2.65 + return 0; 2.66 + if (x >= (jdouble) max_jint) 2.67 + return max_jint; 2.68 + if (x <= (jdouble) min_jint) 2.69 + return min_jint; 2.70 + return (jint) x; 2.71 JRT_END 2.72 2.73 2.74 JRT_LEAF(jlong, SharedRuntime::d2l(jdouble x)) 2.75 - if (g_isnan(x)) {return 0;} 2.76 - jlong lltmp = (jlong)x; 2.77 - if (lltmp != min_jlong) { 2.78 - return lltmp; 2.79 - } else { 2.80 - if (x < 0) { 2.81 - return min_jlong; 2.82 - } else { 2.83 - return max_jlong; 2.84 - } 2.85 - } 2.86 + if (g_isnan(x)) 2.87 + return 0; 2.88 + if (x >= (jdouble) max_jlong) 2.89 + return max_jlong; 2.90 + if (x <= (jdouble) min_jlong) 2.91 + return min_jlong; 2.92 + return (jlong) x; 2.93 JRT_END 2.94 2.95
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/compiler/6778657/Test.java Tue Jan 06 16:10:11 2009 -0800 3.3 @@ -0,0 +1,75 @@ 3.4 +/* 3.5 + * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. 3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 + * 3.8 + * This code is free software; you can redistribute it and/or modify it 3.9 + * under the terms of the GNU General Public License version 2 only, as 3.10 + * published by the Free Software Foundation. 3.11 + * 3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.15 + * version 2 for more details (a copy is included in the LICENSE file that 3.16 + * accompanied this code). 3.17 + * 3.18 + * You should have received a copy of the GNU General Public License version 3.19 + * 2 along with this work; if not, write to the Free Software Foundation, 3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.21 + * 3.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 3.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 3.24 + * have any questions. 3.25 + * 3.26 + */ 3.27 + 3.28 +/* 3.29 + * @test 3.30 + * @bug 6778657 3.31 + * @summary Casts in SharedRuntime::f2i, f2l, d2i and d2l rely on undefined C++ behaviour 3.32 + */ 3.33 + 3.34 +public class Test { 3.35 + public static void check_f2i(int expect) { 3.36 + float check = expect; 3.37 + check *= 2; 3.38 + int actual = (int) check; 3.39 + if (actual != expect) 3.40 + throw new RuntimeException("expecting " + expect + ", got " + actual); 3.41 + } 3.42 + 3.43 + public static void check_f2l(long expect) { 3.44 + float check = expect; 3.45 + check *= 2; 3.46 + long actual = (long) check; 3.47 + if (actual != expect) 3.48 + throw new RuntimeException("expecting " + expect + ", got " + actual); 3.49 + } 3.50 + 3.51 + public static void check_d2i(int expect) { 3.52 + double check = expect; 3.53 + check *= 2; 3.54 + int actual = (int) check; 3.55 + if (actual != expect) 3.56 + throw new RuntimeException("expecting " + expect + ", got " + actual); 3.57 + } 3.58 + 3.59 + public static void check_d2l(long expect) { 3.60 + double check = expect; 3.61 + check *= 2; 3.62 + long actual = (long) check; 3.63 + if (actual != expect) 3.64 + throw new RuntimeException("expecting " + expect + ", got " + actual); 3.65 + } 3.66 + 3.67 + public static void main(String[] args) { 3.68 + check_f2i(Integer.MAX_VALUE); 3.69 + check_f2i(Integer.MIN_VALUE); 3.70 + check_f2l(Long.MAX_VALUE); 3.71 + check_f2l(Long.MIN_VALUE); 3.72 + check_d2i(Integer.MAX_VALUE); 3.73 + check_d2i(Integer.MIN_VALUE); 3.74 + check_d2l(Long.MAX_VALUE); 3.75 + check_d2l(Long.MIN_VALUE); 3.76 + } 3.77 +} 3.78 +