<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>173922</bug_id>
          
          <creation_ts>2017-06-28 07:02:20 -0700</creation_ts>
          <short_desc>Fix the AArch64 build after r218869</short_desc>
          <delta_ts>2017-06-28 10:23:50 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>173700</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=173929</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P1</priority>
          <bug_severity>Blocker</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>108645</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Csaba Osztrogonác">ossy</reporter>
          <assigned_to name="JF Bastien">jfbastien</assigned_to>
          <cc>clopez</cc>
    
    <cc>fpizlo</cc>
    
    <cc>jfbastien</cc>
    
    <cc>mark.lam</cc>
    
    <cc>saam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1323522</commentid>
    <comment_count>0</comment_count>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2017-06-28 07:02:20 -0700</bug_when>
    <thetext>https://trac.webkit.org/changeset/218869 (bug173700) broke the AArch64 build:
https://build.webkit.org/builders/JSCOnly%20Linux%20AArch64%20Release/builds/1126

{standard input}: Assembler messages:
{standard input}:28: Error: unexpected register in the immediate operand at operand 3 -- `subs xzr,x3,sp&apos;
{standard input}:120: Error: unexpected register in the immediate operand at operand 3 -- `subs xzr,x3,sp&apos;

note: I just noticed this build failure, no time and plan to fix it myself.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1323537</commentid>
    <comment_count>1</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-06-28 08:47:37 -0700</bug_when>
    <thetext>I&apos;ll take a look.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1323545</commentid>
    <comment_count>2</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-06-28 09:10:04 -0700</bug_when>
    <thetext>Yeah on ARM64 that second register can&apos;t be SP, because register 31 means ZR here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1323549</commentid>
    <comment_count>3</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-06-28 09:21:43 -0700</bug_when>
    <thetext>I think we want this:

diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
index fd35381d..0fb0254 100644
--- a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
+++ b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
@@ -136,7 +136,7 @@ macro doVMEntry(makeCall)
     addp CallFrameHeaderSlots, t4, t4
     lshiftp 3, t4
     subp sp, t4, t3
-    bpa t3, sp, .throwStackOverflow
+    bibeq sp, t3, .throwStackOverflow
 
     # Ensure that we have enough additional stack capacity for the incoming args,
     # and the frame for the JS code we&apos;re executing. We need to do this check


It still makes the assembler sad though. I think it expects &quot;wsp&quot; and is sad when it just sees &quot;sp&quot;? Looking...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1323558</commentid>
    <comment_count>4</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-06-28 09:27:18 -0700</bug_when>
    <thetext>Ugh this is weird. arm64.rb:arm64Operand can&apos;t return &quot;wsp&quot; for &quot;sp&quot; all the time because other instructions get sad. But manually editing DerivedSources/JavaScriptCore/LLIntAssembly.h to &quot;wsp&quot; in those two spots works. So I can hack up arm64.rb:lowerARM64&apos;s handing for these branch instructions...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1323565</commentid>
    <comment_count>5</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-06-28 09:35:18 -0700</bug_when>
    <thetext>Oh derp, the problem is we&apos;re using w registers instead of x. This should be 64-bit, not 32, and the &quot;sp&quot; is implicitly 64 so no need for &quot;xsp&quot;. Why is are we doing that though? Looking more...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1323567</commentid>
    <comment_count>6</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-06-28 09:39:08 -0700</bug_when>
    <thetext>OK bqbeq is the right thing, since it&apos;s quad. I now know a bit more llint.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1323568</commentid>
    <comment_count>7</comment_count>
      <attachid>314032</attachid>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-06-28 09:42:06 -0700</bug_when>
    <thetext>Created attachment 314032
patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1323571</commentid>
    <comment_count>8</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-06-28 09:46:03 -0700</bug_when>
    <thetext>Another option is to teach all the branches to flip their operands and the condition if the last operand is SP. I&apos;m not sure that&apos;s worth doing in this patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1323572</commentid>
    <comment_count>9</comment_count>
      <attachid>314032</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2017-06-28 09:46:44 -0700</bug_when>
    <thetext>Comment on attachment 314032
patch

this works as a workaround but bpa should also work because p stands for ointer and pointer on 64bit should be quad</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1323573</commentid>
    <comment_count>10</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-06-28 09:47:43 -0700</bug_when>
    <thetext>The patch got reverted, I&apos;ll re-apply it with this fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1323574</commentid>
    <comment_count>11</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-06-28 09:51:19 -0700</bug_when>
    <thetext>Will fix in 173700.

*** This bug has been marked as a duplicate of bug 173700 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>314032</attachid>
            <date>2017-06-28 09:42:06 -0700</date>
            <delta_ts>2017-06-28 09:51:31 -0700</delta_ts>
            <desc>patch</desc>
            <filename>0001-Fix-the-AArch64-build-after-r218869.patch</filename>
            <type>text/plain</type>
            <size>1858</size>
            <attacher name="JF Bastien">jfbastien</attacher>
            
              <data encoding="base64">RnJvbSBlYzcxZDEyYTlhZTEzMDJkMmUwYmFmNTRhNzE1YjcxZDdkYjZhNTMwIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBKRiBCYXN0aWVuIDxqZmJhc3RpZW5AYXBwbGUuY29tPgpEYXRl
OiBXZWQsIDI4IEp1biAyMDE3IDA5OjQxOjM0IC0wNzAwClN1YmplY3Q6IFtQQVRDSF0gRml4IHRo
ZSBBQXJjaDY0IGJ1aWxkIGFmdGVyIHIyMTg4NjkKCi0tLQogU291cmNlL0phdmFTY3JpcHRDb3Jl
L0NoYW5nZUxvZyAgICAgICAgICAgICAgICAgICAgICAgfCAxNCArKysrKysrKysrKysrKwogU291
cmNlL0phdmFTY3JpcHRDb3JlL2xsaW50L0xvd0xldmVsSW50ZXJwcmV0ZXI2NC5hc20gfCAgMiAr
LQogMiBmaWxlcyBjaGFuZ2VkLCAxNSBpbnNlcnRpb25zKCspLCAxIGRlbGV0aW9uKC0pCgpkaWZm
IC0tZ2l0IGEvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZyBiL1NvdXJjZS9KYXZhU2Ny
aXB0Q29y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cnByZXRlcjY0LmFzbSBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9sbGludC9Mb3dMZXZl
bEludGVycHJldGVyNjQuYXNtCmluZGV4IGZkMzUzODFkLi5jODQ5MTA5IDEwMDY0NAotLS0gYS9T
b3VyY2UvSmF2YVNjcmlwdENvcmUvbGxpbnQvTG93TGV2ZWxJbnRlcnByZXRlcjY0LmFzbQorKysg
Yi9Tb3VyY2UvSmF2YVNjcmlwdENvcmUvbGxpbnQvTG93TGV2ZWxJbnRlcnByZXRlcjY0LmFzbQpA
QCAtMTM2LDcgKzEzNiw3IEBAIG1hY3JvIGRvVk1FbnRyeShtYWtlQ2FsbCkKICAgICBhZGRwIENh
bGxGcmFtZUhlYWRlclNsb3RzLCB0NCwgdDQKICAgICBsc2hpZnRwIDMsIHQ0CiAgICAgc3VicCBz
cCwgdDQsIHQzCi0gICAgYnBhIHQzLCBzcCwgLnRocm93U3RhY2tPdmVyZmxvdworICAgIGJxYmVx
IHNwLCB0MywgLnRocm93U3RhY2tPdmVyZmxvdwogCiAgICAgIyBFbnN1cmUgdGhhdCB3ZSBoYXZl
IGVub3VnaCBhZGRpdGlvbmFsIHN0YWNrIGNhcGFjaXR5IGZvciB0aGUgaW5jb21pbmcgYXJncywK
ICAgICAjIGFuZCB0aGUgZnJhbWUgZm9yIHRoZSBKUyBjb2RlIHdlJ3JlIGV4ZWN1dGluZy4gV2Ug
bmVlZCB0byBkbyB0aGlzIGNoZWNrCi0tIAoyLjEwLjEKCg==
</data>
<flag name="review"
          id="334913"
          type_id="1"
          status="+"
          setter="mark.lam"
    />
    <flag name="commit-queue"
          id="334914"
          type_id="3"
          status="-"
          setter="jfbastien"
    />
          </attachment>
      

    </bug>

</bugzilla>