Bug 639191: update NSPR to NSPR_4_8_8_BETA2. Include fixes
authorWan-Teh Chang <wtc@google.com>
Sat, 26 Mar 2011 10:42:58 -0700
changeset 63974 e4cea0e92fba1a73a00055097424e6620320f934
parent 63973 fc3fb206ee149299b4cf06179a3a5ddcccc3b3b3
child 63975 497e9a9d5982259264b3f0611793eb18bb706ab3
push idunknown
push userunknown
push dateunknown
bugs639191, 546535, 587426, 622425, 624868, 626035, 504094, 626309, 627299, 629653, 635667
milestone2.2a1pre
Bug 639191: update NSPR to NSPR_4_8_8_BETA2. Include fixes for bug 546535, bug 587426, bug 622425, bug 624868, bug 626035 (attachment 504094 only), bug 626309, bug 627299, bug 629653, bug 635667.
nsprpub/TAG-INFO
nsprpub/admin/repackage.sh
nsprpub/config/prdepend.h
nsprpub/configure
nsprpub/configure.in
nsprpub/lib/ds/plarena.c
nsprpub/pr/include/md/_hpux.h
nsprpub/pr/include/md/_linux.cfg
nsprpub/pr/include/md/_linux.h
nsprpub/pr/include/pratom.h
nsprpub/pr/include/prinit.h
nsprpub/pr/src/md/unix/os_Linux_x86.s
nsprpub/pr/src/md/unix/os_Linux_x86_64.s
nsprpub/pr/src/md/unix/os_SunOS_x86.s
nsprpub/pr/src/md/unix/os_SunOS_x86_64.s
nsprpub/pr/src/md/unix/unix.c
nsprpub/pr/src/misc/dtoa.c
nsprpub/pr/src/misc/prsystem.c
nsprpub/pr/tests/vercheck.c
--- a/nsprpub/TAG-INFO
+++ b/nsprpub/TAG-INFO
@@ -1,1 +1,1 @@
-NSPR_4_8_7_RTM
+NSPR_4_8_8_BETA2
--- a/nsprpub/admin/repackage.sh
+++ b/nsprpub/admin/repackage.sh
@@ -59,20 +59,20 @@
 # Note! Files written with Gnu tar are not readable by some non-Gnu
 # versions. Sun, in particular.
 # 
 # 
 # 
 # 
 # ------------------------------------------------------------------
 
-FROMTOP=/share/builds/components/nspr20/v4.8.7
-TOTOP=./v4.8.7
-NSPRDIR=nspr-4.8.7
-SOURCETAG=NSPR_4_8_7_RTM
+FROMTOP=/share/builds/components/nspr20/v4.8.8
+TOTOP=./v4.8.8
+NSPRDIR=nspr-4.8.8
+SOURCETAG=NSPR_4_8_8_RTM
 
 #
 # enumerate Unix object directories on /s/b/c
 UNIX_OBJDIRS="
 HP-UXB.11.11_64_DBG.OBJ
 HP-UXB.11.11_64_OPT.OBJ
 HP-UXB.11.11_DBG.OBJ
 HP-UXB.11.11_OPT.OBJ
--- a/nsprpub/config/prdepend.h
+++ b/nsprpub/config/prdepend.h
@@ -37,9 +37,8 @@
 
 /*
  * A dummy header file that is a dependency for all the object files.
  * Used to force a full recompilation of NSPR in Mozilla's Tinderbox
  * depend builds.  See comments in rules.mk.
  */
 
 #error "Do not include this header file."
-
--- a/nsprpub/configure
+++ b/nsprpub/configure
@@ -62,17 +62,17 @@ ac_help="$ac_help
   --with-macos-sdk=dir    Location of platform SDK to use (Mac OS X only)"
 ac_help="$ac_help
   --enable-macos-target=VER
                           Set the minimum MacOS version needed at runtime
                           [10.2 for ppc, 10.4 for x86]"
 ac_help="$ac_help
   --disable-os2-high-mem  Disable high-memory support on OS/2"
 ac_help="$ac_help
-  --enable-thumb2              Enable Thumb2 instruction set"
+  --enable-thumb2              Enable Thumb-2 instruction set"
 ac_help="$ac_help
   --with-symbian-sdk=SYMBIAN_SDK_DIR
                           The path to the Symbian SDK"
 ac_help="$ac_help
   --with-ccache[=path/to/ccache]
                           Enable compiling with ccache"
 ac_help="$ac_help
   --enable-strip          Enable stripping of shared libs and programs"
@@ -708,17 +708,17 @@ echo "$ac_t""$build" 1>&6
 test "$host_alias" != "$target_alias" &&
   test "$program_prefix$program_suffix$program_transform_name" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-
 
 
 MOD_MAJOR_VERSION=4
 MOD_MINOR_VERSION=8
-MOD_PATCH_VERSION=7
+MOD_PATCH_VERSION=8
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_64=
 USE_CPLUS=
@@ -3096,33 +3096,33 @@ if test "${enable_thumb2+set}" = set; th
    fi 
 fi
 
 
 if test -n "$MOZ_THUMB2"; then
   case "$target_cpu" in
     arm*)
       if test "$GNU_CC"; then
-        CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
-        CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
+        CFLAGS="$CFLAGS -march=armv7-a -mthumb"
+        CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb"
         ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
       else
         { echo "configure: error: --enable-thumb2 is not supported for non-GNU toolchains" 1>&2; exit 1; }
       fi
     ;;
     *)
       { echo "configure: error: --enable-thumb2 is not supported for non-ARM CPU architectures" 1>&2; exit 1; }
     ;;
   esac
 else
-  case "$target_cpu" in
-    arm*)
+  case "$target" in
+    arm-android-eabi)
       if test "$GNU_CC"; then
-       CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
-        CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
+        CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork"
+        CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork"
         ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork"
       fi
       ;;
   esac
 fi
 
 case "$host" in
 *-mingw*)
--- a/nsprpub/configure.in
+++ b/nsprpub/configure.in
@@ -45,17 +45,17 @@ AC_INIT(config/libc_r.h)
 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
 AC_CANONICAL_SYSTEM
 
 dnl ========================================================
 dnl = Defaults
 dnl ========================================================
 MOD_MAJOR_VERSION=4
 MOD_MINOR_VERSION=8
-MOD_PATCH_VERSION=7
+MOD_PATCH_VERSION=8
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
 USE_USER_PTHREADS=
 USE_NSPR_THREADS=
 USE_N32=
 USE_64=
 USE_CPLUS=
@@ -911,42 +911,42 @@ AC_ARG_ENABLE(os2-high-mem,
       else
         MOZ_OS2_HIGH_MEMORY=1
       fi ])
 
 dnl ========================================================
 dnl = Enable building the Thumb2 instruction set
 dnl ========================================================
 AC_ARG_ENABLE(thumb2,
- [  --enable-thumb2              Enable Thumb2 instruction set],
+ [  --enable-thumb2              Enable Thumb-2 instruction set],
  [ if test "$enableval" = "yes"; then
      MOZ_THUMB2=1,
    fi ])
 
 if test -n "$MOZ_THUMB2"; then
   case "$target_cpu" in
     arm*)
       if test "$GNU_CC"; then
-        CFLAGS="$CFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
-        CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -Wa, -march=armv7-a -Wa, -mthumb"
+        CFLAGS="$CFLAGS -march=armv7-a -mthumb"
+        CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb"
         ASFLAGS="$ASFLAGS -march=armv7-a -mthumb"
       else
         AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
       fi
     ;;
     *)
       AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
     ;;
   esac
 else
-  case "$target_cpu" in
-    arm*)
+  case "$target" in
+    arm-android-eabi)
       if test "$GNU_CC"; then
-       CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
-        CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -Wa, -march=armv5te -Wa, -mthumb-interwork"
+        CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork"
+        CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork"
         ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork"
       fi
       ;;
   esac
 fi
 
 dnl ========================================================
 dnl Override of system specific host options
--- a/nsprpub/lib/ds/plarena.c
+++ b/nsprpub/lib/ds/plarena.c
@@ -309,18 +309,18 @@ static void FreeArenaList(PLArenaPool *p
 
     pool->current = head;
 }
 
 PR_IMPLEMENT(void) PL_ArenaRelease(PLArenaPool *pool, char *mark)
 {
     PLArena *a;
 
-    for (a = pool->first.next; a; a = a->next) {
-        if (PR_UPTRDIFF(mark, a->base) < PR_UPTRDIFF(a->avail, a->base)) {
+    for (a = &pool->first; a; a = a->next) {
+        if (PR_UPTRDIFF(mark, a->base) <= PR_UPTRDIFF(a->avail, a->base)) {
             a->avail = (PRUword)PL_ARENA_ALIGN(pool, mark);
             FreeArenaList(pool, a, PR_FALSE);
             return;
         }
     }
 }
 
 PR_IMPLEMENT(void) PL_FreeArenaPool(PLArenaPool *pool)
--- a/nsprpub/pr/include/md/_hpux.h
+++ b/nsprpub/pr/include/md/_hpux.h
@@ -105,16 +105,40 @@ extern PRInt32 _PR_ia64_AtomicSet(PRInt3
 
 #define _PR_HAVE_GETIPNODEBYNAME
 #define _PR_HAVE_GETIPNODEBYADDR
 #define _PR_HAVE_GETADDRINFO
 #ifdef _PR_INET6
 #define _PR_HAVE_INET_NTOP
 #else
 #define _PR_INET6_PROBE
+
+/* for HP-UX 11.11 without IPv6 */
+#ifndef AF_INET6
+#define AF_INET6       22
+#define AI_CANONNAME   2
+#define AI_NUMERICHOST 4
+#define AI_NUMERICSERV 8
+#define AI_V4MAPPED    0x00000010
+#define AI_ADDRCONFIG  0x00000040
+#define AI_ALL         0x00000020
+#define AI_DEFAULT     (AI_V4MAPPED|AI_ADDRCONFIG)
+#define NI_NUMERICHOST 2
+struct addrinfo {
+    int        ai_flags;    /* AI_PASSIVE, AI_CANONNAME */
+    int        ai_family;   /* PF_xxx */
+    int        ai_socktype; /* SOCK_xxx */
+    int        ai_protocol; /* IPPROTO_xxx for IPv4 and IPv6 */
+    socklen_t  ai_addrlen;  /* length of ai_addr */
+    char            *ai_canonname;    /* canonical name for host */
+    struct sockaddr *ai_addr;     /* binary address */
+    struct addrinfo *ai_next;     /* next structure in linked list */
+};
+#endif    /* for HP-UX 11.11 without IPv6 */
+
 #define _PR_HAVE_MD_SOCKADDR_IN6
 /* isomorphic to struct in6_addr on HP-UX B.11.23 */
 struct _md_in6_addr {
     union {
         PRUint8   _S6_u8[16];
         PRUint16  _S6_u16[8];
         PRUint32  _S6_u32[4];
         PRUint32  __S6_align;
--- a/nsprpub/pr/include/md/_linux.cfg
+++ b/nsprpub/pr/include/md/_linux.cfg
@@ -792,16 +792,61 @@
 #define PR_ALIGN_OF_FLOAT   4
 #define PR_ALIGN_OF_DOUBLE  4
 #define PR_ALIGN_OF_POINTER 4
 #define PR_ALIGN_OF_WORD    4
 
 #define PR_BYTES_PER_WORD_LOG2   2
 #define PR_BYTES_PER_DWORD_LOG2  3
 
+#elif defined(__m32r__)
+
+#undef  IS_LITTLE_ENDIAN
+#define IS_BIG_ENDIAN 1
+
+#define PR_BYTES_PER_BYTE   1
+#define PR_BYTES_PER_SHORT  2
+#define PR_BYTES_PER_INT    4
+#define PR_BYTES_PER_INT64  8
+#define PR_BYTES_PER_LONG   4
+#define PR_BYTES_PER_FLOAT  4
+#define PR_BYTES_PER_DOUBLE 8
+#define PR_BYTES_PER_WORD   4
+#define PR_BYTES_PER_DWORD  8
+
+#define PR_BITS_PER_BYTE    8
+#define PR_BITS_PER_SHORT   16
+#define PR_BITS_PER_INT     32
+#define PR_BITS_PER_INT64   64
+#define PR_BITS_PER_LONG    32
+#define PR_BITS_PER_FLOAT   32
+#define PR_BITS_PER_DOUBLE  64
+#define PR_BITS_PER_WORD    32
+
+#define PR_BITS_PER_BYTE_LOG2   3
+#define PR_BITS_PER_SHORT_LOG2  4
+#define PR_BITS_PER_INT_LOG2    5
+#define PR_BITS_PER_INT64_LOG2  6
+#define PR_BITS_PER_LONG_LOG2   5
+#define PR_BITS_PER_FLOAT_LOG2  5
+#define PR_BITS_PER_DOUBLE_LOG2 6
+#define PR_BITS_PER_WORD_LOG2   5
+
+#define PR_ALIGN_OF_SHORT   2
+#define PR_ALIGN_OF_INT     4
+#define PR_ALIGN_OF_LONG    4
+#define PR_ALIGN_OF_INT64   4
+#define PR_ALIGN_OF_FLOAT   4
+#define PR_ALIGN_OF_DOUBLE  4
+#define PR_ALIGN_OF_POINTER 4
+#define PR_ALIGN_OF_WORD    4
+
+#define PR_BYTES_PER_WORD_LOG2   2
+#define PR_BYTES_PER_DWORD_LOG2  3
+
 #else
 
 #error "Unknown CPU architecture"
 
 #endif
 
 #ifndef HAVE_LONG_LONG
 #define	HAVE_LONG_LONG
--- a/nsprpub/pr/include/md/_linux.h
+++ b/nsprpub/pr/include/md/_linux.h
@@ -78,16 +78,18 @@
 #elif defined(__s390x__)
 #define _PR_SI_ARCHITECTURE "s390x"
 #elif defined(__s390__)
 #define _PR_SI_ARCHITECTURE "s390"
 #elif defined(__sh__)
 #define _PR_SI_ARCHITECTURE "sh"
 #elif defined(__avr32__)
 #define _PR_SI_ARCHITECTURE "avr32"
+#elif defined(__m32r__)
+#define _PR_SI_ARCHITECTURE "m32r"
 #else
 #error "Unknown CPU architecture"
 #endif
 #define PR_DLL_SUFFIX		".so"
 
 #define _PR_VMBASE              0x30000000
 #define _PR_STACK_VMBASE	0x50000000
 #define _MD_DEFAULT_STACK_SIZE	65536L
@@ -211,17 +213,28 @@ extern PRInt32 _PR_ppc_AtomicSet(PRInt32
     : [ret] "=&r" (__atomic_ret),               \
       [tmp] "=&r"(__atomic_tmp),                \
       [val] "=m" (*ptr)                         \
     : [newval] "Ir" (n), "m" (*ptr));           \
     __atomic_ret;                               \
 })
 #endif
 
-#if defined(__arm__) && defined(_PR_ARM_KUSER)
+#if defined(__arm__)
+#if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
+/* Use GCC built-in functions */
+#define _PR_HAVE_ATOMIC_OPS
+#define _MD_INIT_ATOMIC()
+
+#define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1)
+#define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1)
+#define _MD_ATOMIC_SET(ptr, nv) __sync_lock_test_and_set(ptr, nv)
+#define _MD_ATOMIC_ADD(ptr, i) __sync_add_and_fetch(ptr, i)
+
+#elif defined(_PR_ARM_KUSER)
 #define _PR_HAVE_ATOMIC_OPS
 #define _MD_INIT_ATOMIC()
 
 /*
  * The kernel provides this helper function at a fixed address with a fixed
  * ABI signature, directly callable from user space.
  *
  * Definition:
@@ -254,26 +267,28 @@ static inline PRInt32 _MD_ATOMIC_SET(PRI
 
     do {
         ov = *vp;
     } while (__kernel_cmpxchg(ov, nv, vp));
 
     return ov;
 }
 #endif
+#endif /* __arm__ */
 
 #define USE_SETJMP
-#if defined(__GLIBC__) && __GLIBC__ >= 2
+#if (defined(__GLIBC__) && __GLIBC__ >= 2) || defined(ANDROID)
 #define _PR_POLL_AVAILABLE
 #endif
 #undef _PR_USE_POLL
 #define _PR_STAT_HAS_ONLY_ST_ATIME
 #if defined(__alpha) || defined(__ia64__)
 #define _PR_HAVE_LARGE_OFF_T
-#elif (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1)
+#elif (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) \
+    || defined(ANDROID)
 #define _PR_HAVE_OFF64_T
 #else
 #define _PR_NO_LARGE_FILES
 #endif
 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) \
     || defined(ANDROID)
 #define _PR_INET6
 #define _PR_HAVE_INET_NTOP
@@ -454,16 +469,28 @@ extern void _MD_CleanupBeforeExit(void);
 #define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[6] = (val))
 #define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
 #define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[6])
 #define _MD_SP_TYPE __ptr_t
 #else
 #error "SH/Linux pre-glibc2 not supported yet"
 #endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
 
+#elif defined(__m32r__)
+/* Linux/M32R */
+#if defined(__GLIBC__) && __GLIBC__ >= 2
+#define _MD_GET_SP(_t) (_t)->md.context[0].__jmpbuf[0].__regs[JB_SP]
+#define _MD_SET_FP(_t, val) ((_t)->md.context[0].__jmpbuf[0].__regs[JB_FP] = (val))
+#define _MD_GET_SP_PTR(_t) &(_MD_GET_SP(_t))
+#define _MD_GET_FP_PTR(_t) (&(_t)->md.context[0].__jmpbuf[0].__regs[JB_FP])
+#define _MD_SP_TYPE __ptr_t
+#else
+#error "Linux/M32R pre-glibc2 not supported yet"
+#endif /* defined(__GLIBC__) && __GLIBC__ >= 2 */
+
 #else
 
 #error "Unknown CPU architecture"
 
 #endif /*__powerpc__*/
 
 /*
 ** Initialize a thread context to run "_main()" when started
--- a/nsprpub/pr/include/pratom.h
+++ b/nsprpub/pr/include/pratom.h
@@ -135,16 +135,18 @@ long __cdecl _InterlockedExchangeAdd(lon
 #elif ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && \
       ((defined(DARWIN) && \
            (defined(__ppc__) || defined(__i386__) || defined(__x86_64__))) || \
        (defined(LINUX) && \
            ((defined(__i386__) && \
            defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) || \
            defined(__ia64__) || defined(__x86_64__) || \
            (defined(__powerpc__) && !defined(__powerpc64__)) || \
+           (defined(__arm__) && \
+           defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)) || \
            defined(__alpha))))
 
 /*
  * Because the GCC manual warns that some processors may support
  * reduced functionality of __sync_lock_test_and_set, we test for the
  * processors that we believe support a full atomic exchange operation.
  */
 
--- a/nsprpub/pr/include/prinit.h
+++ b/nsprpub/pr/include/prinit.h
@@ -58,21 +58,21 @@ PR_BEGIN_EXTERN_C
 /*
 ** NSPR's version is used to determine the likelihood that the version you
 ** used to build your component is anywhere close to being compatible with
 ** what is in the underlying library.
 **
 ** The format of the version string is
 **     "<major version>.<minor version>[.<patch level>] [<Beta>]"
 */
-#define PR_VERSION  "4.8.7"
+#define PR_VERSION  "4.8.8 Beta"
 #define PR_VMAJOR   4
 #define PR_VMINOR   8
-#define PR_VPATCH   7
-#define PR_BETA     PR_FALSE
+#define PR_VPATCH   8
+#define PR_BETA     PR_TRUE
 
 /*
 ** PRVersionCheck
 **
 ** The basic signature of the function that is called to provide version
 ** checking. The result will be a boolean that indicates the likelihood
 ** that the underling library will perform as the caller expects.
 **
--- a/nsprpub/pr/src/md/unix/os_Linux_x86.s
+++ b/nsprpub/pr/src/md/unix/os_Linux_x86.s
@@ -1,117 +1,117 @@
-/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-/ 
-/ ***** BEGIN LICENSE BLOCK *****
-/ Version: MPL 1.1/GPL 2.0/LGPL 2.1
-/
-/ The contents of this file are subject to the Mozilla Public License Version
-/ 1.1 (the "License"); you may not use this file except in compliance with
-/ the License. You may obtain a copy of the License at
-/ http://www.mozilla.org/MPL/
-/
-/ Software distributed under the License is distributed on an "AS IS" basis,
-/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-/ for the specific language governing rights and limitations under the
-/ License.
-/
-/ The Original Code is the Netscape Portable Runtime (NSPR).
-/
-/ The Initial Developer of the Original Code is
-/ Netscape Communications Corporation.
-/ Portions created by the Initial Developer are Copyright (C) 2000
-/ the Initial Developer. All Rights Reserved.
-/
-/ Contributor(s):
-/
-/ Alternatively, the contents of this file may be used under the terms of
-/ either the GNU General Public License Version 2 or later (the "GPL"), or
-/ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-/ in which case the provisions of the GPL or the LGPL are applicable instead
-/ of those above. If you wish to allow use of your version of this file only
-/ under the terms of either the GPL or the LGPL, and not to allow others to
-/ use your version of this file under the terms of the MPL, indicate your
-/ decision by deleting the provisions above and replace them with the notice
-/ and other provisions required by the GPL or the LGPL. If you do not delete
-/ the provisions above, a recipient may use your version of this file under
-/ the terms of any one of the MPL, the GPL or the LGPL.
-/
-/ ***** END LICENSE BLOCK *****
+// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+// 
+// ***** BEGIN LICENSE BLOCK *****
+// Version: MPL 1.1/GPL 2.0/LGPL 2.1
+//
+// The contents of this file are subject to the Mozilla Public License Version
+// 1.1 (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS" basis,
+// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+// for the specific language governing rights and limitations under the
+// License.
+//
+// The Original Code is the Netscape Portable Runtime (NSPR).
+//
+// The Initial Developer of the Original Code is
+// Netscape Communications Corporation.
+// Portions created by the Initial Developer are Copyright (C) 2000
+// the Initial Developer. All Rights Reserved.
+//
+// Contributor(s):
+//
+// Alternatively, the contents of this file may be used under the terms of
+// either the GNU General Public License Version 2 or later (the "GPL"), or
+// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+// in which case the provisions of the GPL or the LGPL are applicable instead
+// of those above. If you wish to allow use of your version of this file only
+// under the terms of either the GPL or the LGPL, and not to allow others to
+// use your version of this file under the terms of the MPL, indicate your
+// decision by deleting the provisions above and replace them with the notice
+// and other provisions required by the GPL or the LGPL. If you do not delete
+// the provisions above, a recipient may use your version of this file under
+// the terms of any one of the MPL, the GPL or the LGPL.
+//
+// ***** END LICENSE BLOCK *****
 
-/ PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val)
-/
-/ Atomically increment the integer pointed to by 'val' and return
-/ the result of the increment.
-/
+// PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val)
+//
+// Atomically increment the integer pointed to by 'val' and return
+// the result of the increment.
+//
     .text
     .globl _PR_x86_AtomicIncrement
     .align 4
 _PR_x86_AtomicIncrement:
     movl 4(%esp), %ecx
     movl $1, %eax
     lock
     xaddl %eax, (%ecx)
     incl %eax
     ret
 
-/ PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val)
-/
-/ Atomically decrement the integer pointed to by 'val' and return
-/ the result of the decrement.
-/
+// PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val)
+//
+// Atomically decrement the integer pointed to by 'val' and return
+// the result of the decrement.
+//
     .text
     .globl _PR_x86_AtomicDecrement
     .align 4
 _PR_x86_AtomicDecrement:
     movl 4(%esp), %ecx
     movl $-1, %eax
     lock
     xaddl %eax, (%ecx)
     decl %eax
     ret
 
-/ PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval)
-/
-/ Atomically set the integer pointed to by 'val' to the new
-/ value 'newval' and return the old value.
-/
-/ An alternative implementation:
-/   .text
-/   .globl _PR_x86_AtomicSet
-/   .align 4
-/_PR_x86_AtomicSet:
-/   movl 4(%esp), %ecx
-/   movl 8(%esp), %edx
-/   movl (%ecx), %eax
-/retry:
-/   lock
-/   cmpxchgl %edx, (%ecx)
-/   jne retry
-/   ret
-/
+// PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval)
+//
+// Atomically set the integer pointed to by 'val' to the new
+// value 'newval' and return the old value.
+//
+// An alternative implementation:
+//   .text
+//   .globl _PR_x86_AtomicSet
+//   .align 4
+//_PR_x86_AtomicSet:
+//   movl 4(%esp), %ecx
+//   movl 8(%esp), %edx
+//   movl (%ecx), %eax
+//retry:
+//   lock
+//   cmpxchgl %edx, (%ecx)
+//   jne retry
+//   ret
+//
     .text
     .globl _PR_x86_AtomicSet
     .align 4
 _PR_x86_AtomicSet:
     movl 4(%esp), %ecx
     movl 8(%esp), %eax
     xchgl %eax, (%ecx)
     ret
 
-/ PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val)
-/
-/ Atomically add 'val' to the integer pointed to by 'ptr'
-/ and return the result of the addition.
-/
+// PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val)
+//
+// Atomically add 'val' to the integer pointed to by 'ptr'
+// and return the result of the addition.
+//
     .text
     .globl _PR_x86_AtomicAdd
     .align 4
 _PR_x86_AtomicAdd:
     movl 4(%esp), %ecx
     movl 8(%esp), %eax
     movl %eax, %edx
     lock
     xaddl %eax, (%ecx)
     addl %edx, %eax
     ret
 
-/ Magic indicating no need for an executable stack
+// Magic indicating no need for an executable stack
 .section .note.GNU-stack, "", @progbits ; .previous
--- a/nsprpub/pr/src/md/unix/os_Linux_x86_64.s
+++ b/nsprpub/pr/src/md/unix/os_Linux_x86_64.s
@@ -1,106 +1,106 @@
-/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-/ 
-/ ***** BEGIN LICENSE BLOCK *****
-/ Version: MPL 1.1/GPL 2.0/LGPL 2.1
-/
-/ The contents of this file are subject to the Mozilla Public License Version
-/ 1.1 (the "License"); you may not use this file except in compliance with
-/ the License. You may obtain a copy of the License at
-/ http://www.mozilla.org/MPL/
-/
-/ Software distributed under the License is distributed on an "AS IS" basis,
-/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-/ for the specific language governing rights and limitations under the
-/ License.
-/
-/ The Original Code is the Netscape Portable Runtime (NSPR).
-/
-/ The Initial Developer of the Original Code is
-/ Netscape Communications Corporation.
-/ Portions created by the Initial Developer are Copyright (C) 2004
-/ the Initial Developer. All Rights Reserved.
-/
-/ Contributor(s):
-/
-/ Alternatively, the contents of this file may be used under the terms of
-/ either the GNU General Public License Version 2 or later (the "GPL"), or
-/ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-/ in which case the provisions of the GPL or the LGPL are applicable instead
-/ of those above. If you wish to allow use of your version of this file only
-/ under the terms of either the GPL or the LGPL, and not to allow others to
-/ use your version of this file under the terms of the MPL, indicate your
-/ decision by deleting the provisions above and replace them with the notice
-/ and other provisions required by the GPL or the LGPL. If you do not delete
-/ the provisions above, a recipient may use your version of this file under
-/ the terms of any one of the MPL, the GPL or the LGPL.
-/
-/ ***** END LICENSE BLOCK *****
+// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+// 
+// ***** BEGIN LICENSE BLOCK *****
+// Version: MPL 1.1/GPL 2.0/LGPL 2.1
+//
+// The contents of this file are subject to the Mozilla Public License Version
+// 1.1 (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS" basis,
+// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+// for the specific language governing rights and limitations under the
+// License.
+//
+// The Original Code is the Netscape Portable Runtime (NSPR).
+//
+// The Initial Developer of the Original Code is
+// Netscape Communications Corporation.
+// Portions created by the Initial Developer are Copyright (C) 2004
+// the Initial Developer. All Rights Reserved.
+//
+// Contributor(s):
+//
+// Alternatively, the contents of this file may be used under the terms of
+// either the GNU General Public License Version 2 or later (the "GPL"), or
+// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+// in which case the provisions of the GPL or the LGPL are applicable instead
+// of those above. If you wish to allow use of your version of this file only
+// under the terms of either the GPL or the LGPL, and not to allow others to
+// use your version of this file under the terms of the MPL, indicate your
+// decision by deleting the provisions above and replace them with the notice
+// and other provisions required by the GPL or the LGPL. If you do not delete
+// the provisions above, a recipient may use your version of this file under
+// the terms of any one of the MPL, the GPL or the LGPL.
+//
+// ***** END LICENSE BLOCK *****
 
-/ PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val)
-/
-/ Atomically increment the integer pointed to by 'val' and return
-/ the result of the increment.
-/
+// PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val)
+//
+// Atomically increment the integer pointed to by 'val' and return
+// the result of the increment.
+//
     .text
     .globl _PR_x86_64_AtomicIncrement
     .type _PR_x86_64_AtomicIncrement, @function
     .align 4
 _PR_x86_64_AtomicIncrement:
     movl $1, %eax
     lock
     xaddl %eax, (%rdi)
     incl %eax
     ret
     .size _PR_x86_64_AtomicIncrement, .-_PR_x86_64_AtomicIncrement
 
-/ PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val)
-/
-/ Atomically decrement the integer pointed to by 'val' and return
-/ the result of the decrement.
-/
+// PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val)
+//
+// Atomically decrement the integer pointed to by 'val' and return
+// the result of the decrement.
+//
     .text
     .globl _PR_x86_64_AtomicDecrement
     .type _PR_x86_64_AtomicDecrement, @function
     .align 4
 _PR_x86_64_AtomicDecrement:
     movl $-1, %eax
     lock
     xaddl %eax, (%rdi)
     decl %eax
     ret
     .size _PR_x86_64_AtomicDecrement, .-_PR_x86_64_AtomicDecrement
 
-/ PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval)
-/
-/ Atomically set the integer pointed to by 'val' to the new
-/ value 'newval' and return the old value.
-/
+// PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval)
+//
+// Atomically set the integer pointed to by 'val' to the new
+// value 'newval' and return the old value.
+//
     .text
     .globl _PR_x86_64_AtomicSet
     .type _PR_x86_64_AtomicSet, @function
     .align 4
 _PR_x86_64_AtomicSet:
     movl %esi, %eax
     xchgl %eax, (%rdi)
     ret
     .size _PR_x86_64_AtomicSet, .-_PR_x86_64_AtomicSet
 
-/ PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val)
-/
-/ Atomically add 'val' to the integer pointed to by 'ptr'
-/ and return the result of the addition.
-/
+// PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val)
+//
+// Atomically add 'val' to the integer pointed to by 'ptr'
+// and return the result of the addition.
+//
     .text
     .globl _PR_x86_64_AtomicAdd
     .type _PR_x86_64_AtomicAdd, @function
     .align 4
 _PR_x86_64_AtomicAdd:
     movl %esi, %eax
     lock
     xaddl %eax, (%rdi)
     addl %esi, %eax
     ret
     .size _PR_x86_64_AtomicAdd, .-_PR_x86_64_AtomicAdd
 
-/ Magic indicating no need for an executable stack
+// Magic indicating no need for an executable stack
 .section .note.GNU-stack, "", @progbits ; .previous
--- a/nsprpub/pr/src/md/unix/os_SunOS_x86.s
+++ b/nsprpub/pr/src/md/unix/os_SunOS_x86.s
@@ -1,45 +1,45 @@
-/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-/ 
-/ ***** BEGIN LICENSE BLOCK *****
-/ Version: MPL 1.1/GPL 2.0/LGPL 2.1
-/
-/ The contents of this file are subject to the Mozilla Public License Version
-/ 1.1 (the "License"); you may not use this file except in compliance with
-/ the License. You may obtain a copy of the License at
-/ http://www.mozilla.org/MPL/
-/
-/ Software distributed under the License is distributed on an "AS IS" basis,
-/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-/ for the specific language governing rights and limitations under the
-/ License.
-/
-/ The Original Code is the Netscape Portable Runtime (NSPR).
-/
-/ The Initial Developer of the Original Code is
-/ Netscape Communications Corporation.
-/ Portions created by the Initial Developer are Copyright (C) 1998-2000
-/ the Initial Developer. All Rights Reserved.
-/
-/ Contributor(s):
-/
-/ Alternatively, the contents of this file may be used under the terms of
-/ either the GNU General Public License Version 2 or later (the "GPL"), or
-/ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-/ in which case the provisions of the GPL or the LGPL are applicable instead
-/ of those above. If you wish to allow use of your version of this file only
-/ under the terms of either the GPL or the LGPL, and not to allow others to
-/ use your version of this file under the terms of the MPL, indicate your
-/ decision by deleting the provisions above and replace them with the notice
-/ and other provisions required by the GPL or the LGPL. If you do not delete
-/ the provisions above, a recipient may use your version of this file under
-/ the terms of any one of the MPL, the GPL or the LGPL.
-/
-/ ***** END LICENSE BLOCK *****
+// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+// 
+// ***** BEGIN LICENSE BLOCK *****
+// Version: MPL 1.1/GPL 2.0/LGPL 2.1
+//
+// The contents of this file are subject to the Mozilla Public License Version
+// 1.1 (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS" basis,
+// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+// for the specific language governing rights and limitations under the
+// License.
+//
+// The Original Code is the Netscape Portable Runtime (NSPR).
+//
+// The Initial Developer of the Original Code is
+// Netscape Communications Corporation.
+// Portions created by the Initial Developer are Copyright (C) 1998-2000
+// the Initial Developer. All Rights Reserved.
+//
+// Contributor(s):
+//
+// Alternatively, the contents of this file may be used under the terms of
+// either the GNU General Public License Version 2 or later (the "GPL"), or
+// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+// in which case the provisions of the GPL or the LGPL are applicable instead
+// of those above. If you wish to allow use of your version of this file only
+// under the terms of either the GPL or the LGPL, and not to allow others to
+// use your version of this file under the terms of the MPL, indicate your
+// decision by deleting the provisions above and replace them with the notice
+// and other provisions required by the GPL or the LGPL. If you do not delete
+// the provisions above, a recipient may use your version of this file under
+// the terms of any one of the MPL, the GPL or the LGPL.
+//
+// ***** END LICENSE BLOCK *****
 
 	.text
 
 	.globl	getedi
 getedi:
 	movl	%edi,%eax
 	ret
 	.type	getedi,@function
@@ -55,101 +55,101 @@ setedi:
 	.globl	__MD_FlushRegisterWindows
 	.globl _MD_FlushRegisterWindows
 
 __MD_FlushRegisterWindows:
 _MD_FlushRegisterWindows:
 
 	ret
 
-/
-/ sol_getsp()
-/
-/ Return the current sp (for debugging)
-/
+//
+// sol_getsp()
+//
+// Return the current sp (for debugging)
+//
 	.globl sol_getsp
 sol_getsp:
 	movl	%esp, %eax
 	ret
 
-/
-/ sol_curthread()
-/
-/ Return a unique identifier for the currently active thread.
-/
+//
+// sol_curthread()
+//
+// Return a unique identifier for the currently active thread.
+//
 	.globl sol_curthread
 sol_curthread:
 	movl	%ecx, %eax
 	ret
 
-/ PRInt32 _MD_AtomicIncrement(PRInt32 *val)
-/
-/ Atomically increment the integer pointed to by 'val' and return
-/ the result of the increment.
-/
+// PRInt32 _MD_AtomicIncrement(PRInt32 *val)
+//
+// Atomically increment the integer pointed to by 'val' and return
+// the result of the increment.
+//
     .text
     .globl _MD_AtomicIncrement
     .align 4
 _MD_AtomicIncrement:
     movl 4(%esp), %ecx
     movl $1, %eax
     lock
     xaddl %eax, (%ecx)
     incl %eax
     ret
 
-/ PRInt32 _MD_AtomicDecrement(PRInt32 *val)
-/
-/ Atomically decrement the integer pointed to by 'val' and return
-/ the result of the decrement.
-/
+// PRInt32 _MD_AtomicDecrement(PRInt32 *val)
+//
+// Atomically decrement the integer pointed to by 'val' and return
+// the result of the decrement.
+//
     .text
     .globl _MD_AtomicDecrement
     .align 4
 _MD_AtomicDecrement:
     movl 4(%esp), %ecx
     movl $-1, %eax
     lock
     xaddl %eax, (%ecx)
     decl %eax
     ret
 
-/ PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval)
-/
-/ Atomically set the integer pointed to by 'val' to the new
-/ value 'newval' and return the old value.
-/
-/ An alternative implementation:
-/   .text
-/   .globl _MD_AtomicSet
-/   .align 4
-/_MD_AtomicSet:
-/   movl 4(%esp), %ecx
-/   movl 8(%esp), %edx
-/   movl (%ecx), %eax
-/retry:
-/   lock
-/   cmpxchgl %edx, (%ecx)
-/   jne retry
-/   ret
-/
+// PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval)
+//
+// Atomically set the integer pointed to by 'val' to the new
+// value 'newval' and return the old value.
+//
+// An alternative implementation:
+//   .text
+//   .globl _MD_AtomicSet
+//   .align 4
+//_MD_AtomicSet:
+//   movl 4(%esp), %ecx
+//   movl 8(%esp), %edx
+//   movl (%ecx), %eax
+//retry:
+//   lock
+//   cmpxchgl %edx, (%ecx)
+//   jne retry
+//   ret
+//
     .text
     .globl _MD_AtomicSet
     .align 4
 _MD_AtomicSet:
     movl 4(%esp), %ecx
     movl 8(%esp), %eax
     xchgl %eax, (%ecx)
     ret
 
-/ PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val)
-/
-/ Atomically add 'val' to the integer pointed to by 'ptr'
-/ and return the result of the addition.
-/
+// PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val)
+//
+// Atomically add 'val' to the integer pointed to by 'ptr'
+// and return the result of the addition.
+//
     .text
     .globl _MD_AtomicAdd
     .align 4
 _MD_AtomicAdd:
     movl 4(%esp), %ecx
     movl 8(%esp), %eax
     movl %eax, %edx
     lock
--- a/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s
+++ b/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s
@@ -1,94 +1,94 @@
-/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
-/ 
-/ ***** BEGIN LICENSE BLOCK *****
-/ Version: MPL 1.1/GPL 2.0/LGPL 2.1
-/
-/ The contents of this file are subject to the Mozilla Public License Version
-/ 1.1 (the "License"); you may not use this file except in compliance with
-/ the License. You may obtain a copy of the License at
-/ http://www.mozilla.org/MPL/
-/
-/ Software distributed under the License is distributed on an "AS IS" basis,
-/ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-/ for the specific language governing rights and limitations under the
-/ License.
-/
-/ The Original Code is the Netscape Portable Runtime (NSPR).
-/
-/ The Initial Developer of the Original Code is
-/ Netscape Communications Corporation.
-/ Portions created by the Initial Developer are Copyright (C) 2004
-/ the Initial Developer. All Rights Reserved.
-/
-/ Contributor(s):
-/
-/ Alternatively, the contents of this file may be used under the terms of
-/ either the GNU General Public License Version 2 or later (the "GPL"), or
-/ the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-/ in which case the provisions of the GPL or the LGPL are applicable instead
-/ of those above. If you wish to allow use of your version of this file only
-/ under the terms of either the GPL or the LGPL, and not to allow others to
-/ use your version of this file under the terms of the MPL, indicate your
-/ decision by deleting the provisions above and replace them with the notice
-/ and other provisions required by the GPL or the LGPL. If you do not delete
-/ the provisions above, a recipient may use your version of this file under
-/ the terms of any one of the MPL, the GPL or the LGPL.
-/
-/ ***** END LICENSE BLOCK *****
+// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+// 
+// ***** BEGIN LICENSE BLOCK *****
+// Version: MPL 1.1/GPL 2.0/LGPL 2.1
+//
+// The contents of this file are subject to the Mozilla Public License Version
+// 1.1 (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+// http://www.mozilla.org/MPL/
+//
+// Software distributed under the License is distributed on an "AS IS" basis,
+// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+// for the specific language governing rights and limitations under the
+// License.
+//
+// The Original Code is the Netscape Portable Runtime (NSPR).
+//
+// The Initial Developer of the Original Code is
+// Netscape Communications Corporation.
+// Portions created by the Initial Developer are Copyright (C) 2004
+// the Initial Developer. All Rights Reserved.
+//
+// Contributor(s):
+//
+// Alternatively, the contents of this file may be used under the terms of
+// either the GNU General Public License Version 2 or later (the "GPL"), or
+// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+// in which case the provisions of the GPL or the LGPL are applicable instead
+// of those above. If you wish to allow use of your version of this file only
+// under the terms of either the GPL or the LGPL, and not to allow others to
+// use your version of this file under the terms of the MPL, indicate your
+// decision by deleting the provisions above and replace them with the notice
+// and other provisions required by the GPL or the LGPL. If you do not delete
+// the provisions above, a recipient may use your version of this file under
+// the terms of any one of the MPL, the GPL or the LGPL.
+//
+// ***** END LICENSE BLOCK *****
 
-/ PRInt32 _MD_AtomicIncrement(PRInt32 *val)
-/
-/ Atomically increment the integer pointed to by 'val' and return
-/ the result of the increment.
-/
+// PRInt32 _MD_AtomicIncrement(PRInt32 *val)
+//
+// Atomically increment the integer pointed to by 'val' and return
+// the result of the increment.
+//
     .text
     .globl _MD_AtomicIncrement
     .align 4
 _MD_AtomicIncrement:
     movl $1, %eax
     lock
     xaddl %eax, (%rdi)
     incl %eax
     ret
 
-/ PRInt32 _MD_AtomicDecrement(PRInt32 *val)
-/
-/ Atomically decrement the integer pointed to by 'val' and return
-/ the result of the decrement.
-/
+// PRInt32 _MD_AtomicDecrement(PRInt32 *val)
+//
+// Atomically decrement the integer pointed to by 'val' and return
+// the result of the decrement.
+//
     .text
     .globl _MD_AtomicDecrement
     .align 4
 _MD_AtomicDecrement:
     movl $-1, %eax
     lock
     xaddl %eax, (%rdi)
     decl %eax
     ret
 
-/ PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval)
-/
-/ Atomically set the integer pointed to by 'val' to the new
-/ value 'newval' and return the old value.
-/
+// PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval)
+//
+// Atomically set the integer pointed to by 'val' to the new
+// value 'newval' and return the old value.
+//
     .text
     .globl _MD_AtomicSet
     .align 4
 _MD_AtomicSet:
     movl %esi, %eax
     xchgl %eax, (%rdi)
     ret
 
-/ PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val)
-/
-/ Atomically add 'val' to the integer pointed to by 'ptr'
-/ and return the result of the addition.
-/
+// PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val)
+//
+// Atomically add 'val' to the integer pointed to by 'ptr'
+// and return the result of the addition.
+//
     .text
     .globl _MD_AtomicAdd
     .align 4
 _MD_AtomicAdd:
     movl %esi, %eax
     lock
     xaddl %eax, (%rdi)
     addl %esi, %eax
--- a/nsprpub/pr/src/md/unix/unix.c
+++ b/nsprpub/pr/src/md/unix/unix.c
@@ -2251,16 +2251,20 @@ PRInt32 _MD_open(const char *name, PRInt
     */
     if (flags & PR_CREATE_FILE)
     {
         osflags |= O_CREAT;
         if (NULL !=_pr_rename_lock)
             PR_Lock(_pr_rename_lock);
     }
 
+#if defined(ANDROID)
+    osflags |= O_LARGEFILE;
+#endif
+
     rv = _md_iovector._open64(name, osflags, mode);
 
     if (rv < 0) {
         err = _MD_ERRNO();
         _PR_MD_MAP_OPEN_ERROR(err);
     }
 
     if ((flags & PR_CREATE_FILE) && (NULL !=_pr_rename_lock))
@@ -2737,16 +2741,33 @@ static void* _MD_Unix_mmap64(
     void *addr, PRSize len, PRIntn prot, PRIntn flags,
     PRIntn fildes, PRInt64 offset)
 {
     PR_SetError(PR_FILE_TOO_BIG_ERROR, 0);
     return NULL;
 }  /* _MD_Unix_mmap64 */
 #endif /* defined(_PR_NO_LARGE_FILES) || defined(SOLARIS2_5) */
 
+/* Android doesn't have mmap64. */
+#if defined(ANDROID)
+extern void *__mmap2(void *, size_t, int, int, int, size_t);
+
+#define ANDROID_PAGE_SIZE 4096
+
+static void *
+mmap64(void *addr, size_t len, int prot, int flags, int fd, loff_t offset)
+{
+    if (offset & (ANDROID_PAGE_SIZE - 1)) {
+        errno = EINVAL;
+        return MAP_FAILED;
+    }
+    return __mmap2(addr, len, prot, flags, fd, offset / ANDROID_PAGE_SIZE);
+}
+#endif
+
 #if defined(OSF1) && defined(__GNUC__)
 
 /*
  * On OSF1 V5.0A, <sys/stat.h> defines stat and fstat as
  * macros when compiled under gcc, so it is rather tricky to
  * take the addresses of the real functions the macros expend
  * to.  A simple solution is to define forwarder functions
  * and take the addresses of the forwarder functions instead.
@@ -2791,17 +2812,21 @@ static void _PR_InitIOV(void)
     }
 #elif defined(_PR_NO_LARGE_FILES)
     _md_iovector._open64 = open;
     _md_iovector._mmap64 = _MD_Unix_mmap64;
     _md_iovector._fstat64 = fstat;
     _md_iovector._stat64 = stat;
     _md_iovector._lseek64 = _MD_Unix_lseek64;
 #elif defined(_PR_HAVE_OFF64_T)
-#if defined(IRIX5_3)
+#if defined(IRIX5_3) || defined(ANDROID)
+    /*
+     * Android doesn't have open64.  We pass the O_LARGEFILE flag to open
+     * in _MD_open.
+     */
     _md_iovector._open64 = open;
 #else
     _md_iovector._open64 = open64;
 #endif
     _md_iovector._mmap64 = mmap64;
     _md_iovector._fstat64 = fstat64;
     _md_iovector._stat64 = stat64;
     _md_iovector._lseek64 = lseek64;
--- a/nsprpub/pr/src/misc/dtoa.c
+++ b/nsprpub/pr/src/misc/dtoa.c
@@ -65,31 +65,37 @@
  * #define IEEE_8087 for IEEE-arithmetic machines where the least
  *	significant byte has the lowest address.
  * #define IEEE_MC68k for IEEE-arithmetic machines where the most
  *	significant byte has the lowest address.
  * #define Long int on machines with 32-bit ints and 64-bit longs.
  * #define IBM for IBM mainframe-style floating-point arithmetic.
  * #define VAX for VAX-style floating-point arithmetic (D_floating).
  * #define No_leftright to omit left-right logic in fast floating-point
- *	computation of dtoa.
+ *	computation of dtoa.  This will cause dtoa modes 4 and 5 to be
+ *	treated the same as modes 2 and 3 for some inputs.
  * #define Honor_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3
  *	and strtod and dtoa should round accordingly.  Unless Trust_FLT_ROUNDS
  *	is also #defined, fegetround() will be queried for the rounding mode.
  *	Note that both FLT_ROUNDS and fegetround() are specified by the C99
  *	standard (and are specified to be consistent, with fesetround()
  *	affecting the value of FLT_ROUNDS), but that some (Linux) systems
  *	do not work correctly in this regard, so using fegetround() is more
  *	portable than using FLT_FOUNDS directly.
  * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3
  *	and Honor_FLT_ROUNDS is not #defined.
  * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines
  *	that use extended-precision instructions to compute rounded
  *	products and quotients) with IBM.
- * #define ROUND_BIASED for IEEE-format with biased rounding.
+ * #define ROUND_BIASED for IEEE-format with biased rounding and arithmetic
+ *	that rounds toward +Infinity.
+ * #define ROUND_BIASED_without_Round_Up for IEEE-format with biased
+ *	rounding when the underlying floating-point arithmetic uses
+ *	unbiased rounding.  This prevent using ordinary floating-point
+ *	arithmetic when the result could be computed with one rounding error.
  * #define Inaccurate_Divide for IEEE-format with correctly rounded
  *	products but inaccurate quotients, e.g., for Intel i860.
  * #define NO_LONG_LONG on machines that do not have a "long long"
  *	integer type (of >= 64 bits).  On such machines, you can
  *	#define Just_16 to store 16 bits per 32-bit Long when doing
  *	high-precision integer arithmetic.  Whether this speeds things
  *	up or slows things down depends on the machine and the number
  *	being converted.  If long long is available and the name is
@@ -448,16 +454,21 @@ extern int strtod_diglim;
 #define Tiny1 0
 #define Quick_max 15
 #define Int_max 15
 #endif /* IBM, VAX */
 #endif /* IEEE_Arith */
 
 #ifndef IEEE_Arith
 #define ROUND_BIASED
+#else
+#ifdef ROUND_BIASED_without_Round_Up
+#undef  ROUND_BIASED
+#define ROUND_BIASED
+#endif
 #endif
 
 #ifdef RND_PRODQUOT
 #define rounded_product(a,b) a = rnd_prod(a, b)
 #define rounded_quotient(a,b) a = rnd_quot(a, b)
 #ifdef KR_headers
 extern double rnd_prod(), rnd_quot();
 #else
@@ -2571,16 +2582,18 @@ strtod
 	if (c == '.') {
 		c = *++s;
 		bc.dp1 = s - s0;
 		bc.dplen = bc.dp1 - bc.dp0;
 		if (!nd) {
 			for(; c == '0'; c = *++s)
 				nz++;
 			if (c > '0' && c <= '9') {
+				bc.dp0 = s0 - s;
+				bc.dp1 = bc.dp0 + bc.dplen;
 				s0 = s;
 				nf += nz;
 				nz = 0;
 				goto have_dig;
 				}
 			goto dig_done;
 			}
 		for(; c >= '0' && c <= '9'; c = *++s) {
@@ -2698,16 +2711,17 @@ strtod
 #ifndef RND_PRODQUOT
 #ifndef Honor_FLT_ROUNDS
 		&& Flt_Rounds == 1
 #endif
 #endif
 			) {
 		if (!e)
 			goto ret;
+#ifndef ROUND_BIASED_without_Round_Up
 		if (e > 0) {
 			if (e <= Ten_pmax) {
 #ifdef VAX
 				goto vax_ovfl_check;
 #else
 #ifdef Honor_FLT_ROUNDS
 				/* round correctly FLT_ROUNDS = 2 or 3 */
 				if (sign) {
@@ -2758,16 +2772,17 @@ strtod
 				rv.d = -rv.d;
 				sign = 0;
 				}
 #endif
 			/* rv = */ rounded_quotient(dval(&rv), tens[-e]);
 			goto ret;
 			}
 #endif
+#endif /* ROUND_BIASED_without_Round_Up */
 		}
 	e1 += nd - k;
 
 #ifdef IEEE_Arith
 #ifdef SET_INEXACT
 	bc.inexact = 1;
 	if (k <= DBL_DIG)
 		oldinexact = get_inexact();
@@ -3673,16 +3688,19 @@ dtoa
 #ifndef Sudden_Underflow
 	int denorm;
 	ULong x;
 #endif
 	Bigint *b, *b1, *delta, *mlo, *mhi, *S;
 	U d2, eps, u;
 	double ds;
 	char *s, *s0;
+#ifdef IEEE_Arith
+	U eps1;
+#endif
 #ifdef SET_INEXACT
 	int inexact, oldinexact;
 #endif
 #ifdef Honor_FLT_ROUNDS /*{*/
 	int Rounding;
 #ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */
 	Rounding = Flt_Rounds;
 #else /*}{*/
@@ -3936,24 +3954,36 @@ dtoa
 			goto fast_failed;
 			}
 #ifndef No_leftright
 		if (leftright) {
 			/* Use Steele & White method of only
 			 * generating digits needed.
 			 */
 			dval(&eps) = 0.5/tens[ilim-1] - dval(&eps);
+#ifdef IEEE_Arith
+			if (k0 < 0 && j1 >= 307) {
+				eps1.d = 1.01e256; /* 1.01 allows roundoff in the next few lines */
+				word0(&eps1) -= Exp_msk1 * (Bias+P-1);
+				dval(&eps1) *= tens[j1 & 0xf];
+				for(i = 0, j = (j1-256) >> 4; j; j >>= 1, i++)
+					if (j & 1)
+						dval(&eps1) *= bigtens[i];
+				if (eps.d < eps1.d)
+					eps.d = eps1.d;
+				}
+#endif
 			for(i = 0;;) {
 				L = dval(&u);
 				dval(&u) -= L;
 				*s++ = '0' + (int)L;
+				if (1. - dval(&u) < dval(&eps))
+					goto bump_up;
 				if (dval(&u) < dval(&eps))
 					goto ret1;
-				if (1. - dval(&u) < dval(&eps))
-					goto bump_up;
 				if (++i >= ilim)
 					break;
 				dval(&eps) *= 10.;
 				dval(&u) *= 10.;
 				}
 			}
 		else {
 #endif
@@ -4017,17 +4047,22 @@ dtoa
 #ifdef Honor_FLT_ROUNDS
 				if (mode > 1)
 				switch(Rounding) {
 				  case 0: goto ret1;
 				  case 2: goto bump_up;
 				  }
 #endif
 				dval(&u) += dval(&u);
-				if (dval(&u) > ds || (dval(&u) == ds && L & 1)) {
+#ifdef ROUND_BIASED
+				if (dval(&u) >= ds)
+#else
+				if (dval(&u) > ds || (dval(&u) == ds && L & 1))
+#endif
+					{
  bump_up:
 					while(*--s == '9')
 						if (s == s0) {
 							k++;
 							*s = '0';
 							break;
 							}
 					++*s++;
@@ -4101,25 +4136,16 @@ dtoa
 
 	/* Arrange for convenient computation of quotients:
 	 * shift left if necessary so divisor has 4 leading 0 bits.
 	 *
 	 * Perhaps we should just compute leading 28 bits of S once
 	 * and for all and pass them and a shift to quorem, so it
 	 * can do shifts and ors to compute the numerator for q.
 	 */
-#ifdef Pack_32
-	if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f))
-		i = 32 - i;
-#define iInc 28
-#else
-	if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf)
-		i = 16 - i;
-#define iInc 12
-#endif
 	i = dshift(S, s2);
 	b2 += i;
 	m2 += i;
 	s2 += i;
 	if (b2 > 0)
 		b = lshift(b, b2);
 	if (s2 > 0)
 		S = lshift(S, s2);
@@ -4202,17 +4228,21 @@ dtoa
 				 switch(Rounding) {
 				  case 0: goto accept_dig;
 				  case 2: goto keep_dig;
 				  }
 #endif /*Honor_FLT_ROUNDS*/
 				if (j1 > 0) {
 					b = lshift(b, 1);
 					j1 = cmp(b, S);
+#ifdef ROUND_BIASED
+					if (j1 >= 0 /*)*/
+#else
 					if ((j1 > 0 || (j1 == 0 && dig & 1))
+#endif
 					&& dig++ == '9')
 						goto round_9_up;
 					}
  accept_dig:
 				*s++ = dig;
 				goto ret;
 				}
 			if (j1 > 0) {
@@ -4262,17 +4292,22 @@ dtoa
 #ifdef Honor_FLT_ROUNDS
 	switch(Rounding) {
 	  case 0: goto trimzeros;
 	  case 2: goto roundoff;
 	  }
 #endif
 	b = lshift(b, 1);
 	j = cmp(b, S);
-	if (j > 0 || (j == 0 && dig & 1)) {
+#ifdef ROUND_BIASED
+	if (j >= 0)
+#else
+	if (j > 0 || (j == 0 && dig & 1))
+#endif
+		{
  roundoff:
 		while(*--s == '9')
 			if (s == s0) {
 				k++;
 				*s++ = '1';
 				goto ret;
 				}
 		++*s++;
--- a/nsprpub/pr/src/misc/prsystem.c
+++ b/nsprpub/pr/src/misc/prsystem.c
@@ -279,17 +279,17 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMem
     PRUint64 bytes = 0;
 
 #if defined(LINUX) || defined(SOLARIS)
 
     long pageSize = sysconf(_SC_PAGESIZE);
     long pageCount = sysconf(_SC_PHYS_PAGES);
     bytes = (PRUint64) pageSize * pageCount;
 
-#elif defined(NETBSD)
+#elif defined(NETBSD) || defined(OPENBSD)
 
     int mib[2];
     int rc;
     uint64_t memSize;
     size_t len = sizeof(memSize);
 
     mib[0] = CTL_HW;
     mib[1] = HW_PHYSMEM64;
--- a/nsprpub/pr/tests/vercheck.c
+++ b/nsprpub/pr/tests/vercheck.c
@@ -47,31 +47,31 @@
  */
 
 #include "prinit.h"
 
 #include <stdio.h>
 #include <stdlib.h>
 
 /*
- * This release (4.8.7) is backward compatible with the
+ * This release (4.8.8) is backward compatible with the
  * 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.x, 4.7.x,
- * 4.8, 4.8.1, 4.8.2, 4.8.3, 4.8.4, 4.8.5, and 4.8.6 releases.
+ * 4.8, 4.8.1, 4.8.2, 4.8.3, 4.8.4, 4.8.5, 4.8.6 and 4.8.7 releases.
  * It, of course, is compatible with itself.
  */
 static char *compatible_version[] = {
     "4.0", "4.0.1", "4.1", "4.1.1", "4.1.2", "4.1.3",
     "4.2", "4.2.1", "4.2.2", "4.3", "4.4", "4.4.1",
     "4.5", "4.5.1",
     "4.6", "4.6.1", "4.6.2", "4.6.3", "4.6.4", "4.6.5",
     "4.6.6", "4.6.7", "4.6.8",
     "4.7", "4.7.1", "4.7.2", "4.7.3", "4.7.4", "4.7.5",
     "4.7.6",
     "4.8", "4.8.1", "4.8.2", "4.8.3", "4.8.4", "4.8.5",
-    "4.8.6", PR_VERSION
+    "4.8.6", "4.8.7", PR_VERSION
 };
 
 /*
  * This release is not backward compatible with the old
  * NSPR 2.1 and 3.x releases.
  *
  * Any release is incompatible with future releases and
  * patches.