<?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>169724</bug_id>
          
          <creation_ts>2017-03-15 17:21:05 -0700</creation_ts>
          <short_desc>WebAssembly: function-tests/load-offset.js fails on ARM64</short_desc>
          <delta_ts>2017-03-16 14:18:20 -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>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>161709</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="JF Bastien">jfbastien</reporter>
          <assigned_to name="Michael Saboff">msaboff</assigned_to>
          <cc>fpizlo</cc>
    
    <cc>jfbastien</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1288370</commentid>
    <comment_count>0</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-03-15 17:21:05 -0700</bug_when>
    <thetext>Segfaults on ARM64, not on x86:

# DYLD_FRAMEWORK_PATH=... lldb .../jsc -- -m --useWebAssembly=1 ./function-tests/load-offset.js ; echo $?
(lldb) r
Process 64578 stopped
* thread #1: tid = 0x5a2002, 0x00000002cca6d860, queue = &apos;com.apple.main-thread&apos;, stop reason = EXC_BAD_ACCESS (code=1, address=0x2c2800004)
    frame #0: 0x00000002cca6d860
-&gt;  0x2cca6d860: ldur   w0, [x1, #4]
    0x2cca6d864: movz   x1, #0xf38
    0x2cca6d868: movk   x1, #0xa0, lsl #16
    0x2cca6d86c: movk   x1, #0x1, lsl #32
(lldb) bt
* thread #1: tid = 0x5a2002, 0x00000002cca6d860, queue = &apos;com.apple.main-thread&apos;, stop reason = EXC_BAD_ACCESS (code=1, address=0x2c2800004)
  * frame #0: 0x00000002cca6d860
    frame #1: 0x00000002cca6d8f4
    frame #2: 0x0000000100861fc8 JavaScriptCore`llintPCRangeStart + 264
    frame #3: 0x0000000100a4bc44 JavaScriptCore`JSC::callWebAssemblyFunction(JSC::ExecState*) + 1620
    frame #4: 0x000000010085fbf4 JavaScriptCore`JSC::LLInt::setUpCall(JSC::ExecState*, JSC::Instruction*, JSC::CodeSpecializationKind, JSC::JSValue, JSC::LLIntCallLinkInfo*) + 384
    frame #5: 0x00000001008688a8 JavaScriptCore`llint_entry + 26392
    frame #6: 0x0000000100861fc8 JavaScriptCore`llintPCRangeStart + 264
    frame #7: 0x00000001006fd9b4 JavaScriptCore`JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 136
    frame #8: 0x00000001006d1278 JavaScriptCore`JSC::Interpreter::execute(JSC::ModuleProgramExecutable*, JSC::ExecState*, JSC::JSModuleEnvironment*) + 468
    frame #9: 0x000000010078d800 JavaScriptCore`JSC::JSModuleRecord::evaluate(JSC::ExecState*) + 60
    frame #10: 0x0000000100789cb8 JavaScriptCore`JSC::JSModuleLoader::evaluate(JSC::ExecState*, JSC::JSValue, JSC::JSValue, JSC::JSValue) + 412
    frame #11: 0x00000002cca50030
    frame #12: 0x0000000100868854 JavaScriptCore`llint_entry + 26308
    frame #13: 0x00000001008688b8 JavaScriptCore`llint_entry + 26408
    frame #14: 0x00000002cca584a0
    frame #15: 0x0000000100861fc8 JavaScriptCore`llintPCRangeStart + 264
    frame #16: 0x00000001006fd9b4 JavaScriptCore`JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 136
    frame #17: 0x00000001006d0aec JavaScriptCore`JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&amp;, JSC::JSValue, JSC::ArgList const&amp;) + 400
    frame #18: 0x0000000100330c60 JavaScriptCore`JSC::profiledCall(JSC::ExecState*, JSC::ProfilingReason, JSC::JSValue, JSC::CallType, JSC::CallData const&amp;, JSC::JSValue, JSC::ArgList const&amp;) + 168
    frame #19: 0x0000000100783628 JavaScriptCore`JSC::JSJobMicrotask::run(JSC::ExecState*) + 400
    frame #20: 0x00000001009f2f58 JavaScriptCore`JSC::VM::drainMicrotasks() + 272
    frame #21: 0x0000000100007b40 jsc`jscmain(int, char**) + 3328
    frame #22: 0x0000000100006e30 jsc`main + 52
    frame #23: 0x0000000182ddd59c libdyld.dylib`start + 4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1288371</commentid>
    <comment_count>1</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-03-15 17:23:40 -0700</bug_when>
    <thetext>
Generated JIT code for WebAssembly function[0] I32 (I32):
    Code at [0x2709b5ba0, 0x2709b5c20):
         0x2709b5ba0:    stp    fp, lr, [sp, #-16]!
         0x2709b5ba4:    mov    fp, sp
         0x2709b5ba8:    movz   x2, #0x0
         0x2709b5bac:    movk   x2, #0x0, lsl #16
         0x2709b5bb0:    movk   x2, #0x0, lsl #32
         0x2709b5bb4:    stur   x2, [fp, #24]
         0x2709b5bb8:    movz   x2, #0x0
         0x2709b5bbc:    stur   x2, [fp, #16]
         0x2709b5bc0:    .long  d53bd062
         0x2709b5bc4:    and    x2, x2, #0xfffffffffffffff8
         0x2709b5bc8:    ldr    x2, [x2, #736]
         0x2709b5bcc:    ubfx   x0, x0, #0, #32
         0x2709b5bd0:    add    x0, x0, #7
         0x2709b5bd4:    cmp    x0, x19
         0x2709b5bd8:    b.hs   0x2709b5bfc
         0x2709b5bdc:    add    x1, x1, x20
         0x2709b5be0:    ldur   w0, [x1, #4]                 &lt;------------- here
         0x2709b5be4:    movz   x1, #0xf38
         0x2709b5be8:    movk   x1, #0xa0, lsl #16
         0x2709b5bec:    movk   x1, #0x1, lsl #32
         0x2709b5bf0:    blr    x1
         0x2709b5bf4:    ldp    fp, lr, [sp], #16
         0x2709b5bf8:    ret    lr
         0x2709b5bfc:    movz   w1, #0x0
         0x2709b5c00:    b      0x2709b1260


x1 is 0x0000000203f00000.
x20 is 0x0000000101700000.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1288580</commentid>
    <comment_count>2</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-03-16 09:47:07 -0700</bug_when>
    <thetext>I may have posted the wrong symptom: the test segfaults when you run it *without* lldb, but when you run it *with* lldb the segfaults w=encountered may be the ones we intentionally generate for trapping out-of-bounds loads.

Therefore, reproducing in lldb requires ignoring all but the last segfault, or teaching the trap handler to be very mad when it doesn&apos;t like where the segfault occurs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1288583</commentid>
    <comment_count>3</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-03-16 09:50:14 -0700</bug_when>
    <thetext>Running lldb with `pro hand -p true -s false -n false SIGSEGV` doesn&apos;t seem to help much :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1288608</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2017-03-16 10:31:47 -0700</bug_when>
    <thetext>I can reproduce this intermittently without JF&apos;s patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1288727</commentid>
    <comment_count>5</comment_count>
      <attachid>304689</attachid>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2017-03-16 14:02:30 -0700</bug_when>
    <thetext>Created attachment 304689
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1288728</commentid>
    <comment_count>6</comment_count>
      <attachid>304689</attachid>
    <who name="Keith Miller">keith_miller</who>
    <bug_when>2017-03-16 14:04:09 -0700</bug_when>
    <thetext>Comment on attachment 304689
Patch

r=me. bug=me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1288731</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Saboff">msaboff</who>
    <bug_when>2017-03-16 14:10:45 -0700</bug_when>
    <thetext>Committed r214068: &lt;http://trac.webkit.org/changeset/214068&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1288735</commentid>
    <comment_count>8</comment_count>
      <attachid>304689</attachid>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2017-03-16 14:18:20 -0700</bug_when>
    <thetext>Comment on attachment 304689
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=304689&amp;action=review

&gt; Source/JavaScriptCore/b3/B3LowerToAir.cpp:2769
&gt;          case WasmAddress: {
&gt;              WasmAddressValue* address = m_value-&gt;as&lt;WasmAddressValue&gt;();
&gt;  
&gt; -            append(Add64, Arg(address-&gt;pinnedGPR()), tmp(address));
&gt; +            append(Add64, Arg(address-&gt;pinnedGPR()), tmp(m_value-&gt;child(0)), tmp(address));
&gt;              return;
&gt;          }

Seems like if the offset is not legal, we should have a legalizeoffsets pass that extracts the offset add into a separate B3 op that can be CSE&apos;d. https://bugs.webkit.org/show_bug.cgi?id=169782</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>304689</attachid>
            <date>2017-03-16 14:02:30 -0700</date>
            <delta_ts>2017-03-16 14:04:09 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>169724.patch</filename>
            <type>text/plain</type>
            <size>1307</size>
            <attacher name="Michael Saboff">msaboff</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09P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jEzOTgw
KQorKysgU291cmNlL0phdmFTY3JpcHRDb3JlL2IzL0IzTG93ZXJUb0Fpci5jcHAJKHdvcmtpbmcg
Y29weSkKQEAgLTI3NjQsNyArMjc2NCw3IEBAIHByaXZhdGU6CiAgICAgICAgIGNhc2UgV2FzbUFk
ZHJlc3M6IHsKICAgICAgICAgICAgIFdhc21BZGRyZXNzVmFsdWUqIGFkZHJlc3MgPSBtX3ZhbHVl
LT5hczxXYXNtQWRkcmVzc1ZhbHVlPigpOwogCi0gICAgICAgICAgICBhcHBlbmQoQWRkNjQsIEFy
ZyhhZGRyZXNzLT5waW5uZWRHUFIoKSksIHRtcChhZGRyZXNzKSk7CisgICAgICAgICAgICBhcHBl
bmQoQWRkNjQsIEFyZyhhZGRyZXNzLT5waW5uZWRHUFIoKSksIHRtcChtX3ZhbHVlLT5jaGlsZCgw
KSksIHRtcChhZGRyZXNzKSk7CiAgICAgICAgICAgICByZXR1cm47CiAgICAgICAgIH0KIAo=
</data>
<flag name="review"
          id="326197"
          type_id="1"
          status="+"
          setter="keith_miller"
    />
          </attachment>
      

    </bug>

</bugzilla>