Skip to content

Commit

Permalink
Bug 865828 - Upgrade Mozilla 23 to NSPR 4.10, r=wtc
Browse files Browse the repository at this point in the history
  • Loading branch information
kaie committed Apr 25, 2013
1 parent 2b705f0 commit 560f773
Show file tree
Hide file tree
Showing 34 changed files with 188 additions and 505 deletions.
2 changes: 1 addition & 1 deletion nsprpub/TAG-INFO
Original file line number Diff line number Diff line change
@@ -1 +1 @@
NSPR_4_9_6_RTM
NSPR_4_10_BETA1
12 changes: 4 additions & 8 deletions nsprpub/configure
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,8 @@ test "$host_alias" != "$target_alias" &&


MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=9
MOD_PATCH_VERSION=6
MOD_MINOR_VERSION=10
MOD_PATCH_VERSION=0
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
USE_PTHREADS=
Expand Down Expand Up @@ -1017,10 +1017,6 @@ echo "configure:961: checking for android platform directory" >&5

cat >> confdefs.h <<\EOF
#define ANDROID 1
EOF

cat >> confdefs.h <<EOF
#define ANDROID_VERSION $android_version
EOF

;;
Expand Down Expand Up @@ -1449,12 +1445,12 @@ echo "configure:1447: checking whether the $host compiler ($HOST_CC $HOST_CFLAGS
#include "confdefs.h"
int main() {
return(0);
return 0;
; return 0; }
EOF
if { (eval echo configure:1456: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_prog_host_cc_works=1 echo "$ac_t""yes" 1>&6
echo "$ac_t""yes" 1>&6
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
Expand Down
15 changes: 7 additions & 8 deletions nsprpub/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ dnl ========================================================
dnl = Defaults
dnl ========================================================
MOD_MAJOR_VERSION=4
MOD_MINOR_VERSION=9
MOD_PATCH_VERSION=6
MOD_MINOR_VERSION=10
MOD_PATCH_VERSION=0
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
USE_PTHREADS=
Expand Down Expand Up @@ -271,7 +271,6 @@ case "$target" in
fi

AC_DEFINE(ANDROID)
AC_DEFINE_UNQUOTED(ANDROID_VERSION, $android_version)
;;
esac
fi
Expand Down Expand Up @@ -593,9 +592,9 @@ if test "$target" != "$host" -o -n "$CROSS_COMPILE"; then
LDFLAGS="$HOST_LDFLAGS"

AC_MSG_CHECKING([whether the $host compiler ($HOST_CC $HOST_CFLAGS $HOST_LDFLAGS) works])
AC_TRY_COMPILE([], [return(0);],
[ac_cv_prog_host_cc_works=1 AC_MSG_RESULT([yes])],
AC_MSG_ERROR([installation or configuration problem: $host compiler $HOST_CC cannot create executables.]) )
AC_TRY_COMPILE([], [return 0;],
[AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([installation or configuration problem: $host compiler $HOST_CC cannot create executables.])] )

CC=$_SAVE_CC
CFLAGS=$_SAVE_CFLAGS
Expand Down Expand Up @@ -2553,8 +2552,8 @@ case $target in
;;
*)
AC_CHECK_LIB(dl, dlopen,
AC_CHECK_HEADER(dlfcn.h,
OS_LIBS="-ldl $OS_LIBS"))
[AC_CHECK_HEADER(dlfcn.h,
OS_LIBS="-ldl $OS_LIBS")])
;;
esac

