src/share/vm/runtime/sharedRuntimeTrans.cpp

changeset 7000
631c3a4ea10c
parent 6461
bdd155477289
child 7002
a073be2ce5c2
     1.1 --- a/src/share/vm/runtime/sharedRuntimeTrans.cpp	Mon Aug 11 19:19:47 2014 +0400
     1.2 +++ b/src/share/vm/runtime/sharedRuntimeTrans.cpp	Thu May 22 11:36:23 2014 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -43,78 +43,7 @@
    1.11  # pragma optimize ( "", off )
    1.12  #endif
    1.13  
    1.14 -#include <math.h>
    1.15 -
    1.16 -// VM_LITTLE_ENDIAN is #defined appropriately in the Makefiles
    1.17 -// [jk] this is not 100% correct because the float word order may different
    1.18 -// from the byte order (e.g. on ARM)
    1.19 -#ifdef VM_LITTLE_ENDIAN
    1.20 -# define __HI(x) *(1+(int*)&x)
    1.21 -# define __LO(x) *(int*)&x
    1.22 -#else
    1.23 -# define __HI(x) *(int*)&x
    1.24 -# define __LO(x) *(1+(int*)&x)
    1.25 -#endif
    1.26 -
    1.27 -#if !defined(AIX)
    1.28 -double copysign(double x, double y) {
    1.29 -  __HI(x) = (__HI(x)&0x7fffffff)|(__HI(y)&0x80000000);
    1.30 -  return x;
    1.31 -}
    1.32 -#endif
    1.33 -
    1.34 -/*
    1.35 - * ====================================================
    1.36 - * Copyright (c) 1998 Oracle and/or its affiliates. All rights reserved.
    1.37 - *
    1.38 - * Developed at SunSoft, a Sun Microsystems, Inc. business.
    1.39 - * Permission to use, copy, modify, and distribute this
    1.40 - * software is freely granted, provided that this notice
    1.41 - * is preserved.
    1.42 - * ====================================================
    1.43 - */
    1.44 -
    1.45 -/*
    1.46 - * scalbn (double x, int n)
    1.47 - * scalbn(x,n) returns x* 2**n  computed by  exponent
    1.48 - * manipulation rather than by actually performing an
    1.49 - * exponentiation or a multiplication.
    1.50 - */
    1.51 -
    1.52 -static const double
    1.53 -two54   =  1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
    1.54 -  twom54  =  5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */
    1.55 -  hugeX   = 1.0e+300,
    1.56 -  tiny   = 1.0e-300;
    1.57 -
    1.58 -#if !defined(AIX)
    1.59 -double scalbn (double x, int n) {
    1.60 -  int  k,hx,lx;
    1.61 -  hx = __HI(x);
    1.62 -  lx = __LO(x);
    1.63 -  k = (hx&0x7ff00000)>>20;              /* extract exponent */
    1.64 -  if (k==0) {                           /* 0 or subnormal x */
    1.65 -    if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
    1.66 -    x *= two54;
    1.67 -    hx = __HI(x);
    1.68 -    k = ((hx&0x7ff00000)>>20) - 54;
    1.69 -    if (n< -50000) return tiny*x;       /*underflow*/
    1.70 -  }
    1.71 -  if (k==0x7ff) return x+x;             /* NaN or Inf */
    1.72 -  k = k+n;
    1.73 -  if (k >  0x7fe) return hugeX*copysign(hugeX,x); /* overflow  */
    1.74 -  if (k > 0)                            /* normal result */
    1.75 -    {__HI(x) = (hx&0x800fffff)|(k<<20); return x;}
    1.76 -  if (k <= -54) {
    1.77 -    if (n > 50000)      /* in case integer overflow in n+k */
    1.78 -      return hugeX*copysign(hugeX,x);   /*overflow*/
    1.79 -    else return tiny*copysign(tiny,x);  /*underflow*/
    1.80 -  }
    1.81 -  k += 54;                              /* subnormal result */
    1.82 -  __HI(x) = (hx&0x800fffff)|(k<<20);
    1.83 -  return x*twom54;
    1.84 -}
    1.85 -#endif
    1.86 +#include "runtime/sharedRuntimeMath.hpp"
    1.87  
    1.88  /* __ieee754_log(x)
    1.89   * Return the logrithm of x
    1.90 @@ -719,7 +648,7 @@
    1.91    z  = one-(r-z);
    1.92    j  = __HI(z);
    1.93    j += (n<<20);
    1.94 -  if((j>>20)<=0) z = scalbn(z,n);       /* subnormal output */
    1.95 +  if((j>>20)<=0) z = scalbnA(z,n);       /* subnormal output */
    1.96    else __HI(z) += (n<<20);
    1.97    return s*z;
    1.98  }

mercurial