<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - JS engine completely broken on ia64"
   href="https://bugs.webkit.org/show_bug.cgi?id=129992#c4">Comment # 4</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - JS engine completely broken on ia64"
   href="https://bugs.webkit.org/show_bug.cgi?id=129992">bug 129992</a>
              from <span class="vcard"><a class="email" href="mailto:fpizlo&#64;apple.com" title="Filip Pizlo &lt;fpizlo&#64;apple.com&gt;"> <span class="fn">Filip Pizlo</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=129992#c0">comment #0</a>)
<span class="quote">&gt; Hi,
&gt; 
&gt; Starting up a WebKit-based application, e.g. GNOME Epiphany or Yelp,
&gt; immediately segfaults.
&gt; 
&gt; Back in the WebKit 1.x days, patches for WebKit 1.8.1 on Debian were
&gt; provided to fix JS engine on ia64 [1][2]. Sadly, it seems to me that these
&gt; were never reported/merged upstream. They address three problems in WebKit
&gt; JS engine.
&gt; 
&gt; [1st issue] On ia64, USE(JSVALUE64) is true. From the source code comment,
&gt; JSVALUE64 path uses some sophisticated tricks in order to get everything in
&gt; a 64-bits wide data type. As outlined there, this will work as long the high
&gt; 16-bits of the addresses of any allocated memory are cleared. This is not
&gt; always the case on ia64. A similar issue was fixed on Mozilla JS engine [3].
&gt; Original 01-ia64-wide-ptr patch against WebKit 1.8.1 [4] fixed this issue by
&gt; defining a third JSVALUE64W option that was used on ia64 only. This path
&gt; uses an encapsulated union without any trick for the variant data. As
&gt; outlined by original author, this a portable but the data type is 128-bits
&gt; wide and enabling JIT compiler isn't possible (note that ia64 doesn't have a
&gt; JIT compiler).</span >

You're going to have a really bad time with JSVALUE64W, particularly since it will always be an obscure configuration that nobody uses.  This is especially true since ia64 is effectively dead - it's hard to get help implementing and maintaining a port for unused architectures. I recommend trying to address this problem with a less invasive approach that is less work to implement and less work to maintain.

I suggest teaching our GC to allocate pages in a low memory range where the top 16 address bits are zero. I think that's what Mozilla did. 

You could also have a global variable that contains the global heap offset and turn each access into:

PtrBits = Value &amp; 0xffffffffffff
Ptr = HeapBase + PtrBits

This would still be a big change, so it's preferable to just find the right mmap trick to pin the heap in low memory. 

<span class="quote">&gt; 
&gt; [2nd issue] On ia64, and probably other arches too, caches are not coherent
&gt; automatically. As such fast malloc implementation in
&gt; Source/JavaScriptCore/wtf/FastMalloc.cpp is totally buggy. This was
&gt; work-around by using system malloc instead in ia64-use-system-malloc patch
&gt; [5].</span >

If this is true then you'll need to make lots of other changes in WebKit. WebKit assumes that the memory model is never weaker than what ARM would do. 

<span class="quote">&gt; 
&gt; [3rd issue] On Linux ia64, and probably other arches too, memory pages are
&gt; not necessarily 4K. ia64 can have 4K, 8K, 16K or 64K memory pages. Most
&gt; (all?) Linux ia64 distributions come with 16K memory pages. This was fixed
&gt; in large-mem-page patch [6]. It's my understanding that this issue has also
&gt; been fixed in <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - CopiedSpace::tryAllocateOversize assumes system page size"
   href="show_bug.cgi?id=80615">bug #80615</a>, but I may be wrong.</span >

I doubt that this is an issue anymore. I know we run with different page sizes on different platforms now. 

<span class="quote">&gt; 
&gt; So, we're left with first two issues, unless second issue is no more valid
&gt; nowadays.
&gt; 
&gt; Since original patch author no more wants to invest time on debugging
&gt; WebKit, I've tried to port his work to WebKit 2.2.5, as it's the version
&gt; we're trying to stabilize with GNOME 3.10 on Gentoo. It's not an easy task
&gt; for me as (i) I'm not the original patch author so don't know what he's got
&gt; in mind and (ii) I'm not a WebKit developer at all, so don't know how code
&gt; has evolved or has been refactored since the Webkit 1.x days.
&gt; 
&gt; So, if a kind soul could have a look at the patches I'll post in this
&gt; bugreport and give me advice to get WebKit JS engine fixed on ia64 or
&gt; commonalize this work with other arches (is ia64 the only one using full
&gt; 64-bit data path?), I would be really happy ;-)
&gt; 
&gt;      Ă‰meric
&gt; 
&gt; [1] <a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=642750#96">https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=642750#96</a>
&gt; [2] <a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=694971#5">https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=694971#5</a>
&gt; [3] <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=589735">https://bugzilla.mozilla.org/show_bug.cgi?id=589735</a>
&gt; [4]
&gt; <a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=69;filename=01-ia64-wide">https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=69;filename=01-ia64-wide</a>-
&gt; ptr.patch;att=1;bug=642750
&gt; [5]
&gt; <a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=69;filename=02-ia64-use">https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=69;filename=02-ia64-use</a>-
&gt; system-malloc.patch;att=2;bug=642750
&gt; [6]
&gt; <a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=large-mem-page">https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=large-mem-page</a>.
&gt; patch;att=1;bug=694971</span ></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>