Expand Down
9 changes: 8 additions & 1 deletion nsprpub/lib/ds/plarena.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ PR_IMPLEMENT(void *) PL_ArenaAllocate(PLArenaPool *pool, PRUint32 nb)
pool->current = a;
rp = (char *)a->avail;
a->avail += nb;
PL_MAKE_MEM_UNDEFINED(rp, nb);
return rp;
}
} while( NULL != (a = a->next) );
Expand Down Expand Up @@ -187,6 +188,7 @@ PR_IMPLEMENT(void *) PL_ArenaAllocate(PLArenaPool *pool, PRUint32 nb)
pool->current = a;
if ( NULL == pool->first.next )
pool->first.next = a;
PL_MAKE_MEM_UNDEFINED(rp, nb);
return(rp);
}
}
Expand All @@ -201,6 +203,7 @@ PR_IMPLEMENT(void *) PL_ArenaAllocate(PLArenaPool *pool, PRUint32 nb)
if ( NULL != a ) {
a->limit = (PRUword)a + sz;
a->base = a->avail = (PRUword)PL_ARENA_ALIGN(pool, a + 1);
PL_MAKE_MEM_NOACCESS((void*)a->avail, a->limit - a->avail);
rp = (char *)a->avail;
a->avail += nb;
/* the newly allocated arena is linked after pool->current
Expand All @@ -212,6 +215,7 @@ PR_IMPLEMENT(void *) PL_ArenaAllocate(PLArenaPool *pool, PRUint32 nb)
pool->first.next = a;
PL_COUNT_ARENA(pool,++);
COUNT(pool, nmallocs);
PL_MAKE_MEM_UNDEFINED(rp, nb);
return(rp);
}
}
Expand All @@ -237,7 +241,8 @@ static void ClearArenaList(PLArena *a, PRInt32 pattern)
for (; a; a = a->next) {
PR_ASSERT(a->base <= a->avail && a->avail <= a->limit);
a->avail = a->base;
PL_CLEAR_UNUSED_PATTERN(a, pattern);
PL_CLEAR_UNUSED_PATTERN(a, pattern);
PL_MAKE_MEM_NOACCESS((void*)a->avail, a->limit - a->avail);
}
}

Expand Down Expand Up @@ -273,6 +278,8 @@ static void FreeArenaList(PLArenaPool *pool, PLArena *head, PRBool reallyFree)
} else {
/* Insert the whole arena chain at the front of the freelist. */
do {
PL_MAKE_MEM_NOACCESS((void*)(*ap)->base,
(*ap)->limit - (*ap)->base);
ap = &(*ap)->next;
} while (*ap);
LockArena();
Expand Down
84 changes: 78 additions & 6 deletions nsprpub/lib/ds/plarena.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,68 @@ struct PLArenaPool {
#endif
};

/*
* WARNING: The PL_MAKE_MEM_ macros are for internal use by NSPR. Do NOT use
* them in your code.
*
* NOTE: Valgrind support to be added.
*
* The PL_MAKE_MEM_ macros are modeled after the MOZ_MAKE_MEM_ macros in
* Mozilla's mfbt/MemoryChecking.h. Only AddressSanitizer is supported now.
*
* Provides a common interface to the ASan (AddressSanitizer) and Valgrind
* functions used to mark memory in certain ways. In detail, the following
* three macros are provided:
*
* PL_MAKE_MEM_NOACCESS - Mark memory as unsafe to access (e.g. freed)
* PL_MAKE_MEM_UNDEFINED - Mark memory as accessible, with content undefined
* PL_MAKE_MEM_DEFINED - Mark memory as accessible, with content defined
*
* With Valgrind in use, these directly map to the three respective Valgrind
* macros. With ASan in use, the NOACCESS macro maps to poisoning the memory,
* while the UNDEFINED/DEFINED macros unpoison memory.
*
* With no memory checker available, all macros expand to the empty statement.
*/

/* WARNING: PL_SANITIZE_ADDRESS is for internal use by this header. Do NOT
* define or test this macro in your code.
*/
#if defined(__has_feature)
#if __has_feature(address_sanitizer)
#define PL_SANITIZE_ADDRESS 1
#endif
#elif defined(__SANITIZE_ADDRESS__)
#define PL_SANITIZE_ADDRESS 1
#endif

#if defined(PL_SANITIZE_ADDRESS)

/* These definitions are usually provided through the
* sanitizer/asan_interface.h header installed by ASan.
* See https://code.google.com/p/address-sanitizer/wiki/ManualPoisoning
*/

void __asan_poison_memory_region(void const volatile *addr, size_t size);
void __asan_unpoison_memory_region(void const volatile *addr, size_t size);

#define PL_MAKE_MEM_NOACCESS(addr, size) \
__asan_poison_memory_region((addr), (size))

#define PL_MAKE_MEM_UNDEFINED(addr, size) \
__asan_unpoison_memory_region((addr), (size))

#define PL_MAKE_MEM_DEFINED(addr, size) \
__asan_unpoison_memory_region((addr), (size))

#else

#define PL_MAKE_MEM_NOACCESS(addr, size)
#define PL_MAKE_MEM_UNDEFINED(addr, size)
#define PL_MAKE_MEM_DEFINED(addr, size)

#endif

/*
* If the including .c file uses only one power-of-2 alignment, it may define
* PL_ARENA_CONST_ALIGN_MASK to the alignment mask and save a few instructions
Expand All @@ -78,10 +140,12 @@ struct PLArenaPool {
PRUint32 _nb = PL_ARENA_ALIGN(pool, nb); \
PRUword _p = _a->avail; \
PRUword _q = _p + _nb; \
if (_q > _a->limit) \
if (_q > _a->limit) { \
_p = (PRUword)PL_ArenaAllocate(pool, _nb); \
else \
} else { \
PL_MAKE_MEM_UNDEFINED((void *)_p, nb); \
_a->avail = _q; \
} \
p = (void *)_p; \
PL_ArenaCountAllocation(pool, nb); \
PR_END_MACRO
Expand All @@ -94,6 +158,7 @@ struct PLArenaPool {
PRUword _q = _p + _incr; \
if (_p == (PRUword)(p) + PL_ARENA_ALIGN(pool, size) && \
_q <= _a->limit) { \
PL_MAKE_MEM_UNDEFINED((void *)((PRUword)(p) + size), incr); \
_a->avail = _q; \
PL_ArenaCountInplaceGrowth(pool, size, incr); \
} else { \
Expand All @@ -106,13 +171,19 @@ struct PLArenaPool {
#define PR_UPTRDIFF(p,q) ((PRUword)(p) - (PRUword)(q))

#define PL_CLEAR_UNUSED_PATTERN(a, pattern) \
(PR_ASSERT((a)->avail <= (a)->limit), \
memset((void*)(a)->avail, (pattern), (a)->limit - (a)->avail))
PR_BEGIN_MACRO \
PR_ASSERT((a)->avail <= (a)->limit); \
PL_MAKE_MEM_UNDEFINED((void*)(a)->avail, (a)->limit - (a)->avail); \
memset((void*)(a)->avail, (pattern), (a)->limit - (a)->avail); \
PR_END_MACRO
#ifdef DEBUG
#define PL_FREE_PATTERN 0xDA
#define PL_CLEAR_UNUSED(a) PL_CLEAR_UNUSED_PATTERN((a), PL_FREE_PATTERN)
#define PL_CLEAR_ARENA(a) memset((void*)(a), PL_FREE_PATTERN, \
(a)->limit - (PRUword)(a))
#define PL_CLEAR_ARENA(a) \
PR_BEGIN_MACRO \
PL_MAKE_MEM_UNDEFINED((void*)(a), (a)->limit - (PRUword)(a)); \
memset((void*)(a), PL_FREE_PATTERN, (a)->limit - (PRUword)(a)); \
PR_END_MACRO
#else
#define PL_CLEAR_UNUSED(a)
#define PL_CLEAR_ARENA(a)
Expand All @@ -125,6 +196,7 @@ struct PLArenaPool {
if (PR_UPTRDIFF(_m, _a->base) <= PR_UPTRDIFF(_a->avail, _a->base)) { \
_a->avail = (PRUword)PL_ARENA_ALIGN(pool, _m); \
PL_CLEAR_UNUSED(_a); \
PL_MAKE_MEM_NOACCESS((void*)_a->avail, _a->limit - _a->avail); \
PL_ArenaCountRetract(pool, _m); \
} else { \
PL_ArenaRelease(pool, _m); \
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/linux/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#ident "$Id: Makefile.in,v 1.12 2012/03/06 13:13:40 gerv%gerv.net Exp $"
#ident "$Id$"
#

MOD_DEPTH = ../..
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/Makefile-devl.com
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#ident "$Id: Makefile-devl.com,v 1.4 2012/03/06 13:13:40 gerv%gerv.net Exp $"
#ident "$Id$"
#

MACH = $(shell mach)
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/Makefile-devl.targ
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#ident "$Id: Makefile-devl.targ,v 1.4 2012/03/06 13:13:40 gerv%gerv.net Exp $"
#ident "$Id$"
#

include $(srcdir)/../proto64.mk
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/Makefile.com
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#ident "$Id: Makefile.com,v 1.9 2012/03/06 13:13:40 gerv%gerv.net Exp $"
#ident "$Id$"
#

MACH = $(shell mach)
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#ident "$Id: Makefile.in,v 1.4 2012/03/06 13:13:40 gerv%gerv.net Exp $"
#ident "$Id$"
#

MOD_DEPTH = ../..
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/Makefile.targ
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#ident "$Id: Makefile.targ,v 1.7 2012/03/06 13:13:40 gerv%gerv.net Exp $"
#ident "$Id$"
#

include $(srcdir)/../proto64.mk
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/SUNWpr/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#ident "$Id: Makefile.in,v 1.3 2012/03/06 13:13:41 gerv%gerv.net Exp $"
#ident "$Id$"
#

MOD_DEPTH = ../../..
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/SUNWpr/depend
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# $Id: depend,v 1.4 2012/03/06 13:13:41 gerv%gerv.net Exp $
# $Id$
#
# This package information file defines software dependencies associated
# with the pkg. You can define three types of pkg dependencies with this file:
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/SUNWpr/pkginfo.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#ident "$Id: pkginfo.tmpl,v 1.4 2012/03/06 13:13:41 gerv%gerv.net Exp $"
#ident "$Id$"
#
#
# This required package information file describes characteristics of the
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/SUNWpr/prototype_com
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#ident "$Id: prototype_com,v 1.5 2012/03/06 13:13:41 gerv%gerv.net Exp $"
#ident "$Id$"
#
# This required package information file contains a list of package contents.
# The 'pkgmk' command uses this file to identify the contents of a package
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/SUNWpr/prototype_i386
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#ident "$Id: prototype_i386,v 1.5 2012/03/06 13:13:41 gerv%gerv.net Exp $"
#ident "$Id$"
#
# This required package information file contains a list of package contents.
# The 'pkgmk' command uses this file to identify the contents of a package
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/SUNWpr/prototype_sparc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#ident "$Id: prototype_sparc,v 1.5 2012/03/06 13:13:41 gerv%gerv.net Exp $"
#ident "$Id$"
#
# This required package information file contains a list of package contents.
# The 'pkgmk' command uses this file to identify the contents of a package
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/SUNWprd/Makefile.in
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#ident "$Id: Makefile.in,v 1.4 2012/03/06 13:13:41 gerv%gerv.net Exp $"
#ident "$Id$"
#

MOD_DEPTH = ../../..
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/SUNWprd/depend
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# $Id: depend,v 1.4 2012/03/06 13:13:41 gerv%gerv.net Exp $
# $Id$
#
# This package information file defines software dependencies associated
# with the pkg. You can define three types of pkg dependencies with this file:
Expand Down
2 changes: 1 addition & 1 deletion nsprpub/pkg/solaris/SUNWprd/pkginfo.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
#ident "$Id: pkginfo.tmpl,v 1.4 2012/03/06 13:13:41 gerv%gerv.net Exp $"
#ident "$Id$"
#
#
# This required package information file describes characteristics of the
Expand Down
Loading

0 comments on commit 560f773

Please sign in to comment.