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

Bug#691463: marked as done (unblock: mozjs/1.8.5-1.0.0+dfsg-4)



Your message dated Fri, 02 Nov 2012 20:54:00 +0100
with message-id <509424D8.3050305@thykier.net>
and subject line Re: Bug#691463: unblock: mozjs/1.8.5-1.0.0+dfsg-4
has caused the Debian Bug report #691463,
regarding unblock: mozjs/1.8.5-1.0.0+dfsg-4
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
691463: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=691463
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package mozjs

mozjs is currently non-functional on ia64, which in turn e.g. breaks
gnome-shell on that architecture.

Stephan Schreiber has been debugging this issue and provided two patches
which seemingly fix those issues.

I was able to build mozjs on merulo and successfully run the js command
line interpreter, which simply segfaulted before without those patches.

We also have a confirmation from the original bug reporter that he could
successfully run gnome-shell on ia64. I was actually suprised we had
users running gnome-shell on ia64 :-)

The patches have been reviewed by Chris Coulson.

Full debdiff is attached.

Cheers,
Michael

unblock mozjs/1.8.5-1.0.0+dfsg-4

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru mozjs-1.8.5-1.0.0+dfsg/debian/changelog mozjs-1.8.5-1.0.0+dfsg/debian/changelog
--- mozjs-1.8.5-1.0.0+dfsg/debian/changelog	2012-07-25 15:50:09.000000000 +0200
+++ mozjs-1.8.5-1.0.0+dfsg/debian/changelog	2012-10-25 21:51:10.000000000 +0200
@@ -1,11 +1,20 @@
-mozjs (1.8.5-1.0.0+dfsg-3.1) unstable; urgency=low
+mozjs (1.8.5-1.0.0+dfsg-4) unstable; urgency=low
 
