pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/lang/spidermonkey185 spidermonkey185: Fix SunOS/x86_64...
details: https://anonhg.NetBSD.org/pkgsrc/rev/691593192d79
branches: trunk
changeset: 379604:691593192d79
user: jperkin <jperkin%pkgsrc.org@localhost>
date: Wed May 02 12:42:50 2018 +0000
description:
spidermonkey185: Fix SunOS/x86_64 mmap handling.
The previous MAP_32BIT workaround was insufficient, SpiderMonkey still makes
certain assumptions about memory layout, requiring that the high 17 bits are
clear. This was most noticeable with couchdb's couchjs process that would
reliably segfault.
Instead, apply a mixture of Debian and upstream patches to implement their
ia64 workaround on SunOS/x86_64, utilising both a fixed mmap range and
disabling static strings to workaround this issue.
Tested with the couchdb test suite which now runs to completion.
Bump PKGREVISION.
diffstat:
lang/spidermonkey185/Makefile | 3 +-
lang/spidermonkey185/distinfo | 14 ++-
lang/spidermonkey185/patches/patch-jsatom.cpp | 20 +++
lang/spidermonkey185/patches/patch-jscntxt.cpp | 36 ++++++
lang/spidermonkey185/patches/patch-jsgcchunk.cpp | 37 ++++-
lang/spidermonkey185/patches/patch-jsiter.cpp | 20 +++
lang/spidermonkey185/patches/patch-jsnum.cpp | 33 +++++
lang/spidermonkey185/patches/patch-jsstr.cpp | 51 ++++++++
lang/spidermonkey185/patches/patch-jsstr.h | 100 +++++++++++++++++
lang/spidermonkey185/patches/patch-jsstrinlines.h | 90 +++++++++++++++
lang/spidermonkey185/patches/patch-jstracer.cpp | 57 +++++++++
lang/spidermonkey185/patches/patch-jstracer.h | 19 +++
lang/spidermonkey185/patches/patch-tracejit_Writer.cpp | 25 ++++
13 files changed, 494 insertions(+), 11 deletions(-)
diffs (truncated from 584 to 300 lines):
diff -r b706499dc035 -r 691593192d79 lang/spidermonkey185/Makefile
--- a/lang/spidermonkey185/Makefile Wed May 02 12:32:04 2018 +0000
+++ b/lang/spidermonkey185/Makefile Wed May 02 12:42:50 2018 +0000
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.4 2018/04/26 09:39:18 jperkin Exp $
+# $NetBSD: Makefile,v 1.5 2018/05/02 12:42:50 jperkin Exp $
#
DISTNAME= js185-1.0.0
PKGNAME= spidermonkey185-1.8.5
+PKGREVISION= 1
CATEGORIES= lang
MASTER_SITES= ${MASTER_SITE_MOZILLA:=js/}
diff -r b706499dc035 -r 691593192d79 lang/spidermonkey185/distinfo
--- a/lang/spidermonkey185/distinfo Wed May 02 12:32:04 2018 +0000
+++ b/lang/spidermonkey185/distinfo Wed May 02 12:42:50 2018 +0000
@@ -1,14 +1,24 @@
-$NetBSD: distinfo,v 1.4 2018/04/26 09:39:18 jperkin Exp $
+$NetBSD: distinfo,v 1.5 2018/05/02 12:42:50 jperkin Exp $
SHA1 (js185-1.0.0.tar.gz) = 52a01449c48d7a117b35f213d3e4263578d846d6
RMD160 (js185-1.0.0.tar.gz) = 23e6ddc81d5b63e015aecc1a104b2d3d3ced5005
SHA512 (js185-1.0.0.tar.gz) = 2af7122a7c7007fd7b6668776fe1222515a810b3e43bbf0f76b8f94e1ef406ffd3fb5ccec393021b00274c05b38a77235bc8d6886994c56762fcaf0aa7cf6718
Size (js185-1.0.0.tar.gz) = 6164605 bytes
SHA1 (patch-configure) = 77366fff7e8b766b5691d0432b8740d4c8c362a6
+SHA1 (patch-jsatom.cpp) = 4156e97b72461af88aa68394ef439d63a4c081dc
SHA1 (patch-jscell.h) = e2c90041b9b526d1f07e4905d0c684afe96992a9
+SHA1 (patch-jscntxt.cpp) = 7d41c587affa51f23bfff48b118d61ec6e3b87c1
SHA1 (patch-jsgc.h) = 8e8a31e9284ce8fe0b92f36c2732722d720b9101
-SHA1 (patch-jsgcchunk.cpp) = ecc221e0e96db4083dc9cdf97848e001c091ec2c
+SHA1 (patch-jsgcchunk.cpp) = 868ef0f2e0ead5f8ef53d312f3a9162298ae23d8
+SHA1 (patch-jsiter.cpp) = dabfaeb00edbb17de670f854a3821910c197d6da
+SHA1 (patch-jsnum.cpp) = b7c0a222c2241d6acdcce3f4e84847bfeab7d545
SHA1 (patch-jsobj.h) = 2da40bf90fd2d856bf61658964b49e8b12ac7809
SHA1 (patch-jspubtd.h) = 6219e5ce98885b72e62978a33ee2b5367c3406b3
+SHA1 (patch-jsstr.cpp) = 2b843a89d1afea858aac9ef61092da96725308f8
+SHA1 (patch-jsstr.h) = 0d23725326ab5432bebe63d4775911bc2c74039b
+SHA1 (patch-jsstrinlines.h) = 34b465a4fb504973f65395ccd2819a29ce16c5da
+SHA1 (patch-jstracer.cpp) = 5b0b4d7709b446d1471b593e2c338f48d9fa4eec
+SHA1 (patch-jstracer.h) = 4f0bd2f958d1bedb76b6ac54e218e1fde846ad6d
+SHA1 (patch-tracejit_Writer.cpp) = fdd2751e411e933fcb22736b65ea3c93c2cecda1
SHA1 (patch-v8-dtoa_platform.cc) = 24670e996fcc7ca0d1e7b1b3765a67ac05e9a661
SHA1 (patch-v8-dtoa_platform.h) = 1d618d8f51e3ee169606297950d3030fcf72abbc
diff -r b706499dc035 -r 691593192d79 lang/spidermonkey185/patches/patch-jsatom.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/spidermonkey185/patches/patch-jsatom.cpp Wed May 02 12:42:50 2018 +0000
@@ -0,0 +1,20 @@
+$NetBSD: patch-jsatom.cpp,v 1.1 2018/05/02 12:42:51 jperkin Exp $
+
+Implement Debian disable-static-strings-on-ia64.patch fix.
+
+--- jsatom.cpp.orig 2011-03-31 19:08:36.000000000 +0000
++++ jsatom.cpp
+@@ -603,11 +603,13 @@ js_GetExistingStringAtom(JSContext *cx,
+ JSString str, *str2;
+ JSAtomState *state;
+
++#ifdef JS_HAS_STATIC_STRINGS
+ if (length == 1) {
+ jschar c = *chars;
+ if (c < UNIT_STRING_LIMIT)
+ return STRING_TO_ATOM(JSString::unitString(c));
+ }
++#endif
+
+ str.initFlatNotTerminated((jschar *)chars, length);
+ state = &cx->runtime->atomState;
diff -r b706499dc035 -r 691593192d79 lang/spidermonkey185/patches/patch-jscntxt.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/spidermonkey185/patches/patch-jscntxt.cpp Wed May 02 12:42:50 2018 +0000
@@ -0,0 +1,36 @@
+$NetBSD: patch-jscntxt.cpp,v 1.1 2018/05/02 12:42:51 jperkin Exp $
+
+Apply modified patch from Debian and upstream SpiderMonkey to resolve
+assumptions made about Solaris/x86_64 memory layout.
+
+--- jscntxt.cpp.orig 2011-03-31 19:08:36.000000000 +0000
++++ jscntxt.cpp
+@@ -159,6 +159,28 @@ StackSpace::init()
+ return false;
+ base = reinterpret_cast<Value *>(p);
+ end = base + CAPACITY_VALS;
++#elif defined(SOLARIS) && defined(__x86_64__)
++ const uintptr_t pstart = 0x0000070000000000;
++ const uintptr_t pend = 0x0000800000000000;
++ uintptr_t addr;
++
++ JS_ASSERT(CAPACITY_BYTES % getpagesize() == 0);
++ p = MAP_FAILED;
++ for (addr = pstart; p == MAP_FAILED && addr + CAPACITY_BYTES <= pend; addr += js::GC_CHUNK_SIZE) {
++ p = mmap((caddr_t)addr, CAPACITY_BYTES, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);
++ if (p != MAP_FAILED) {
++ if ((((long long)p & 0xffff800000000000) != 0 ||
++ ((long long)p + (CAPACITY_BYTES - 1)) & 0xffff800000000000) != 0 ||
++ (uintptr_t)p != addr) {
++ munmap(p, CAPACITY_BYTES);
++ p = MAP_FAILED;
++ }
++ }
++ }
++ if (p == MAP_FAILED)
++ return false;
++ base = reinterpret_cast<Value *>(p);
++ end = base + CAPACITY_VALS;
+ #else
+ JS_ASSERT(CAPACITY_BYTES % getpagesize() == 0);
+ p = mmap(NULL, CAPACITY_BYTES, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
diff -r b706499dc035 -r 691593192d79 lang/spidermonkey185/patches/patch-jsgcchunk.cpp
--- a/lang/spidermonkey185/patches/patch-jsgcchunk.cpp Wed May 02 12:32:04 2018 +0000
+++ b/lang/spidermonkey185/patches/patch-jsgcchunk.cpp Wed May 02 12:42:50 2018 +0000
@@ -1,16 +1,37 @@
-$NetBSD: patch-jsgcchunk.cpp,v 1.1 2018/04/26 09:39:18 jperkin Exp $
+$NetBSD: patch-jsgcchunk.cpp,v 1.2 2018/05/02 12:42:51 jperkin Exp $
-Limit mmap() to the lower 32 bits of address space on SunOS, as SpiderMonkey
-makes assumptions: https://bugzilla.mozilla.org/show_bug.cgi?id=577056
+Apply modified patch from Debian and upstream SpiderMonkey to resolve
+assumptions made about Solaris/x86_64 memory layout.
--- jsgcchunk.cpp.orig 2011-03-31 19:08:36.000000000 +0000
+++ jsgcchunk.cpp
-@@ -303,7 +303,7 @@ MapAlignedPages(size_t size, size_t alig
+@@ -301,11 +301,25 @@ MapAlignedPages(size_t size, size_t alig
+ * We don't use MAP_FIXED here, because it can cause the *replacement*
+ * of existing mappings, and we only want to create new mappings.
*/
- #ifdef SOLARIS
- void *p = mmap((caddr_t) alignment, size, PROT_READ | PROT_WRITE,
+-#ifdef SOLARIS
+- void *p = mmap((caddr_t) alignment, size, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_NOSYNC | MAP_ALIGN | MAP_ANON, -1, 0);
-+ MAP_PRIVATE | MAP_NOSYNC | MAP_ALIGN | MAP_ANON | MAP_32BIT, -1, 0);
++#if defined(__x86_64__)
++ void *p = MAP_FAILED;
++ const uintptr_t start = 0x0000070000000000;
++ const uintptr_t end = 0x0000800000000000;
++ uintptr_t addr;
++
++ for (addr = start; p == MAP_FAILED && addr + size <= end; addr += js::GC_CHUNK_SIZE) {
++ p = mmap((caddr_t)addr, size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);
++ if (p != MAP_FAILED) {
++ if (((long long)p & 0xffff800000000000) != 0 ||
++ (((long long)p + (size - 1)) & 0xffff800000000000) != 0 ||
++ ((uintptr_t)p != addr)) {
++ munmap(p, size);
++ p = MAP_FAILED;
++ }
++ }
++ }
#else
- void *p = mmap((void *) alignment, size, PROT_READ | PROT_WRITE,
+- void *p = mmap((void *) alignment, size, PROT_READ | PROT_WRITE,
++ void *p = mmap((caddr_t) alignment, size, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_NOSYNC | MAP_ALIGN | MAP_ANON, -1, 0);
+ #endif
+ if (p == MAP_FAILED)
diff -r b706499dc035 -r 691593192d79 lang/spidermonkey185/patches/patch-jsiter.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/spidermonkey185/patches/patch-jsiter.cpp Wed May 02 12:42:50 2018 +0000
@@ -0,0 +1,20 @@
+$NetBSD: patch-jsiter.cpp,v 1.1 2018/05/02 12:42:51 jperkin Exp $
+
+Implement Debian disable-static-strings-on-ia64.patch fix.
+
+--- jsiter.cpp.orig 2011-03-31 19:08:36.000000000 +0000
++++ jsiter.cpp
+@@ -1002,9 +1002,12 @@ js_IteratorNext(JSContext *cx, JSObject
+
+ JSString *str;
+ jsint i;
++#ifdef JS_HAS_STATIC_STRINGS
+ if (rval->isInt32() && (jsuint(i = rval->toInt32()) < INT_STRING_LIMIT)) {
+ str = JSString::intString(i);
+- } else {
++ } else
++#endif
++ {
+ str = js_ValueToString(cx, *rval);
+ if (!str)
+ return false;
diff -r b706499dc035 -r 691593192d79 lang/spidermonkey185/patches/patch-jsnum.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/spidermonkey185/patches/patch-jsnum.cpp Wed May 02 12:42:50 2018 +0000
@@ -0,0 +1,33 @@
+$NetBSD: patch-jsnum.cpp,v 1.1 2018/05/02 12:42:51 jperkin Exp $
+
+Implement Debian disable-static-strings-on-ia64.patch fix.
+
+--- jsnum.cpp.orig 2011-03-31 19:08:36.000000000 +0000
++++ jsnum.cpp
+@@ -605,8 +605,10 @@ js_IntToString(JSContext *cx, int32 si)
+ {
+ uint32 ui;
+ if (si >= 0) {
++#ifdef JS_HAS_STATIC_STRINGS
+ if (si < INT_STRING_LIMIT)
+ return JSString::intString(si);
++#endif
+ ui = si;
+ } else {
+ ui = uint32(-si);
+@@ -1169,6 +1171,7 @@ js_NumberToStringWithBase(JSContext *cx,
+
+ int32_t i;
+ if (JSDOUBLE_IS_INT32(d, &i)) {
++#ifdef JS_HAS_STATIC_STRINGS
+ if (base == 10 && jsuint(i) < INT_STRING_LIMIT)
+ return JSString::intString(i);
+ if (jsuint(i) < jsuint(base)) {
+@@ -1176,6 +1179,7 @@ js_NumberToStringWithBase(JSContext *cx,
+ return JSString::intString(i);
+ return JSString::unitString(jschar('a' + i - 10));
+ }
++#endif
+
+ if (JSString *str = c->dtoaCache.lookup(base, d))
+ return str;
diff -r b706499dc035 -r 691593192d79 lang/spidermonkey185/patches/patch-jsstr.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/spidermonkey185/patches/patch-jsstr.cpp Wed May 02 12:42:50 2018 +0000
@@ -0,0 +1,51 @@
+$NetBSD: patch-jsstr.cpp,v 1.1 2018/05/02 12:42:51 jperkin Exp $
+
+Implement Debian disable-static-strings-on-ia64.patch fix.
+
+--- jsstr.cpp.orig 2011-03-31 19:08:36.000000000 +0000
++++ jsstr.cpp
+@@ -3121,6 +3121,8 @@ static JSFunctionSpec string_methods[] =
+ JS_FS_END
+ };
+
++#ifdef JS_HAS_STATIC_STRINGS
++
+ /*
+ * Set up some tools to make it easier to generate large tables. After constant
+ * folding, for each n, Rn(0) is the comma-separated list R(0), R(1), ..., R(2^n-1).
+@@ -3291,6 +3293,8 @@ const JSString *const JSString::intStrin
+ #undef R3
+ #undef R7
+
++#endif /* defined(JS_HAS_STATIC_STRINGS) */
++
+ JSBool
+ js_String(JSContext *cx, uintN argc, Value *vp)
+ {
+@@ -3331,6 +3335,7 @@ str_fromCharCode(JSContext *cx, uintN ar
+ uint16_t code;
+ if (!ValueToUint16(cx, argv[0], &code))
+ return JS_FALSE;
++#ifdef JS_HAS_STATIC_STRINGS
+ if (code < UNIT_STRING_LIMIT) {
+ str = JSString::unitString(code);
+ if (!str)
+@@ -3338,6 +3343,7 @@ str_fromCharCode(JSContext *cx, uintN ar
+ vp->setString(str);
+ return JS_TRUE;
+ }
++#endif
+ argv[0].setInt32(code);
+ }
+ chars = (jschar *) cx->malloc((argc + 1) * sizeof(jschar));
+@@ -3367,8 +3373,10 @@ String_fromCharCode(JSContext* cx, int32
+ {
+ JS_ASSERT(JS_ON_TRACE(cx));
+ jschar c = (jschar)i;
++#ifdef JS_HAS_STATIC_STRINGS
+ if (c < UNIT_STRING_LIMIT)
+ return JSString::unitString(c);
++#endif
+ return js_NewStringCopyN(cx, &c, 1);
+ }
+ #endif
diff -r b706499dc035 -r 691593192d79 lang/spidermonkey185/patches/patch-jsstr.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/spidermonkey185/patches/patch-jsstr.h Wed May 02 12:42:50 2018 +0000
@@ -0,0 +1,100 @@
+$NetBSD: patch-jsstr.h,v 1.1 2018/05/02 12:42:51 jperkin Exp $
+
+Implement Debian disable-static-strings-on-ia64.patch fix.
+
+--- jsstr.h.orig 2011-03-31 19:08:36.000000000 +0000
++++ jsstr.h
+@@ -57,6 +57,15 @@
+ #include "jsvalue.h"
+ #include "jscell.h"
+
++#if !defined(__ia64__) && !(defined(SOLARIS) && defined(__x86_64__))
++/*
++ * Don't use static strings on ia64 since the compiler may put the static
++ * memory out of the acceptable 47-bit jsval pointer range.
++ */
++# define JS_HAS_STATIC_STRINGS
++#endif
++
++#ifdef JS_HAS_STATIC_STRINGS
+ enum {
+ UNIT_STRING_LIMIT = 256U,
+ SMALL_CHAR_LIMIT = 128U, /* Bigger chars cannot be in a length-2 string. */
+@@ -64,6 +73,7 @@ enum {
Home |
Main Index |
Thread Index |
Old Index