pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/lang/spidermonkey185



Module Name:    pkgsrc
Committed By:   jperkin
Date:           Wed May  2 12:42:51 UTC 2018

Modified Files:
        pkgsrc/lang/spidermonkey185: Makefile distinfo
        pkgsrc/lang/spidermonkey185/patches: patch-jsgcchunk.cpp
Added Files:
        pkgsrc/lang/spidermonkey185/patches: patch-jsatom.cpp patch-jscntxt.cpp
            patch-jsiter.cpp patch-jsnum.cpp patch-jsstr.cpp patch-jsstr.h
            patch-jsstrinlines.h patch-jstracer.cpp patch-jstracer.h
            patch-tracejit_Writer.cpp

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 pkgsrc/lang/spidermonkey185/Makefile \
    pkgsrc/lang/spidermonkey185/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/lang/spidermonkey185/patches/patch-jsatom.cpp \
    pkgsrc/lang/spidermonkey185/patches/patch-jscntxt.cpp \
    pkgsrc/lang/spidermonkey185/patches/patch-jsiter.cpp \
    pkgsrc/lang/spidermonkey185/patches/patch-jsnum.cpp \
    pkgsrc/lang/spidermonkey185/patches/patch-jsstr.cpp \
    pkgsrc/lang/spidermonkey185/patches/patch-jsstr.h \
    pkgsrc/lang/spidermonkey185/patches/patch-jsstrinlines.h \
    pkgsrc/lang/spidermonkey185/patches/patch-jstracer.cpp \
    pkgsrc/lang/spidermonkey185/patches/patch-jstracer.h \
    pkgsrc/lang/spidermonkey185/patches/patch-tracejit_Writer.cpp
cvs rdiff -u -r1.1 -r1.2 \
    pkgsrc/lang/spidermonkey185/patches/patch-jsgcchunk.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/lang/spidermonkey185/Makefile
diff -u pkgsrc/lang/spidermonkey185/Makefile:1.4 pkgsrc/lang/spidermonkey185/Makefile:1.5
--- pkgsrc/lang/spidermonkey185/Makefile:1.4    Thu Apr 26 09:39:18 2018
+++ pkgsrc/lang/spidermonkey185/Makefile        Wed May  2 12:42:50 2018
@@ -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/}
 
Index: pkgsrc/lang/spidermonkey185/distinfo
diff -u pkgsrc/lang/spidermonkey185/distinfo:1.4 pkgsrc/lang/spidermonkey185/distinfo:1.5
--- pkgsrc/lang/spidermonkey185/distinfo:1.4    Thu Apr 26 09:39:18 2018
+++ pkgsrc/lang/spidermonkey185/distinfo        Wed May  2 12:42:50 2018
@@ -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

Index: pkgsrc/lang/spidermonkey185/patches/patch-jsgcchunk.cpp
diff -u pkgsrc/lang/spidermonkey185/patches/patch-jsgcchunk.cpp:1.1 pkgsrc/lang/spidermonkey185/patches/patch-jsgcchunk.cpp:1.2
--- pkgsrc/lang/spidermonkey185/patches/patch-jsgcchunk.cpp:1.1 Thu Apr 26 09:39:18 2018
+++ pkgsrc/lang/spidermonkey185/patches/patch-jsgcchunk.cpp     Wed May  2 12:42:51 2018
@@ -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)

Added files:

Index: pkgsrc/lang/spidermonkey185/patches/patch-jsatom.cpp
diff -u /dev/null pkgsrc/lang/spidermonkey185/patches/patch-jsatom.cpp:1.1
--- /dev/null   Wed May  2 12:42:51 2018
+++ pkgsrc/lang/spidermonkey185/patches/patch-jsatom.cpp        Wed May  2 12:42:51 2018
@@ -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;
Index: pkgsrc/lang/spidermonkey185/patches/patch-jscntxt.cpp
diff -u /dev/null pkgsrc/lang/spidermonkey185/patches/patch-jscntxt.cpp:1.1
--- /dev/null   Wed May  2 12:42:51 2018
+++ pkgsrc/lang/spidermonkey185/patches/patch-jscntxt.cpp       Wed May  2 12:42:51 2018
@@ -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);
Index: pkgsrc/lang/spidermonkey185/patches/patch-jsiter.cpp
diff -u /dev/null pkgsrc/lang/spidermonkey185/patches/patch-jsiter.cpp:1.1
--- /dev/null   Wed May  2 12:42:51 2018
+++ pkgsrc/lang/spidermonkey185/patches/patch-jsiter.cpp        Wed May  2 12:42:51 2018
@@ -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;
Index: pkgsrc/lang/spidermonkey185/patches/patch-jsnum.cpp
diff -u /dev/null pkgsrc/lang/spidermonkey185/patches/patch-jsnum.cpp:1.1
--- /dev/null   Wed May  2 12:42:51 2018
+++ pkgsrc/lang/spidermonkey185/patches/patch-jsnum.cpp Wed May  2 12:42:51 2018
@@ -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;
Index: pkgsrc/lang/spidermonkey185/patches/patch-jsstr.cpp
diff -u /dev/null pkgsrc/lang/spidermonkey185/patches/patch-jsstr.cpp:1.1
--- /dev/null   Wed May  2 12:42:51 2018
+++ pkgsrc/lang/spidermonkey185/patches/patch-jsstr.cpp Wed May  2 12:42:51 2018
@@ -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
Index: pkgsrc/lang/spidermonkey185/patches/patch-jsstr.h
diff -u /dev/null pkgsrc/lang/spidermonkey185/patches/patch-jsstr.h:1.1
--- /dev/null   Wed May  2 12:42:51 2018
+++ pkgsrc/lang/spidermonkey185/patches/patch-jsstr.h   Wed May  2 12:42:51 2018
@@ -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 {
+     INT_STRING_LIMIT         = 256U,
+     NUM_HUNDRED_STRINGS      = 156U
+ };
++#endif
+ 
+ extern jschar *
+ js_GetDependentStringChars(JSString *str);
+@@ -380,10 +390,15 @@ struct JSString
+     typedef uint8 SmallChar;
+ 
+     static inline bool fitsInSmallChar(jschar c) {
++#ifdef JS_HAS_STATIC_STRINGS
+         return c < SMALL_CHAR_LIMIT && toSmallChar[c] != INVALID_SMALL_CHAR;
++#else
++              return false;
++#endif
+     }
+ 
+     static inline bool isUnitString(void *ptr) {
++#ifdef JS_HAS_STATIC_STRINGS
+         jsuword delta = reinterpret_cast<jsuword>(ptr) -
+                         reinterpret_cast<jsuword>(unitStringTable);
+         if (delta >= UNIT_STRING_LIMIT * sizeof(JSString))
+@@ -392,9 +407,13 @@ struct JSString
+         /* If ptr points inside the static array, it must be well-aligned. */
+         JS_ASSERT(delta % sizeof(JSString) == 0);
+         return true;
++#else
++              return false;
++#endif
+     }
+ 
+     static inline bool isLength2String(void *ptr) {
++#ifdef JS_HAS_STATIC_STRINGS
+         jsuword delta = reinterpret_cast<jsuword>(ptr) -
+                         reinterpret_cast<jsuword>(length2StringTable);
+         if (delta >= NUM_SMALL_CHARS * NUM_SMALL_CHARS * sizeof(JSString))
+@@ -403,9 +422,13 @@ struct JSString
+         /* If ptr points inside the static array, it must be well-aligned. */
+         JS_ASSERT(delta % sizeof(JSString) == 0);
+         return true;
++#else
++              return false;
++#endif
+     }
+ 
+     static inline bool isHundredString(void *ptr) {
++#ifdef JS_HAS_STATIC_STRINGS
+         jsuword delta = reinterpret_cast<jsuword>(ptr) -
+                         reinterpret_cast<jsuword>(hundredStringTable);
+         if (delta >= NUM_HUNDRED_STRINGS * sizeof(JSString))
+@@ -414,6 +437,9 @@ struct JSString
+         /* If ptr points inside the static array, it must be well-aligned. */
+         JS_ASSERT(delta % sizeof(JSString) == 0);
+         return true;
++#else
++              return false;
++#endif
+     }
+ 
+     static inline bool isStatic(void *ptr) {
+@@ -424,6 +450,7 @@ struct JSString
+ #pragma align 8 (__1cIJSStringPunitStringTable_, __1cIJSStringSlength2StringTable_, __1cIJSStringShundredStringTable_)
+ #endif
+ 
++#ifdef JS_HAS_STATIC_STRINGS
+     static const SmallChar INVALID_SMALL_CHAR = -1;
+ 
+     static const jschar fromSmallChar[];
+@@ -436,6 +463,7 @@ struct JSString
+      * strings, we keep a table to map from integer to the correct string.
+      */
+     static const JSString *const intStringTable[];
++#endif
+ 
+     static JSFlatString *unitString(jschar c);
+     static JSLinearString *getUnitString(JSContext *cx, JSString *str, size_t index);
Index: pkgsrc/lang/spidermonkey185/patches/patch-jsstrinlines.h
diff -u /dev/null pkgsrc/lang/spidermonkey185/patches/patch-jsstrinlines.h:1.1
--- /dev/null   Wed May  2 12:42:51 2018
+++ pkgsrc/lang/spidermonkey185/patches/patch-jsstrinlines.h    Wed May  2 12:42:51 2018
@@ -0,0 +1,90 @@
+$NetBSD: patch-jsstrinlines.h,v 1.1 2018/05/02 12:42:51 jperkin Exp $
+
+Implement Debian disable-static-strings-on-ia64.patch fix.
+
+--- jsstrinlines.h.orig        2011-03-31 19:08:36.000000000 +0000
++++ jsstrinlines.h
+@@ -215,52 +215,75 @@ StringBuffer::checkLength(size_t length)
+ inline JSFlatString *
+ JSString::unitString(jschar c)
+ {
++#ifdef JS_HAS_STATIC_STRINGS
+     JS_ASSERT(c < UNIT_STRING_LIMIT);
+     return const_cast<JSString *>(&unitStringTable[c])->assertIsFlat();
++#else
++    JS_NOT_REACHED("no static strings");
++      return NULL;
++#endif
+ }
+ 
+ inline JSLinearString *
+ JSString::getUnitString(JSContext *cx, JSString *str, size_t index)
+ {
+     JS_ASSERT(index < str->length());
++#ifdef JS_HAS_STATIC_STRINGS
+     const jschar *chars = str->getChars(cx);
+     if (!chars)
+         return NULL;
+     jschar c = chars[index];
+     if (c < UNIT_STRING_LIMIT)
+         return unitString(c);
++#endif
+     return js_NewDependentString(cx, str, index, 1);
+ }
+ 
+ inline JSFlatString *
+ JSString::length2String(jschar c1, jschar c2)
+ {
++#ifdef JS_HAS_STATIC_STRINGS
+     JS_ASSERT(fitsInSmallChar(c1));
+     JS_ASSERT(fitsInSmallChar(c2));
+     return const_cast<JSString *> (
+              &length2StringTable[(((size_t)toSmallChar[c1]) << 6) + toSmallChar[c2]]
+            )->assertIsFlat();
++#else
++    JS_NOT_REACHED("no static strings");
++      return NULL;
++#endif
+ }
+ 
+ inline JSFlatString *
+ JSString::length2String(uint32 i)
+ {
++#ifdef JS_HAS_STATIC_STRINGS
+     JS_ASSERT(i < 100);
+     return length2String('0' + i / 10, '0' + i % 10);
++#else
++    JS_NOT_REACHED("no static strings");
++      return NULL;
++#endif
+ }
+ 
+ inline JSFlatString *
+ JSString::intString(jsint i)
+ {
++#ifdef JS_HAS_STATIC_STRINGS
+     jsuint u = jsuint(i);
+     JS_ASSERT(u < INT_STRING_LIMIT);
+     return const_cast<JSString *>(JSString::intStringTable[u])->assertIsFlat();
++#else
++    JS_NOT_REACHED("no static strings");
++      return NULL;
++#endif
+ }
+ 
+ /* Get a static atomized string for chars if possible. */
+ inline JSFlatString *
+ JSString::lookupStaticString(const jschar *chars, size_t length)
+ {
++#ifdef JS_HAS_STATIC_STRINGS
+     if (length == 1) {
+         if (chars[0] < UNIT_STRING_LIMIT)
+             return unitString(chars[0]);
+@@ -290,6 +313,7 @@ JSString::lookupStaticString(const jscha
+                 return intString(i);
+         }
+     }
++#endif
+ 
+     return NULL;
+ }
Index: pkgsrc/lang/spidermonkey185/patches/patch-jstracer.cpp
diff -u /dev/null pkgsrc/lang/spidermonkey185/patches/patch-jstracer.cpp:1.1
--- /dev/null   Wed May  2 12:42:51 2018
+++ pkgsrc/lang/spidermonkey185/patches/patch-jstracer.cpp      Wed May  2 12:42:51 2018
@@ -0,0 +1,57 @@
+$NetBSD: patch-jstracer.cpp,v 1.1 2018/05/02 12:42:51 jperkin Exp $
+
+Implement Debian disable-static-strings-on-ia64.patch fix.
+
+--- jstracer.cpp.orig  2011-03-31 19:08:36.000000000 +0000
++++ jstracer.cpp
+@@ -11505,6 +11505,7 @@ TraceRecorder::callNative(uintN argc, JS
+             }
+             if (vp[1].isString()) {
+                 JSString *str = vp[1].toString();
++#ifdef JS_HAS_STATIC_STRINGS
+                 if (native == js_str_charAt) {
+                     jsdouble i = vp[2].toNumber();
+                     if (JSDOUBLE_IS_NaN(i))
+@@ -11518,7 +11519,9 @@ TraceRecorder::callNative(uintN argc, JS
+                     set(&vp[0], char_ins);
+                     pendingSpecializedNative = IGNORE_NATIVE_CALL_COMPLETE_CALLBACK;
+                     return RECORD_CONTINUE;
+-                } else if (native == js_str_charCodeAt) {
++                } else
++#endif
++                              if (native == js_str_charCodeAt) {
+                     jsdouble i = vp[2].toNumber();
+                     if (JSDOUBLE_IS_NaN(i))
+                       i = 0;
+@@ -12967,6 +12970,7 @@ TraceRecorder::getCharCodeAt(JSString *s
+ JS_STATIC_ASSERT(sizeof(JSString) == 16 || sizeof(JSString) == 32);
+ 
+ 
++#ifdef JS_HAS_STATIC_STRINGS
+ JS_REQUIRES_STACK LIns*
+ TraceRecorder::getUnitString(LIns* str_ins, LIns* idx_ins)
+ {
+@@ -13010,6 +13014,7 @@ TraceRecorder::getCharAt(JSString *str,
+     }
+     return RECORD_CONTINUE;
+ }
++#endif
+ 
+ // Typed array tracing depends on EXPANDED_LOADSTORE and F2I
+ #if NJ_EXPANDED_LOADSTORE_SUPPORTED && NJ_F2I_SUPPORTED
+@@ -13044,6 +13049,7 @@ TraceRecorder::record_JSOP_GETELEM()
+     LIns* obj_ins = get(&lval);
+     LIns* idx_ins = get(&idx);
+ 
++#ifdef JS_HAS_STATIC_STRINGS
+     // Special case for array-like access of strings.
+     if (lval.isString() && hasInt32Repr(idx)) {
+         if (call)
+@@ -13056,6 +13062,7 @@ TraceRecorder::record_JSOP_GETELEM()
+         set(&lval, char_ins);
+         return ARECORD_CONTINUE;
+     }
++#endif
+ 
+     if (lval.isPrimitive())
+         RETURN_STOP_A("JSOP_GETLEM on a primitive");
Index: pkgsrc/lang/spidermonkey185/patches/patch-jstracer.h
diff -u /dev/null pkgsrc/lang/spidermonkey185/patches/patch-jstracer.h:1.1
--- /dev/null   Wed May  2 12:42:51 2018
+++ pkgsrc/lang/spidermonkey185/patches/patch-jstracer.h        Wed May  2 12:42:51 2018
@@ -0,0 +1,19 @@
+$NetBSD: patch-jstracer.h,v 1.1 2018/05/02 12:42:51 jperkin Exp $
+
+Implement Debian disable-static-strings-on-ia64.patch fix.
+
+--- jstracer.h.orig    2011-03-31 19:08:36.000000000 +0000
++++ jstracer.h
+@@ -1394,10 +1394,12 @@ class TraceRecorder
+     JS_REQUIRES_STACK RecordingStatus getCharCodeAt(JSString *str,
+                                                     nanojit::LIns* str_ins, nanojit::LIns* idx_ins,
+                                                     nanojit::LIns** out_ins);
++#ifdef JS_HAS_STATIC_STRINGS
+     JS_REQUIRES_STACK nanojit::LIns* getUnitString(nanojit::LIns* str_ins, nanojit::LIns* idx_ins);
+     JS_REQUIRES_STACK RecordingStatus getCharAt(JSString *str,
+                                                 nanojit::LIns* str_ins, nanojit::LIns* idx_ins,
+                                                 JSOp mode, nanojit::LIns** out_ins);
++#endif
+ 
+     JS_REQUIRES_STACK RecordingStatus initOrSetPropertyByName(nanojit::LIns* obj_ins,
+                                                               Value* idvalp, Value* rvalp,
Index: pkgsrc/lang/spidermonkey185/patches/patch-tracejit_Writer.cpp
diff -u /dev/null pkgsrc/lang/spidermonkey185/patches/patch-tracejit_Writer.cpp:1.1
--- /dev/null   Wed May  2 12:42:51 2018
+++ pkgsrc/lang/spidermonkey185/patches/patch-tracejit_Writer.cpp       Wed May  2 12:42:51 2018
@@ -0,0 +1,25 @@
+$NetBSD: patch-tracejit_Writer.cpp,v 1.1 2018/05/02 12:42:51 jperkin Exp $
+
+Implement Debian disable-static-strings-on-ia64.patch fix.
+
+--- tracejit/Writer.cpp.orig   2011-03-31 19:08:36.000000000 +0000
++++ tracejit/Writer.cpp
+@@ -246,7 +246,9 @@ couldBeObjectOrString(LIns *ins)
+         // ins = andq ins_oprnd1, ins_oprnd2
+         ret = true;
+ #endif
+-    } else if (ins->isop(LIR_addp) &&
++    }
++#ifdef JS_HAS_STATIC_STRINGS
++      else if (ins->isop(LIR_addp) &&
+                ((ins->oprnd1()->isImmP() &&
+                  (void *)ins->oprnd1()->immP() == JSString::unitStringTable) ||
+                 (ins->oprnd2()->isImmP() &&
+@@ -258,6 +260,7 @@ couldBeObjectOrString(LIns *ins)
+         // ins = addp JSString::unitStringTable, ...
+         ret = true;
+     }
++#endif
+ 
+     return ret;
+ }



Home | Main Index | Thread Index | Old Index