-  * Non-maintainer upload.
+  [ Stephan Schreiber ]
+  * Fix MapPages() to work on ia64
+    - add debian/patches/fix-map-pages-on-ia64.patch
+    - update debian/patches/series
+  * Disable JS static strings on ia64
+    - add debian/patches/disable-static-strings-on-ia64.patch
+    - update debian/patches/series
+  * Closes: #659186
+
+  [ gregor herrmann ]
   * Fix "libmozjs185-dev depends on libffi-dev": add libffi-dev to Depends in
     libmozjs185-dev binary package. Thanks Nicolas Boulenguez.
     (Closes: #678859)
 
- -- gregor herrmann <gregoa@debian.org>  Wed, 25 Jul 2012 15:48:48 +0200
+ -- Chris Coulson <chrisccoulson@ubuntu.com>  Thu, 25 Oct 2012 20:10:45 +0100
 
 mozjs (1.8.5-1.0.0+dfsg-3) unstable; urgency=low
 
diff -Nru mozjs-1.8.5-1.0.0+dfsg/debian/patches/disable-static-strings-on-ia64.patch mozjs-1.8.5-1.0.0+dfsg/debian/patches/disable-static-strings-on-ia64.patch
--- mozjs-1.8.5-1.0.0+dfsg/debian/patches/disable-static-strings-on-ia64.patch	1970-01-01 01:00:00.000000000 +0100
+++ mozjs-1.8.5-1.0.0+dfsg/debian/patches/disable-static-strings-on-ia64.patch	2012-10-25 21:51:11.000000000 +0200
@@ -0,0 +1,603 @@
+From: Stephan Schreiber <info@fs-driver.org>
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=659186
+Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=589735
+Description: Turn off JS static strings on ia64
+
+diff -rp -u8 mozjs-old2/js/src/jsatom.cpp mozjs-1.8.5-1.0.0+dfsg/js/src/jsatom.cpp
+--- mozjs-old2/js/src/jsatom.cpp	2012-10-05 19:03:00.000000000 +0200
++++ mozjs-1.8.5-1.0.0+dfsg/js/src/jsatom.cpp	2012-10-05 19:17:27.000000000 +0200
+@@ -598,21 +598,23 @@ js_AtomizeChars(JSContext *cx, const jsc
+ }
+ 
+ JSAtom *
+ js_GetExistingStringAtom(JSContext *cx, const jschar *chars, size_t length)
+ {
+     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;
+ 
+     JS_LOCK(cx, &state->lock);
+     AtomSet::Ptr p = state->atoms.lookup(str.assertIsFlat());
+     str2 = p ? AtomEntryToKey(*p) : NULL;
+     JS_UNLOCK(cx, &state->lock);
+diff -rp -u8 mozjs-old2/js/src/jsiter.cpp mozjs-1.8.5-1.0.0+dfsg/js/src/jsiter.cpp
+--- mozjs-old2/js/src/jsiter.cpp	2012-10-05 19:03:00.000000000 +0200
++++ mozjs-1.8.5-1.0.0+dfsg/js/src/jsiter.cpp	2012-10-05 19:24:40.000000000 +0200
+@@ -997,19 +997,22 @@ js_IteratorNext(JSContext *cx, JSObject
+             *rval = IdToValue(*ni->current());
+             ni->incCursor();
+ 
+             if (rval->isString())
+                 return true;
+ 
+             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;
+             }
+ 
+             rval->setString(str);
+             return true;
+         }
+diff -rp -u8 mozjs-old2/js/src/jsnum.cpp mozjs-1.8.5-1.0.0+dfsg/js/src/jsnum.cpp
+--- mozjs-old2/js/src/jsnum.cpp	2012-10-05 19:03:00.000000000 +0200
++++ mozjs-1.8.5-1.0.0+dfsg/js/src/jsnum.cpp	2012-10-05 19:29:19.000000000 +0200
+@@ -600,18 +600,20 @@ ToCStringBuf::~ToCStringBuf()
+         js_free(dbuf);
+ }
+ 
+ JSString * JS_FASTCALL
+ 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);
+         JS_ASSERT_IF(si == INT32_MIN, ui == uint32(INT32_MAX) + 1);
+     }
+ 
+     JSCompartment *c = cx->compartment;
+     if (JSString *str = c->dtoaCache.lookup(10, si))
+@@ -1164,23 +1166,25 @@ js_NumberToStringWithBase(JSContext *cx,
+      */
+     if (base < 2 || base > 36)
+         return NULL;
+ 
+     JSCompartment *c = cx->compartment;
+ 
+     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)) {
+             if (i < 10)
+                 return JSString::intString(i);
+             return JSString::unitString(jschar('a' + i - 10));
+         }
++#endif
+ 
+         if (JSString *str = c->dtoaCache.lookup(base, d))
+             return str;
+ 
+         numStr = IntToCString(&cbuf, i, base);
+         JS_ASSERT(!cbuf.dbuf && numStr >= cbuf.sbuf && numStr < cbuf.sbuf + cbuf.sbufSize);
+     } else {
+         if (JSString *str = c->dtoaCache.lookup(base, d))
+diff -rp -u8 mozjs-old2/js/src/jsstr.cpp mozjs-1.8.5-1.0.0+dfsg/js/src/jsstr.cpp
+--- mozjs-old2/js/src/jsstr.cpp	2012-10-05 19:03:00.000000000 +0200
++++ mozjs-1.8.5-1.0.0+dfsg/js/src/jsstr.cpp	2012-10-18 16:27:04.000000000 +0200
+@@ -3116,16 +3116,18 @@ static JSFunctionSpec string_methods[] =
+     JS_FN("blink",             str_blink,             0,0),
+     JS_FN("sup",               str_sup,               0,0),
+     JS_FN("sub",               str_sub,               0,0),
+ #endif
+ 
+     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).
+  * Similary, Rn(k) (for any k and n) generates the list R(k), R(k+1), ..., R(k+2^n-1).
+  * To use this, define R appropriately, then use Rn(0) (for some value of n), then
+  * undefine R.
+  */
+ #define R2(n)  R(n),   R((n) + (1 << 0)),    R((n) + (2 << 0)),    R((n) + (3 << 0))
+@@ -3286,16 +3288,18 @@ const JSString *const JSString::intStrin
+ #undef R6
+ #undef R8
+ #undef R10
+ #undef R12
+ 
+ #undef R3
+ #undef R7
+ 
++#endif  /* defined(JS_HAS_STATIC_STRINGS) */
++
+ JSBool
+ js_String(JSContext *cx, uintN argc, Value *vp)
+ {
+     Value *argv = vp + 2;
+ 
+     JSString *str;
+     if (argc > 0) {
+         str = js_ValueToString(cx, argv[0]);
+@@ -3326,23 +3330,25 @@ str_fromCharCode(JSContext *cx, uintN ar
+     JSString *str;
+ 
+     argv = vp + 2;
+     JS_ASSERT(argc <= JS_ARGS_LENGTH_MAX);
+     if (argc == 1) {
+         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)
+                 return JS_FALSE;
+             vp->setString(str);
+             return JS_TRUE;
+         }
++#endif
+         argv[0].setInt32(code);
+     }
+     chars = (jschar *) cx->malloc((argc + 1) * sizeof(jschar));
+     if (!chars)
+         return JS_FALSE;
+     for (i = 0; i < argc; i++) {
+         uint16_t code;
+         if (!ValueToUint16(cx, argv[i], &code)) {
+@@ -3362,18 +3368,20 @@ str_fromCharCode(JSContext *cx, uintN ar
+ }
+ 
+ #ifdef JS_TRACER
+ static JSString* FASTCALL
+ String_fromCharCode(JSContext* cx, int32 i)
+ {
+     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
+ 
+ JS_DEFINE_TRCINFO_1(str_fromCharCode,
+     (2, (static, STRING_RETRY, String_fromCharCode, CONTEXT, INT32, 1, nanojit::ACCSET_NONE)))
+ 
+ static JSFunctionSpec string_static_methods[] = {
+diff -rp -u8 mozjs-old2/js/src/jsstr.h mozjs-1.8.5-1.0.0+dfsg/js/src/jsstr.h
+--- mozjs-old2/js/src/jsstr.h	2012-10-05 19:03:00.000000000 +0200
++++ mozjs-1.8.5-1.0.0+dfsg/js/src/jsstr.h	2012-10-19 20:45:45.000000000 +0200
+@@ -52,23 +52,33 @@
+ #include "jsapi.h"
+ #include "jsprvtd.h"
+ #include "jshashtable.h"
+ #include "jslock.h"
+ #include "jsobj.h"
+ #include "jsvalue.h"
+ #include "jscell.h"
+ 
++#if !defined(__ia64__)
++/*
++ * 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. */
+     NUM_SMALL_CHARS          = 64U,
+     INT_STRING_LIMIT         = 256U,
+     NUM_HUNDRED_STRINGS      = 156U
+ };
++#endif
+ 
+ extern jschar *
+ js_GetDependentStringChars(JSString *str);
+ 
+ extern JSString * JS_FASTCALL
+ js_ConcatStrings(JSContext *cx, JSString *left, JSString *right);
+ 
+ JS_STATIC_ASSERT(JS_BITS_PER_WORD >= 32);
+@@ -375,72 +385,90 @@ struct JSString
+     JSLinearString *assertIsLinear() {
+         JS_ASSERT(isLinear());
+         return reinterpret_cast<JSLinearString *>(this);
+     }
+ 
+     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))
+             return false;
+ 
+         /* 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))
+             return false;
+ 
+         /* 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))
+             return false;
+ 
+         /* 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) {
+         return isUnitString(ptr) || isLength2String(ptr) || isHundredString(ptr);
+     }
+ 
+ #ifdef __SUNPRO_CC
+ #pragma align 8 (__1cIJSStringPunitStringTable_, __1cIJSStringSlength2StringTable_, __1cIJSStringShundredStringTable_)
+ #endif
+ 
++#ifdef JS_HAS_STATIC_STRINGS
+     static const SmallChar INVALID_SMALL_CHAR = -1;
+ 
+     static const jschar fromSmallChar[];
+     static const SmallChar toSmallChar[];
+     static const JSString unitStringTable[];
+     static const JSString length2StringTable[];
+     static const JSString hundredStringTable[];
+     /*
+      * Since int strings can be unit strings, length-2 strings, or hundred
+      * 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);
+     static JSFlatString *length2String(jschar c1, jschar c2);
+     static JSFlatString *length2String(uint32 i);
+     static JSFlatString *intString(jsint i);
+ 
+     static JSFlatString *lookupStaticString(const jschar *chars, size_t length);
+diff -rp -u8 mozjs-old2/js/src/jsstrinlines.h mozjs-1.8.5-1.0.0+dfsg/js/src/jsstrinlines.h
+--- mozjs-old2/js/src/jsstrinlines.h	2012-10-05 19:03:00.000000000 +0200
++++ mozjs-1.8.5-1.0.0+dfsg/js/src/jsstrinlines.h	2012-10-18 16:27:27.000000000 +0200
+@@ -210,62 +210,85 @@ StringBuffer::checkLength(size_t length)
+     return CheckStringLength(context(), length);
+ }
+ 
+ } /* namespace js */
+ 
+ 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]);
+     }
+ 
+     if (length == 2) {
+         if (fitsInSmallChar(chars[0]) && fitsInSmallChar(chars[1]))
+             return length2String(chars[0], chars[1]);
+@@ -285,16 +308,17 @@ JSString::lookupStaticString(const jscha
+             jsint i = (chars[0] - '0') * 100 +
+                       (chars[1] - '0') * 10 +
+                       (chars[2] - '0');
+ 
+             if (jsuint(i) < INT_STRING_LIMIT)
+                 return intString(i);
+         }
+     }
++#endif
+ 
+     return NULL;
+ }
+ 
+ inline void
+ JSString::finalize(JSContext *cx) {
+     JS_ASSERT(!JSString::isStatic(this));
+     JS_RUNTIME_UNMETER(cx->runtime, liveStrings);
+diff -rp -u8 mozjs-old2/js/src/jstracer.cpp mozjs-1.8.5-1.0.0+dfsg/js/src/jstracer.cpp
+--- mozjs-old2/js/src/jstracer.cpp	2012-10-05 19:03:00.000000000 +0200
++++ mozjs-1.8.5-1.0.0+dfsg/js/src/jstracer.cpp	2012-10-19 20:47:46.000000000 +0200
+@@ -11500,30 +11500,33 @@ TraceRecorder::callNative(uintN argc, JS
+                     LIns* abs_ins = w.name(w.cmovi(isNeg_ins, neg_ins, a), "abs");
+                     set(&vp[0], w.i2d(abs_ins));
+                     pendingSpecializedNative = IGNORE_NATIVE_CALL_COMPLETE_CALLBACK;
+                     return RECORD_CONTINUE;
+                 }
+             }
+             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))
+                       i = 0;
+                     if (i < 0 || i >= str->length())
+                         RETURN_STOP("charAt out of bounds");
+                     LIns* str_ins = get(&vp[1]);
+                     LIns* idx_ins = get(&vp[2]);
+                     LIns* char_ins;
+                     CHECK_STATUS(getCharAt(str, str_ins, idx_ins, mode, &char_ins));
+                     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;
+                     if (i < 0 || i >= str->length())
+                         RETURN_STOP("charCodeAt out of bounds");
+                     LIns* str_ins = get(&vp[1]);
+                     LIns* idx_ins = get(&vp[2]);
+                     LIns* charCode_ins;
+@@ -12962,16 +12965,17 @@ TraceRecorder::getCharCodeAt(JSString *s
+           snapshot(MISMATCH_EXIT));
+     *out = w.i2d(w.getStringChar(str_ins, idx_ins));
+     return RECORD_CONTINUE;
+ }
+ 
+ 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)
+ {
+     LIns *ch_ins = w.getStringChar(str_ins, idx_ins);
+     guard(true, w.ltuiN(ch_ins, UNIT_STRING_LIMIT), MISMATCH_EXIT);
+     return w.addp(w.nameImmpNonGC(JSString::unitStringTable),
+                   w.lshpN(w.ui2p(ch_ins), (sizeof(JSString) == 16) ? 4 : 5));
+ }
+@@ -13005,16 +13009,17 @@ TraceRecorder::getCharAt(JSString *str,
+             LIns *unitstr_ins = getUnitString(str_ins, idx_ins);
+             w.stAlloc(unitstr_ins, phi_ins);
+             w.label(mbr);
+         }
+         *out = w.ldpAlloc(phi_ins);
+     }
+     return RECORD_CONTINUE;
+ }
++#endif
+ 
+ // Typed array tracing depends on EXPANDED_LOADSTORE and F2I
+ #if NJ_EXPANDED_LOADSTORE_SUPPORTED && NJ_F2I_SUPPORTED
+ static bool OkToTraceTypedArrays = true;
+ #else
+ static bool OkToTraceTypedArrays = false;
+ #endif
+ 
+@@ -13039,28 +13044,30 @@ TraceRecorder::record_JSOP_GETELEM()
+     bool call = *cx->regs->pc == JSOP_CALLELEM;
+ 
+     Value& idx = stackval(-1);
+     Value& lval = stackval(-2);
+ 
+     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)
+             RETURN_STOP_A("JSOP_CALLELEM on a string");
+         int i = asInt32(idx);
+         if (size_t(i) >= lval.toString()->length())
+             RETURN_STOP_A("Invalid string index in JSOP_GETELEM");
+         LIns* char_ins;
+         CHECK_STATUS_A(getCharAt(lval.toString(), obj_ins, idx_ins, JSOP_GETELEM, &char_ins));
+         set(&lval, char_ins);
+         return ARECORD_CONTINUE;
+     }
++#endif
+ 
+     if (lval.isPrimitive())
+         RETURN_STOP_A("JSOP_GETLEM on a primitive");
+     RETURN_IF_XML_A(lval);
+ 
+     JSObject* obj = &lval.toObject();
+     if (obj == globalObj)
+         RETURN_STOP_A("JSOP_GETELEM on global");
+diff -rp -u8 mozjs-old2/js/src/jstracer.h mozjs-1.8.5-1.0.0+dfsg/js/src/jstracer.h
+--- mozjs-old2/js/src/jstracer.h	2012-10-05 19:03:00.000000000 +0200
++++ mozjs-1.8.5-1.0.0+dfsg/js/src/jstracer.h	2012-10-05 19:08:15.000000000 +0200
+@@ -1389,20 +1389,22 @@ class TraceRecorder
+                                                                   Value* outp);
+     JS_REQUIRES_STACK RecordingStatus getPropertyWithScriptGetter(JSObject *obj,
+                                                                   nanojit::LIns* obj_ins,
+                                                                   const js::Shape* shape);
+ 
+     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,
+                                                               bool init);
+     JS_REQUIRES_STACK RecordingStatus initOrSetPropertyByIndex(nanojit::LIns* obj_ins,
+                                                                nanojit::LIns* index_ins,
+                                                                Value* rvalp, bool init);
+     JS_REQUIRES_STACK AbortableRecordingStatus setElem(int lval_spindex, int idx_spindex,
+diff -rp -u8 mozjs-old2/js/src/tracejit/Writer.cpp mozjs-1.8.5-1.0.0+dfsg/js/src/tracejit/Writer.cpp
+--- mozjs-old2/js/src/tracejit/Writer.cpp	2012-10-05 19:03:00.000000000 +0200
++++ mozjs-1.8.5-1.0.0+dfsg/js/src/tracejit/Writer.cpp	2012-10-05 19:08:55.000000000 +0200
+@@ -241,28 +241,31 @@ couldBeObjectOrString(LIns *ins)
+                ins->oprnd2()->isImmQ() &&
+                uintptr_t(ins->oprnd2()->immQ()) == JSVAL_PAYLOAD_MASK)
+     {
+         // ins_oprnd1 = ldq ...
+         // ins_oprnd2 = immq JSVAL_PAYLOAD_MASK
+         // 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() &&
+                  (void *)ins->oprnd2()->immP() == JSString::unitStringTable)))
+     {
+         // (String only)
+         // ins = addp ..., JSString::unitStringTable
+         //   OR
+         // ins = addp JSString::unitStringTable, ...
+         ret = true;
+     }
++#endif
+ 
+     return ret;
+ }
+ 
+ static bool
+ isConstPrivatePtr(LIns *ins, unsigned slot)
+ {
+ #if JS_BITS_PER_WORD == 32
+
+
+Signed-off-by: Stephan Schreiber <info@fs-driver.org>
+Based on a work of Luke Wagner <luke@mozilla.com>
diff -Nru mozjs-1.8.5-1.0.0+dfsg/debian/patches/fix-map-pages-on-ia64.patch mozjs-1.8.5-1.0.0+dfsg/debian/patches/fix-map-pages-on-ia64.patch
--- mozjs-1.8.5-1.0.0+dfsg/debian/patches/fix-map-pages-on-ia64.patch	1970-01-01 01:00:00.000000000 +0100
+++ mozjs-1.8.5-1.0.0+dfsg/debian/patches/fix-map-pages-on-ia64.patch	2012-10-25 21:51:11.000000000 +0200
@@ -0,0 +1,76 @@
+From: Stephan Schreiber <info@fs-driver.org>
+Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=659186
+Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=589735
+Description: Fix MapPages() on ia64
+
+diff -rp -u10 mozjs-old1/js/src/jsgcchunk.cpp mozjs-old2/js/src/jsgcchunk.cpp
+--- mozjs-old1/js/src/jsgcchunk.cpp	2012-10-05 18:53:40.000000000 +0200
++++ mozjs-old2/js/src/jsgcchunk.cpp	2012-10-19 20:39:14.000000000 +0200
+@@ -311,29 +311,62 @@ MapAlignedPages(size_t size, size_t alig
+     if (p == MAP_FAILED)
+         return NULL;
+     return p;
+ }
+ 
+ # else /* JS_GC_HAS_MAP_ALIGN */
+ 
+ static void *
+ MapPages(void *addr, size_t size)
+ {
++#if defined(__ia64__)
++    /*
++     * The JS engine assumes that all allocated pointers have their high 17 bits clear,
++     * which ia64's mmap doesn't support directly. However, we can emulate it by passing
++     * mmap an "addr" parameter with those bits clear. The mmap will return that address,
++     * or the nearest available memory above that address, providing a near-guarantee
++     * that those bits are clear. If they are not, we return NULL below to indicate
++     * out-of-memory.
++     * 
++     * The addr is chosen as 0x0000070000000000, which still allows about 120TB of virtual 
++     * address space.
++     * 
++     * See Bug 589735 for more information.
++     */
++#endif
++
+     /*
+      * We don't use MAP_FIXED here, because it can cause the *replacement*
+      * of existing mappings, and we only want to create new mappings.
+      */
++#if defined(__ia64__)
++    void *p = mmap(addr ? addr : (void*)0x0000070000000000,
++                   size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON,
++                   -1, 0);
++#else
+     void *p = mmap(addr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON,
+                    -1, 0);
++#endif
+     if (p == MAP_FAILED)
+         return NULL;
++#if defined(__ia64__)
++    /* 
++     * If the caller requested a specific memory location, verify that's what mmap returned.
++     * Otherwise: If the allocated memory doesn't have its upper 17 bits clear, consider it 
++     * as out of memory.
++     */
++    if (addr && p != addr
++        || !addr && ((long long)p & 0xffff800000000000)) {
++#else
++    /* If the caller requested a specific memory location, verify that's what mmap returned. */
+     if (addr && p != addr) {
++#endif
+         /* We succeeded in mapping memory, but not in the right place. */
+         JS_ALWAYS_TRUE(munmap(p, size) == 0);
+         return NULL;
+     }
+     return p;
+ }
+ 
+ # endif /* !JS_GC_HAS_MAP_ALIGN */
+ 
+ static void
+
+
+Signed-off-by: Stephan Schreiber <info@fs-driver.org>
+Based on a work of Jan Horak <jhorak@redhat.com>
+
diff -Nru mozjs-1.8.5-1.0.0+dfsg/debian/patches/series mozjs-1.8.5-1.0.0+dfsg/debian/patches/series
--- mozjs-1.8.5-1.0.0+dfsg/debian/patches/series	2012-01-25 00:11:56.000000000 +0100
+++ mozjs-1.8.5-1.0.0+dfsg/debian/patches/series	2012-10-25 21:51:11.000000000 +0200
@@ -5,4 +5,6 @@
 Bug-589744-Fallback-to-perf-measurement-stub-when-pe.patch
 64bit-big-endian.patch
 destdir.patch
+fix-map-pages-on-ia64.patch
+disable-static-strings-on-ia64.patch
 autoconf.patch

--- End Message ---
--- Begin Message ---
On 2012-10-26 00:52, Michael Biebl wrote:
> Package: release.debian.org
> Severity: normal
> User: release.debian.org@packages.debian.org
> Usertags: unblock
> 
> Please unblock package mozjs
> 
> mozjs is currently non-functional on ia64, which in turn e.g. breaks
> gnome-shell on that architecture.
> 
> Stephan Schreiber has been debugging this issue and provided two patches
> which seemingly fix those issues.
> 
> I was able to build mozjs on merulo and successfully run the js command
> line interpreter, which simply segfaulted before without those patches.
> 
> We also have a confirmation from the original bug reporter that he could
> successfully run gnome-shell on ia64. I was actually suprised we had
> users running gnome-shell on ia64 :-)
> 
> The patches have been reviewed by Chris Coulson.
> 
> Full debdiff is attached.
> 
> Cheers,
> Michael
> 
> unblock mozjs/1.8.5-1.0.0+dfsg-4
> 
> [...]

Unblocked, thanks.

~Niels

--- End Message ---

Reply to: