--- old/src/java.base/share/classes/java/lang/Math.java 2015-06-29 11:11:55.334909120 +0200 +++ new/src/java.base/share/classes/java/lang/Math.java 2015-06-29 11:11:55.102909113 +0200 @@ -24,10 +24,11 @@ */ package java.lang; -import java.util.Random; +import java.util.Random; import sun.misc.FloatConsts; import sun.misc.DoubleConsts; +import jdk.internal.HotSpotIntrinsicCandidate; /** * The class {@code Math} contains methods for performing basic @@ -147,6 +148,7 @@ * @param a an angle, in radians. * @return the sine of the argument. */ + @HotSpotIntrinsicCandidate public static double sin(double a) { return StrictMath.sin(a); // default impl. delegates to StrictMath } @@ -162,6 +164,7 @@ * @param a an angle, in radians. * @return the cosine of the argument. */ + @HotSpotIntrinsicCandidate public static double cos(double a) { return StrictMath.cos(a); // default impl. delegates to StrictMath } @@ -179,6 +182,7 @@ * @param a an angle, in radians. * @return the tangent of the argument. */ + @HotSpotIntrinsicCandidate public static double tan(double a) { return StrictMath.tan(a); // default impl. delegates to StrictMath } @@ -280,6 +284,7 @@ * @return the value e{@code a}, * where e is the base of the natural logarithms. */ + @HotSpotIntrinsicCandidate public static double exp(double a) { return StrictMath.exp(a); // default impl. delegates to StrictMath } @@ -301,6 +306,7 @@ * @return the value ln {@code a}, the natural logarithm of * {@code a}. */ + @HotSpotIntrinsicCandidate public static double log(double a) { return StrictMath.log(a); // default impl. delegates to StrictMath } @@ -326,6 +332,7 @@ * @return the base 10 logarithm of {@code a}. * @since 1.5 */ + @HotSpotIntrinsicCandidate public static double log10(double a) { return StrictMath.log10(a); // default impl. delegates to StrictMath } @@ -347,6 +354,7 @@ * @return the positive square root of {@code a}. * If the argument is NaN or less than zero, the result is NaN. */ + @HotSpotIntrinsicCandidate public static double sqrt(double a) { return StrictMath.sqrt(a); // default impl. delegates to StrictMath // Note that hardware sqrt instructions @@ -525,6 +533,7 @@ * in polar coordinates that corresponds to the point * (xy) in Cartesian coordinates. */ + @HotSpotIntrinsicCandidate public static double atan2(double y, double x) { return StrictMath.atan2(y, x); // default impl. delegates to StrictMath } @@ -652,6 +661,7 @@ * @param b the exponent. * @return the value {@code a}{@code b}. */ + @HotSpotIntrinsicCandidate public static double pow(double a, double b) { return StrictMath.pow(a, b); // default impl. delegates to StrictMath } @@ -806,6 +816,7 @@ * @throws ArithmeticException if the result overflows an int * @since 1.8 */ + @HotSpotIntrinsicCandidate public static int addExact(int x, int y) { int r = x + y; // HD 2-12 Overflow iff both arguments have the opposite sign of the result @@ -825,6 +836,7 @@ * @throws ArithmeticException if the result overflows a long * @since 1.8 */ + @HotSpotIntrinsicCandidate public static long addExact(long x, long y) { long r = x + y; // HD 2-12 Overflow iff both arguments have the opposite sign of the result @@ -844,6 +856,7 @@ * @throws ArithmeticException if the result overflows an int * @since 1.8 */ + @HotSpotIntrinsicCandidate public static int subtractExact(int x, int y) { int r = x - y; // HD 2-12 Overflow iff the arguments have different signs and @@ -864,6 +877,7 @@ * @throws ArithmeticException if the result overflows a long * @since 1.8 */ + @HotSpotIntrinsicCandidate public static long subtractExact(long x, long y) { long r = x - y; // HD 2-12 Overflow iff the arguments have different signs and @@ -884,6 +898,7 @@ * @throws ArithmeticException if the result overflows an int * @since 1.8 */ + @HotSpotIntrinsicCandidate public static int multiplyExact(int x, int y) { long r = (long)x * (long)y; if ((int)r != r) { @@ -902,6 +917,7 @@ * @throws ArithmeticException if the result overflows a long * @since 1.8 */ + @HotSpotIntrinsicCandidate public static long multiplyExact(long x, long y) { long r = x * y; long ax = Math.abs(x); @@ -927,6 +943,7 @@ * @throws ArithmeticException if the result overflows an int * @since 1.8 */ + @HotSpotIntrinsicCandidate public static int incrementExact(int a) { if (a == Integer.MAX_VALUE) { throw new ArithmeticException("integer overflow"); @@ -944,6 +961,7 @@ * @throws ArithmeticException if the result overflows a long * @since 1.8 */ + @HotSpotIntrinsicCandidate public static long incrementExact(long a) { if (a == Long.MAX_VALUE) { throw new ArithmeticException("long overflow"); @@ -961,6 +979,7 @@ * @throws ArithmeticException if the result overflows an int * @since 1.8 */ + @HotSpotIntrinsicCandidate public static int decrementExact(int a) { if (a == Integer.MIN_VALUE) { throw new ArithmeticException("integer overflow"); @@ -978,6 +997,7 @@ * @throws ArithmeticException if the result overflows a long * @since 1.8 */ + @HotSpotIntrinsicCandidate public static long decrementExact(long a) { if (a == Long.MIN_VALUE) { throw new ArithmeticException("long overflow"); @@ -995,6 +1015,7 @@ * @throws ArithmeticException if the result overflows an int * @since 1.8 */ + @HotSpotIntrinsicCandidate public static int negateExact(int a) { if (a == Integer.MIN_VALUE) { throw new ArithmeticException("integer overflow"); @@ -1012,6 +1033,7 @@ * @throws ArithmeticException if the result overflows a long * @since 1.8 */ + @HotSpotIntrinsicCandidate public static long negateExact(long a) { if (a == Long.MIN_VALUE) { throw new ArithmeticException("long overflow"); @@ -1256,6 +1278,7 @@ * @param a the argument whose absolute value is to be determined * @return the absolute value of the argument. */ + @HotSpotIntrinsicCandidate public static double abs(double a) { return (a <= 0.0D) ? 0.0D - a : a; } @@ -1270,6 +1293,7 @@ * @param b another argument. * @return the larger of {@code a} and {@code b}. */ + @HotSpotIntrinsicCandidate public static int max(int a, int b) { return (a >= b) ? a : b; } @@ -1354,6 +1378,7 @@ * @param b another argument. * @return the smaller of {@code a} and {@code b}. */ + @HotSpotIntrinsicCandidate public static int min(int a, int b) { return (a <= b) ? a : b; }