<?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>159720</bug_id>
          
          <creation_ts>2016-07-13 08:53:55 -0700</creation_ts>
          <short_desc>[ARM] ASSERTION FAILED: linkBuffer.isValid() in InlineAccess.cpp:291 after r202214 and r203537</short_desc>
          <delta_ts>2017-06-20 02:15:43 -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>Other</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=160157</see_also>
          <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>159408</blocked>
    
    <blocked>159649</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Csaba Osztrogonác">ossy</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>fpizlo</cc>
    
    <cc>jbriance</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>ossy</cc>
    
    <cc>saam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1210454</commentid>
    <comment_count>0</comment_count>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-13 08:53:55 -0700</bug_when>
    <thetext>jsc-stress-results/.tests/cdjs-tests.yaml/cdjs$ ./../../.vm/JavaScriptCore.framework/Resources/jsc main.js

Program received signal SIGSEGV, Segmentation fault.
0xb64880b4 in WTFCrash () at ../../Source/WTF/wtf/Assertions.cpp:323
323	    *(int *)(uintptr_t)0xbbadbeef = 0;
(gdb) bt
#0  0xb64880b4 in WTFCrash () at ../../Source/WTF/wtf/Assertions.cpp:323
#1  0xb5909240 in JSC::InlineAccess::rewireStubAsJump (vm=..., stubInfo=..., target=...)
    at ../../Source/JavaScriptCore/bytecode/InlineAccess.cpp:291
#2  0xb5fc087c in JSC::tryCachePutByID (exec=0xbeffe968, baseValue=..., structure=0xb21a7220, ident=..., slot=..., stubInfo=..., 
    putKind=JSC::NotDirect) at ../../Source/JavaScriptCore/jit/Repatch.cpp:452
#3  0xb5fc0a80 in JSC::repatchPutByID (exec=0xbeffe968, baseValue=..., structure=0xb21a7220, propertyName=..., slot=..., stubInfo=..., 
    putKind=JSC::NotDirect) at ../../Source/JavaScriptCore/jit/Repatch.cpp:463
#4  0xb5f88ca8 in JSC::operationPutByIdNonStrictOptimize (exec=0xbeffe968, stubInfo=0xb258dd80, encodedValue=-18486637472, 
    encodedBase=-18486456960, uid=0xb25aedf8) at ../../Source/JavaScriptCore/jit/JITOperations.cpp:421
#5  0xb27ca8ec in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1210945</commentid>
    <comment_count>1</comment_count>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-14 04:12:00 -0700</bug_when>
    <thetext>InlineAccess.cpp
=================
template &lt;typename Function&gt;
ALWAYS_INLINE static bool linkCodeInline(const char* name, CCallHelpers&amp; jit, StructureStubInfo&amp; stubInfo, const Function&amp; function)
{
    if (jit.m_assembler.buffer().codeSize() &lt;= stubInfo.patch.inlineSize) {
        bool needsBranchCompaction = false;
        LinkBuffer linkBuffer(jit, stubInfo.patch.start.dataLocation(), stubInfo.patch.inlineSize, JITCompilationMustSucceed, needsBranc
hCompaction);
        ASSERT(linkBuffer.isValid()); &lt;=================== BANG!
        function(linkBuffer);
        FINALIZE_CODE(linkBuffer, (&quot;InlineAccessType: &apos;%s&apos;&quot;, name));
        return true;
    }
...

LinkBuffer.h
=============
bool didFailToAllocate() const
{
    return !m_didAllocate;
}

bool isValid() const
{
    return !didFailToAllocate();
}

====
linkBuffer.isValid() is to ensure that LinkBuffer() constructor 
call sets its m_didAllocate member to true, but it isn&apos;t set.

- LinkBuffer::LinkBuffer(...) calls LinkBuffer::linkCode(...)
- LinkBuffer::linkCode(...) calls LinkBuffer::allocate(...)
- LinkBuffer::allocate(...):  initialSize = 12 &gt; m_size = 4
and that&apos;s why allocate returns at the beginning without
allocation and setting m_didAllocate to true.

m_code = 0xb27ca808

Dump of assembler code from 0xb27ca808 to 0xb27ca860:
   0xb27ca808:  b       0xb27ca8b0
   0xb27ca80c:  nop                     ; (mov r0, r0)
   0xb27ca810:  nop                     ; (mov r0, r0)
   0xb27ca814:  nop                     ; (mov r0, r0)
   0xb27ca818:  nop                     ; (mov r0, r0)
   0xb27ca81c:  nop                     ; (mov r0, r0)
   0xb27ca820:  nop                     ; (mov r0, r0)
   0xb27ca824:  nop                     ; (mov r0, r0)
   0xb27ca828:  nop                     ; (mov r0, r0)
   0xb27ca82c:  nop                     ; (mov r0, r0)
   0xb27ca830:  nop                     ; (mov r0, r0)
   0xb27ca834:  nop                     ; (mov r0, r0)
   0xb27ca838:  ldr     r0, [r11, #32]
   0xb27ca83c:  ldr     r1, [r11, #36]  ; 0x24
   0xb27ca840:  tst     sp, #15
   0xb27ca844:  beq     0xb27ca850
   0xb27ca848:  mov     r6, #100        ; 0x64
   0xb27ca84c:  bkpt    0x0000
   0xb27ca850:  mov     sp, r11
   0xb27ca854:  pop     {r11}           ; (ldr r11, [sp], #4)
   0xb27ca858:  pop     {lr}            ; (ldr lr, [sp], #4)
   0xb27ca85c:  bx      lr


I think the assertion is simply incorrect in this case and should be removed.
But I don&apos;t understand exactly the original change, please let me know
if I misunderstood this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1210958</commentid>
    <comment_count>2</comment_count>
      <attachid>283634</attachid>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-14 05:39:04 -0700</bug_when>
    <thetext>Created attachment 283634
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1211298</commentid>
    <comment_count>3</comment_count>
      <attachid>283634</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2016-07-14 18:40:27 -0700</bug_when>
    <thetext>Comment on attachment 283634
Patch

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

&gt; Source/JavaScriptCore/bytecode/InlineAccess.cpp:-291
&gt; -    RELEASE_ASSERT(linkBuffer.isValid());

It doesn&apos;t make sense why this is failing.
We call linkBuffer constructor with initial size equal to jit.m_assembler.buffer().codeSize().

LinkBuffer::allocate() is written like:
void LinkBuffer::allocate(MacroAssembler&amp; macroAssembler, void* ownerUID, JITCompilationEffort effort)
{
    size_t initialSize = macroAssembler.m_assembler.codeSize();
    if (m_code) {
        if (initialSize &gt; m_size)
            return;
        
        size_t nopsToFillInBytes = m_size - initialSize;
        macroAssembler.emitNops(nopsToFillInBytes);
        m_didAllocate = true;
        return;
    }
    ....
--------------------
So this assertion is catching a real bug.
I suspect that it&apos;s something else that&apos;s adding code to the assembler buffer before calling allocate.
Look at ::linkCode():

void LinkBuffer::linkCode(MacroAssembler&amp; macroAssembler, void* ownerUID, JITCompilationEffort effort)
{
#if !ENABLE(BRANCH_COMPACTION)
#if defined(ASSEMBLER_HAS_CONSTANT_POOL) &amp;&amp; ASSEMBLER_HAS_CONSTANT_POOL
    macroAssembler.m_assembler.buffer().flushConstantPool(false);
#endif
    allocate(macroAssembler, ownerUID, effort);
    if (!m_didAllocate)
        return;
    ASSERT(m_code);
    AssemblerBuffer&amp; buffer = macroAssembler.m_assembler.buffer();
#if CPU(ARM_TRADITIONAL)
    macroAssembler.m_assembler.prepareExecutableCopy(m_code);
#endif
    performJITMemcpy(m_code, buffer.data(), buffer.codeSize());
#if CPU(MIPS)
    macroAssembler.m_assembler.relocateJumps(buffer.data(), m_code);
#endif
#elif CPU(ARM_THUMB2)
    copyCompactAndLinkCode&lt;uint16_t&gt;(macroAssembler, ownerUID, effort);
#elif CPU(ARM64)
    copyCompactAndLinkCode&lt;uint32_t&gt;(macroAssembler, ownerUID, effort);
#endif // !ENABLE(BRANCH_COMPACTION)

    m_linkTasks = WTFMove(macroAssembler.m_linkTasks);
}

Maybe it&apos;s the call to prepareExecutableCopy which looks like it&apos;s trying to do some alignment. Or maybe it&apos;s the call to flushConstantPool.

I suspect it&apos;s the alignment. When we&apos;re generating code into an already allocated slot of memory, I suspect it&apos;s incorrect for the linkBuffer
to add more code to it unless it&apos;s certain it won&apos;t overflow the code size it&apos;s inserting into.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214144</commentid>
    <comment_count>4</comment_count>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-25 04:51:03 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; So this assertion is catching a real bug.
&gt; I suspect that it&apos;s something else that&apos;s adding code to the assembler
&gt; buffer before calling allocate.
&gt; Look at ::linkCode():
&gt; 
&gt; void LinkBuffer::linkCode(MacroAssembler&amp; macroAssembler, void* ownerUID,
&gt; JITCompilationEffort effort)
&gt; {
&gt; #if !ENABLE(BRANCH_COMPACTION)
&gt; #if defined(ASSEMBLER_HAS_CONSTANT_POOL) &amp;&amp; ASSEMBLER_HAS_CONSTANT_POOL
&gt;     macroAssembler.m_assembler.buffer().flushConstantPool(false);
&gt; #endif
&gt;     allocate(macroAssembler, ownerUID, effort);
&gt;     if (!m_didAllocate)
&gt;         return;
&gt;     ASSERT(m_code);
&gt;     AssemblerBuffer&amp; buffer = macroAssembler.m_assembler.buffer();
&gt; #if CPU(ARM_TRADITIONAL)
&gt;     macroAssembler.m_assembler.prepareExecutableCopy(m_code);
&gt; #endif
&gt;     performJITMemcpy(m_code, buffer.data(), buffer.codeSize());
&gt; #if CPU(MIPS)
&gt;     macroAssembler.m_assembler.relocateJumps(buffer.data(), m_code);
&gt; #endif
&gt; #elif CPU(ARM_THUMB2)
&gt;     copyCompactAndLinkCode&lt;uint16_t&gt;(macroAssembler, ownerUID, effort);
&gt; #elif CPU(ARM64)
&gt;     copyCompactAndLinkCode&lt;uint32_t&gt;(macroAssembler, ownerUID, effort);
&gt; #endif // !ENABLE(BRANCH_COMPACTION)
&gt; 
&gt;     m_linkTasks = WTFMove(macroAssembler.m_linkTasks);
&gt; }
&gt; 
&gt; Maybe it&apos;s the call to prepareExecutableCopy which looks like it&apos;s trying to
&gt; do some alignment. Or maybe it&apos;s the call to flushConstantPool.
&gt; 
&gt; I suspect it&apos;s the alignment. When we&apos;re generating code into an already
&gt; allocated slot of memory, I suspect it&apos;s incorrect for the linkBuffer
&gt; to add more code to it unless it&apos;s certain it won&apos;t overflow the code size
&gt; it&apos;s inserting into.

I started debugging this issue and I can confirm that flushConstantPool
flushes one constant in this case. Is it incorrect behavior? If yes,
what should we do with this constant? What could be the proper fix?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214147</commentid>
    <comment_count>5</comment_count>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-25 05:12:43 -0700</bug_when>
    <thetext>auto jump = jit.jump();

This line uses constant pool before linkBuffer ctor call.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214149</commentid>
    <comment_count>6</comment_count>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-25 05:15:48 -0700</bug_when>
    <thetext>*** Bug 160157 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214151</commentid>
    <comment_count>7</comment_count>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-25 05:28:26 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; I started debugging this issue and I can confirm that flushConstantPool
&gt; flushes one constant in this case. Is it incorrect behavior? If yes,
&gt; what should we do with this constant? What could be the proper fix?

flushConstantPool call was added here ~ 3 years ago in
https://trac.webkit.org/changeset/157796 .</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214180</commentid>
    <comment_count>8</comment_count>
    <who name="Julien Brianceau">jbriance</who>
    <bug_when>2016-07-25 07:59:31 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; flushConstantPool call was added here ~ 3 years ago in
&gt; https://trac.webkit.org/changeset/157796 .

Actually, flushConstantPool is there for a long time: https://trac.webkit.org/changeset/46057

In https://trac.webkit.org/changeset/157796, I moved its visibility from private to public.

About the assert issue, I have no idea right now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214233</commentid>
    <comment_count>9</comment_count>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-25 10:10:28 -0700</bug_when>
    <thetext>(In reply to comment #6)
&gt; *** Bug 160157 has been marked as a duplicate of this bug. ***

This snippet fixes this assertion mentioned in bug160157
(https://trac.webkit.org/changeset/203537)

     size_t initialSize = macroAssembler.m_assembler.codeSize();
     if (m_code) {
-        if (initialSize &gt; m_size)
+        if (initialSize &gt; m_size) {
+            m_didAllocate = true;
             return;
+        }


Additionally it fixes the assertion caused by r202214 (with enabling ICs 
again and applying other patches from bug159408). But I noticed some
strange crashes (~only 100 tests) when generating IC overwrites unrelated
code with zillion nops.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214244</commentid>
    <comment_count>10</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2016-07-25 10:39:07 -0700</bug_when>
    <thetext>(In reply to comment #9)
&gt; (In reply to comment #6)
&gt; &gt; *** Bug 160157 has been marked as a duplicate of this bug. ***
&gt; 
&gt; This snippet fixes this assertion mentioned in bug160157
&gt; (https://trac.webkit.org/changeset/203537)
&gt; 
&gt;      size_t initialSize = macroAssembler.m_assembler.codeSize();
&gt;      if (m_code) {
&gt; -        if (initialSize &gt; m_size)
&gt; +        if (initialSize &gt; m_size) {
&gt; +            m_didAllocate = true;
&gt;              return;
&gt; +        }
Is this a diff you&apos;re proposing? If so, this is completely wrong.
You&apos;re saying that we succeeded even if the memory we&apos;re overwriting is
not large enough to hold the assembly we generated.

&gt; 
&gt; 
&gt; Additionally it fixes the assertion caused by r202214 (with enabling ICs 
&gt; again and applying other patches from bug159408). But I noticed some
&gt; strange crashes (~only 100 tests) when generating IC overwrites unrelated
&gt; code with zillion nops.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214252</commentid>
    <comment_count>11</comment_count>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-25 10:52:02 -0700</bug_when>
    <thetext>(In reply to comment #10)
&gt; (In reply to comment #9)
&gt; &gt; (In reply to comment #6)
&gt; &gt; &gt; *** Bug 160157 has been marked as a duplicate of this bug. ***
&gt; &gt; 
&gt; &gt; This snippet fixes this assertion mentioned in bug160157
&gt; &gt; (https://trac.webkit.org/changeset/203537)
&gt; &gt; 
&gt; &gt;      size_t initialSize = macroAssembler.m_assembler.codeSize();
&gt; &gt;      if (m_code) {
&gt; &gt; -        if (initialSize &gt; m_size)
&gt; &gt; +        if (initialSize &gt; m_size) {
&gt; &gt; +            m_didAllocate = true;
&gt; &gt;              return;
&gt; &gt; +        }
&gt; Is this a diff you&apos;re proposing? If so, this is completely wrong.
I&apos;m just trying to debug what&apos;s wrong here and found that 
this hack fixed the assertion mentioned in bug160157. 

Could you explain what is the problem with flushConstantPool call
before allocate? 

Your code generates a jump which is and ldr with a constant pool entry 
which will contain the address. The flushConstantPool call flushes it
which makes initialSize bigger than m_size, which makes the assertion hit.

I don&apos;t any idea what would be the proper fix here.
Could you give me some hints?

&gt; You&apos;re saying that we succeeded even if the memory we&apos;re overwriting is
&gt; not large enough to hold the assembly we generated.
I haven&apos;t investigate this overwrite issue yet. I just noticed zillion
generated nops which overwrote a constant pool entry and caused crash.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214257</commentid>
    <comment_count>12</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2016-07-25 10:56:32 -0700</bug_when>
    <thetext>(In reply to comment #11)
&gt; (In reply to comment #10)
&gt; &gt; (In reply to comment #9)
&gt; &gt; &gt; (In reply to comment #6)
&gt; &gt; &gt; &gt; *** Bug 160157 has been marked as a duplicate of this bug. ***
&gt; &gt; &gt; 
&gt; &gt; &gt; This snippet fixes this assertion mentioned in bug160157
&gt; &gt; &gt; (https://trac.webkit.org/changeset/203537)
&gt; &gt; &gt; 
&gt; &gt; &gt;      size_t initialSize = macroAssembler.m_assembler.codeSize();
&gt; &gt; &gt;      if (m_code) {
&gt; &gt; &gt; -        if (initialSize &gt; m_size)
&gt; &gt; &gt; +        if (initialSize &gt; m_size) {
&gt; &gt; &gt; +            m_didAllocate = true;
&gt; &gt; &gt;              return;
&gt; &gt; &gt; +        }
&gt; &gt; Is this a diff you&apos;re proposing? If so, this is completely wrong.
&gt; I&apos;m just trying to debug what&apos;s wrong here and found that 
&gt; this hack fixed the assertion mentioned in bug160157. 
&gt; 
&gt; Could you explain what is the problem with flushConstantPool call
&gt; before allocate? 
&gt; 
&gt; Your code generates a jump which is and ldr with a constant pool entry 
&gt; which will contain the address. The flushConstantPool call flushes it
&gt; which makes initialSize bigger than m_size, which makes the assertion hit.
&gt; 
&gt; I don&apos;t any idea what would be the proper fix here.
&gt; Could you give me some hints?
You need to generate enough code in the inline path so that this is always allowed.
The numbers defined in InlineAccess.h should accommodate this.
How does the constant pool work? What code do we generate for the jump?
Do we plant the jump target in executable memory and do a load relative
to PC or something?

&gt; 
&gt; &gt; You&apos;re saying that we succeeded even if the memory we&apos;re overwriting is
&gt; &gt; not large enough to hold the assembly we generated.
&gt; I haven&apos;t investigate this overwrite issue yet. I just noticed zillion
&gt; generated nops which overwrote a constant pool entry and caused crash.
Interesting. Maybe it&apos;s the fillNops below, though I doubt it. Lets start by
fixing things so we always have enough room to plant a jump in the inline path.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214595</commentid>
    <comment_count>13</comment_count>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-26 11:20:55 -0700</bug_when>
    <thetext>Let&apos;s start again, I try to describe what happens step-by-step.

Source/JavaScriptCore/bytecode/InlineAccess.cpp
================================================
void InlineAccess::rewireStubAsJump(VM&amp; vm, StructureStubInfo&amp; stubInfo, CodeLocationLabel target)
{
    CCallHelpers jit(&amp;vm);

    auto jump = jit.jump();

    // We don&apos;t need a nop sled here because nobody should be jumping into the middle of an IC.
    bool needsBranchCompaction = false;
    LinkBuffer linkBuffer(jit, stubInfo.patch.start.dataLocation(), jit.m_assembler.buffer().codeSize(), JITCompilationMustSucceed, needsBranchCompaction);
    RELEASE_ASSERT(linkBuffer.isValid());     &lt;============== BANG !!!
    linkBuffer.link(jump, target);

    FINALIZE_CODE(linkBuffer, (&quot;InlineAccess: linking constant jump&quot;));
}

Source/JavaScriptCore/assembler/LinkBuffer.cpp
===============================================

void LinkBuffer::linkCode(MacroAssembler&amp; macroAssembler, void* ownerUID, JITCompilationEffort effort)
{
#if !ENABLE(BRANCH_COMPACTION)
#if defined(ASSEMBLER_HAS_CONSTANT_POOL) &amp;&amp; ASSEMBLER_HAS_CONSTANT_POOL
    macroAssembler.m_assembler.buffer().flushConstantPool(false);
#endif
    allocate(macroAssembler, ownerUID, effort);
    if (!m_didAllocate)
        return;
    ASSERT(m_code);
    AssemblerBuffer&amp; buffer = macroAssembler.m_assembler.buffer();
#if CPU(ARM_TRADITIONAL)
    macroAssembler.m_assembler.prepareExecutableCopy(m_code);
#endif
    performJITMemcpy(m_code, buffer.data(), buffer.codeSize());
#if CPU(MIPS)
    macroAssembler.m_assembler.relocateJumps(buffer.data(), m_code);
#endif
#elif CPU(ARM_THUMB2)
    copyCompactAndLinkCode&lt;uint16_t&gt;(macroAssembler, ownerUID, effort);
#elif CPU(ARM64)
    copyCompactAndLinkCode&lt;uint32_t&gt;(macroAssembler, ownerUID, effort);
#endif // !ENABLE(BRANCH_COMPACTION)

    m_linkTasks = WTFMove(macroAssembler.m_linkTasks);
}


void LinkBuffer::allocate(MacroAssembler&amp; macroAssembler, void* ownerUID, JITCompilationEffort effort)
{
    size_t initialSize = macroAssembler.m_assembler.codeSize();
    if (m_code) {
        if (initialSize &gt; m_size)
            return;
        
        size_t nopsToFillInBytes = m_size - initialSize;
        macroAssembler.emitNops(nopsToFillInBytes);
        m_didAllocate = true;
        return;
    }




step 1:
-------
InlineAccess.cpp - InlineAccess::rewireStubAsJump

auto jump = jit.jump();
LinkBuffer linkBuffer(jit, stubInfo.patch.start.dataLocation(), jit.m_assembler.buffer().codeSize(), JITCompilationMustSucceed, needsBranchCompaction);

- create a jump instruction (4 bytes) + an entry in the constant pool.
- call LinkBuffer ctor with codeSize() == 4

step 2:
--------
LinkBuffer.cpp - LinkBuffer::linkCode

- LinkBuffer ctor calls LinkBuffer::linkCode
- flushConstantPool(true) is called

  The jump looks like after flushConstantPool(true):
  --------------------------------------------------------------------------
  0xbeffe5c4:	ldr	pc, [pc]	; 0xbeffe5cc
  0xbeffe5c8:	b	0xbeffe5d0
  0xbeffe5cc:			; &lt;UNDEFINED&gt; instruction: 0xffffffff
  --------------------------------------------------------------------------
  0xbeffe5c4: load the address from the constant pool and then jump to it
  0xbeffe5c8: barrier to jump over the constant pool (true arg of flushConstantPool() )
  0xbeffe5cc: constant pool, the real address will be stored here

- allocate is called, where 
  initialSize = 12 (because flushConstantPool added two more instructions)
  m_size = 4 (because LinkBuffer ctor call get 4 as argument)


    if (m_code) {
        if (initialSize &gt; m_size)
            return;                &lt;======== returns, m_didAllocate isn&apos;t set!
        
        size_t nopsToFillInBytes = m_size - initialSize;
        macroAssembler.emitNops(nopsToFillInBytes);
        m_didAllocate = true;
        return;
    }


step 3:
--------
- linkcode returns next to allocate because m_didAllocate is false

My previous hack which added &quot;m_didAllocate = true;&quot; before the return
let the linkCode continue its work and copy the new IC to the proper place.

My question is still open, what do you think, how should we fix this bug properly? There is enough room for the 12 bytes long jump (ldr, b, constant pool), but rewireStubAsJump doesn&apos;t respect the fact that the jump will be
bigger at the beginning of linkCode() function. We have same problems in
all newly added IC generator function.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214603</commentid>
    <comment_count>14</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2016-07-26 11:36:58 -0700</bug_when>
    <thetext>(In reply to comment #13)
&gt; Let&apos;s start again, I try to describe what happens step-by-step.
&gt; 
&gt; Source/JavaScriptCore/bytecode/InlineAccess.cpp
&gt; ================================================
&gt; void InlineAccess::rewireStubAsJump(VM&amp; vm, StructureStubInfo&amp; stubInfo,
&gt; CodeLocationLabel target)
&gt; {
&gt;     CCallHelpers jit(&amp;vm);
&gt; 
&gt;     auto jump = jit.jump();
&gt; 
&gt;     // We don&apos;t need a nop sled here because nobody should be jumping into
&gt; the middle of an IC.
&gt;     bool needsBranchCompaction = false;
&gt;     LinkBuffer linkBuffer(jit, stubInfo.patch.start.dataLocation(),
&gt; jit.m_assembler.buffer().codeSize(), JITCompilationMustSucceed,
&gt; needsBranchCompaction);
&gt;     RELEASE_ASSERT(linkBuffer.isValid());     &lt;============== BANG !!!
&gt;     linkBuffer.link(jump, target);
&gt; 
&gt;     FINALIZE_CODE(linkBuffer, (&quot;InlineAccess: linking constant jump&quot;));
&gt; }
&gt; 
&gt; Source/JavaScriptCore/assembler/LinkBuffer.cpp
&gt; ===============================================
&gt; 
&gt; void LinkBuffer::linkCode(MacroAssembler&amp; macroAssembler, void* ownerUID,
&gt; JITCompilationEffort effort)
&gt; {
&gt; #if !ENABLE(BRANCH_COMPACTION)
&gt; #if defined(ASSEMBLER_HAS_CONSTANT_POOL) &amp;&amp; ASSEMBLER_HAS_CONSTANT_POOL
&gt;     macroAssembler.m_assembler.buffer().flushConstantPool(false);
&gt; #endif
&gt;     allocate(macroAssembler, ownerUID, effort);
&gt;     if (!m_didAllocate)
&gt;         return;
&gt;     ASSERT(m_code);
&gt;     AssemblerBuffer&amp; buffer = macroAssembler.m_assembler.buffer();
&gt; #if CPU(ARM_TRADITIONAL)
&gt;     macroAssembler.m_assembler.prepareExecutableCopy(m_code);
&gt; #endif
&gt;     performJITMemcpy(m_code, buffer.data(), buffer.codeSize());
&gt; #if CPU(MIPS)
&gt;     macroAssembler.m_assembler.relocateJumps(buffer.data(), m_code);
&gt; #endif
&gt; #elif CPU(ARM_THUMB2)
&gt;     copyCompactAndLinkCode&lt;uint16_t&gt;(macroAssembler, ownerUID, effort);
&gt; #elif CPU(ARM64)
&gt;     copyCompactAndLinkCode&lt;uint32_t&gt;(macroAssembler, ownerUID, effort);
&gt; #endif // !ENABLE(BRANCH_COMPACTION)
&gt; 
&gt;     m_linkTasks = WTFMove(macroAssembler.m_linkTasks);
&gt; }
&gt; 
&gt; 
&gt; void LinkBuffer::allocate(MacroAssembler&amp; macroAssembler, void* ownerUID,
&gt; JITCompilationEffort effort)
&gt; {
&gt;     size_t initialSize = macroAssembler.m_assembler.codeSize();
&gt;     if (m_code) {
&gt;         if (initialSize &gt; m_size)
&gt;             return;
&gt;         
&gt;         size_t nopsToFillInBytes = m_size - initialSize;
&gt;         macroAssembler.emitNops(nopsToFillInBytes);
&gt;         m_didAllocate = true;
&gt;         return;
&gt;     }
&gt; 
&gt; 
&gt; 
&gt; 
&gt; step 1:
&gt; -------
&gt; InlineAccess.cpp - InlineAccess::rewireStubAsJump
&gt; 
&gt; auto jump = jit.jump();
&gt; LinkBuffer linkBuffer(jit, stubInfo.patch.start.dataLocation(),
&gt; jit.m_assembler.buffer().codeSize(), JITCompilationMustSucceed,
&gt; needsBranchCompaction);
&gt; 
&gt; - create a jump instruction (4 bytes) + an entry in the constant pool.
&gt; - call LinkBuffer ctor with codeSize() == 4
&gt; 
&gt; step 2:
&gt; --------
&gt; LinkBuffer.cpp - LinkBuffer::linkCode
&gt; 
&gt; - LinkBuffer ctor calls LinkBuffer::linkCode
&gt; - flushConstantPool(true) is called
&gt; 
&gt;   The jump looks like after flushConstantPool(true):
&gt;   --------------------------------------------------------------------------
&gt;   0xbeffe5c4:	ldr	pc, [pc]	; 0xbeffe5cc
&gt;   0xbeffe5c8:	b	0xbeffe5d0
&gt;   0xbeffe5cc:			; &lt;UNDEFINED&gt; instruction: 0xffffffff
&gt;   --------------------------------------------------------------------------
&gt;   0xbeffe5c4: load the address from the constant pool and then jump to it
&gt;   0xbeffe5c8: barrier to jump over the constant pool (true arg of
&gt; flushConstantPool() )
&gt;   0xbeffe5cc: constant pool, the real address will be stored here
&gt; 
&gt; - allocate is called, where 
&gt;   initialSize = 12 (because flushConstantPool added two more instructions)
&gt;   m_size = 4 (because LinkBuffer ctor call get 4 as argument)
&gt; 
&gt; 
&gt;     if (m_code) {
&gt;         if (initialSize &gt; m_size)
&gt;             return;                &lt;======== returns, m_didAllocate isn&apos;t
&gt; set!
&gt;         
&gt;         size_t nopsToFillInBytes = m_size - initialSize;
&gt;         macroAssembler.emitNops(nopsToFillInBytes);
&gt;         m_didAllocate = true;
&gt;         return;
&gt;     }
&gt; 
&gt; 
&gt; step 3:
&gt; --------
&gt; - linkcode returns next to allocate because m_didAllocate is false
&gt; 
&gt; My previous hack which added &quot;m_didAllocate = true;&quot; before the return
&gt; let the linkCode continue its work and copy the new IC to the proper place.
&gt; 
&gt; My question is still open, what do you think, how should we fix this bug
&gt; properly? There is enough room for the 12 bytes long jump (ldr, b, constant
&gt; pool), but rewireStubAsJump doesn&apos;t respect the fact that the jump will be
&gt; bigger at the beginning of linkCode() function. We have same problems in
&gt; all newly added IC generator function.

I see. I think the problem here is that LinkBuffer will actually grow the code size after
it&apos;s passed an assembler. What we want, logically, is to have flushConstantPool() to be
called before we pass in the assembler to LinkBuffer (the best way to accomplish this I&apos;m not sure).
Ans then we want to assert that the assembler buffer size after flushConstantPool() was called
is &lt;= the inline size reserved by StructureStubInfo.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1214867</commentid>
    <comment_count>15</comment_count>
      <attachid>284690</attachid>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-27 06:33:34 -0700</bug_when>
    <thetext>Created attachment 284690
Patch

It seems it fixes the assertion for me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1215178</commentid>
    <comment_count>16</comment_count>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-28 02:08:14 -0700</bug_when>
    <thetext>ping?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1215214</commentid>
    <comment_count>17</comment_count>
      <attachid>284778</attachid>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-28 05:12:03 -0700</bug_when>
    <thetext>Created attachment 284778
Patch

updated after r203786, unfortunately now everything crashes, see bug160291 for details</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1215231</commentid>
    <comment_count>18</comment_count>
      <attachid>284778</attachid>
    <who name="Saam Barati">saam</who>
    <bug_when>2016-07-28 08:46:25 -0700</bug_when>
    <thetext>Comment on attachment 284778
Patch

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

&gt; Source/JavaScriptCore/jit/JITMathIC.h:127
&gt; +            jit.m_assembler.buffer().flushConstantPool();

This is not all you want here. You want to make sure all the fast paths leave enough space for a constant pool flush.
If you look elsewhere in this file, you&apos;ll see we refer to maxJumpSize (I forget the exact name).
We&apos;d want something similar for this. Can we reliably predict the size of the constant pool of a single jump?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1215517</commentid>
    <comment_count>19</comment_count>
    <who name="Csaba Osztrogonác">ossy</who>
    <bug_when>2016-07-29 01:14:19 -0700</bug_when>
    <thetext>(In reply to comment #18)
&gt; Comment on attachment 284778 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=284778&amp;action=review
&gt; 
&gt; &gt; Source/JavaScriptCore/jit/JITMathIC.h:127
&gt; &gt; +            jit.m_assembler.buffer().flushConstantPool();
&gt; 
&gt; This is not all you want here. You want to make sure all the fast paths
&gt; leave enough space for a constant pool flush.
&gt; If you look elsewhere in this file, you&apos;ll see we refer to maxJumpSize (I
&gt; forget the exact name).
&gt; We&apos;d want something similar for this. 

I found that MacroAssembler::maxJumpReplacementSize() - inlineSize nops
are added in generateInline() :
https://trac.webkit.org/browser/trunk/Source/JavaScriptCore/jit/JITMathIC.h#L88

But I have no clue how many nops should be added and where.
I really don&apos;t understand what this generateOutOfLine does and why. :-/

&gt; Can we reliably predict the size of the constant pool of a single jump?
I don&apos;t think so. Normally a jump could be an ldr + a branch + a constant
(3 machine word, 3x4 = 12 bytes) But we can&apos;t determine how many constants
are flushed. Constant pool are flushed if it is full or if it is triggered
explicitly. Sometimes a flush call flushes hundreds constants belong to
the previous couple opcodes. It is exactly what happens in bug160295.

It seems the existance of constant pool and this new IC generating mechanism
aren&apos;t compatible fundamentally. It would be great to find a way how to fix
these issues. 

Maybe we should make the ARM traditional assembler somehow not to use
constant pool for IC jumps, but movw+mowt+branch. But I don&apos;t know if
other instructions in IC codes need constant pool or not. Additionally
we should force flush the constant pool somehow before all IC generation:
bug160295.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>283634</attachid>
            <date>2016-07-14 05:39:04 -0700</date>
            <delta_ts>2016-07-27 06:33:26 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-159720-20160714053817.patch</filename>
            <type>text/plain</type>
            <size>1643</size>
            <attacher name="Csaba Osztrogonác">ossy</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjAzMjIzCmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlw
dENvcmUvQ2hhbmdlTG9nIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwppbmRleCBh
ZWM5M2I2MTEyM2IyNzk4NWI2MjNhOTVhOGFhY2JkN2I5NzUwNGIzLi5hZmJlMzQ2ZGRmYTc0NDJi
OWM3OTQyYmU5YzI5ODYxZTFiNWU3NmExIDEwMDY0NAot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tLSBhL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9ieXRlY29kZS9Jbmxp
bmVBY2Nlc3MuY3BwCisrKyBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9ieXRlY29kZS9JbmxpbmVB
Y2Nlc3MuY3BwCkBAIC0yODgsNyArMjg4LDYgQEAgdm9pZCBJbmxpbmVBY2Nlc3M6OnJld2lyZVN0
dWJBc0p1bXAoVk0mIHZtLCBTdHJ1Y3R1cmVTdHViSW5mbyYgc3R1YkluZm8sIENvZGVMb2MKICAg
ICAvLyBXZSBkb24ndCBuZWVkIGEgbm9wIHNsZWQgaGVyZSBiZWNhdXNlIG5vYm9keSBzaG91bGQg
YmUganVtcGluZyBpbnRvIHRoZSBtaWRkbGUgb2YgYW4gSUMuCiAgICAgYm9vbCBuZWVkc0JyYW5j
aENvbXBhY3Rpb24gPSBmYWxzZTsKICAgICBMaW5rQnVmZmVyIGxpbmtCdWZmZXIoaml0LCBzdHVi
SW5mby5wYXRjaC5zdGFydC5kYXRhTG9jYXRpb24oKSwgaml0Lm1fYXNzZW1ibGVyLmJ1ZmZlcigp
LmNvZGVTaXplKCksIEpJVENvbXBpbGF0aW9uTXVzdFN1Y2NlZWQsIG5lZWRzQnJhbmNoQ29tcGFj
dGlvbik7Ci0gICAgUkVMRUFTRV9BU1NFUlQobGlua0J1ZmZlci5pc1ZhbGlkKCkpOwogICAgIGxp
bmtCdWZmZXIubGluayhqdW1wLCB0YXJnZXQpOwogCiAgICAgRklOQUxJWkVfQ09ERShsaW5rQnVm
ZmVyLCAoIklubGluZUFjY2VzczogbGlua2luZyBjb25zdGFudCBqdW1wIikpOwo=
</data>

          </attachment>
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>284690</attachid>
            <date>2016-07-27 06:33:34 -0700</date>
            <delta_ts>2016-07-28 05:11:56 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-159720-20160727063223.patch</filename>
            <type>text/plain</type>
            <size>3270</size>
            <attacher name="Csaba Osztrogonác">ossy</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjAzNzcyCmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlw
dENvcmUvQ2hhbmdlTG9nIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwppbmRleCBk
YzZhOTk0N2NmMWExNjVkNGJhOTM4MjllNzVlYzU1N2I2YjU1MmNlLi5jYzhlYjUxODE5ZDQ1ZWY5
ZTViOTM4YmUzMGMyYWVjY2JkMDcwZmJkIDEwMDY0NAotLS0gYS9Tb3VyY2UvSmF2YVNjcmlwdENv
cmUvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKQEAgLTEs
MyArMSwxNyBAQAorMjAxNi0wNy0yNyAgQ3NhYmEgT3N6dHJvZ29uw6FjICA8b3NzeUB3ZWJraXQu
b3JnPgorCisgICAgICAgIFtBUk1dIEFTU0VSVElPTiBGQUlMRUQ6IGxpbmtCdWZmZXIuaXNWYWxp
ZCgpIGluIElubGluZUFjY2Vzcy5jcHA6MjkxIGFmdGVyIHIyMDIyMTQgYW5kIHIyMDM1MzcKKyAg
ICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTE1OTcyMAorCisg
ICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgICogYXNzZW1ibGVy
L0xpbmtCdWZmZXIuY3BwOgorICAgICAgICAoSlNDOjpMaW5rQnVmZmVyOjpsaW5rQ29kZSk6Cisg
ICAgICAgICogYnl0ZWNvZGUvSW5saW5lQWNjZXNzLmNwcDoKKyAgICAgICAgKEpTQzo6SW5saW5l
QWNjZXNzOjpyZXdpcmVTdHViQXNKdW1wKToKKyAgICAgICAgKiBqaXQvSklUTWF0aElDLmg6Cisg
ICAgICAgIChKU0M6OkpJVE1hdGh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gICAgICAgICAgICBib29s
IG5lZWRzQnJhbmNoQ29tcGFjdGlvbiA9IGZhbHNlOwogICAgICAgICAgICAgUkVMRUFTRV9BU1NF
UlQoaml0Lm1fYXNzZW1ibGVyLmJ1ZmZlcigpLmNvZGVTaXplKCkgPD0gc3RhdGljX2Nhc3Q8c2l6
ZV90PihtX2lubGluZVNpemUpKTsK
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>284778</attachid>
            <date>2016-07-28 05:12:03 -0700</date>
            <delta_ts>2016-07-28 08:46:25 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-159720-20160728051050.patch</filename>
            <type>text/plain</type>
            <size>3387</size>
            <attacher name="Csaba Osztrogonác">ossy</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjAzODE3CmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlw
dENvcmUvQ2hhbmdlTG9nIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwppbmRleCAw
ZTM0Nzk1Mzg4NmNmZGMyNTQwMjEzZDQxOTZmMWVlMTdjMmQzOTYwLi43YTUyYzM2MDUxMTU1ODlk
MjRkMzJhMjVhZWRhNzVkNWI3YWZjYmQ4IDEwMDY0NAotLS0gYS9Tb3VyY2UvSmF2YVNjcmlwdENv
cmUvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKQEAgLTEs
NSArMSwxOSBAQAogMjAxNi0wNy0yOCAgQ3NhYmEgT3N6dHJvZ29uw6FjICA8b3NzeUB3ZWJraXQu
b3JnPgogCisgICAgICAgIFtBUk1dIEFTU0VSVElPTiBGQUlMRUQ6IGxpbmtCdWZmZXIuaXNWYWxp
ZCgpIGluIElubGluZUFjY2Vzcy5jcHA6MjkxIGFmdGVyIHIyMDIyMTQgYW5kIHIyMDM1MzcKKyAg
ICAgICAgaHR0cH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AIC0xMjIsNiArMTIyLDExIEBAIHB1YmxpYzoK
ICAgICAgICAgYXV0byBsaW5rSnVtcFRvT3V0T2ZMaW5lU25pcHBldCA9IFsmXSAoKSB7CiAgICAg
ICAgICAgICBDQ2FsbEhlbHBlcnMgaml0KCZ2bSwgY29kZUJsb2NrKTsKICAgICAgICAgICAgIGF1
dG8ganVtcCA9IGppdC5qdW1wKCk7CisKKyNpZiBkZWZpbmVkKEFTU0VNQkxFUl9IQVNfQ09OU1RB
TlRfUE9PTCkgJiYgQVNTRU1CTEVSX0hBU19DT05TVEFOVF9QT09MCisgICAgICAgICAgICBqaXQu
bV9hc3NlbWJsZXIuYnVmZmVyKCkuZmx1c2hDb25zdGFudFBvb2woKTsKKyNlbmRpZgorCiAgICAg
ICAgICAgICAvLyBXZSBkb24ndCBuZWVkIGEgbm9wIHNsZWQgaGVyZSBiZWNhdXNlIG5vYm9keSBz
aG91bGQgYmUganVtcGluZyBpbnRvIHRoZSBtaWRkbGUgb2YgYW4gSUMuCiAgICAgICAgICAgICBi
b29sIG5lZWRzQnJhbmNoQ29tcGFjdGlvbiA9IGZhbHNlOwogICAgICAgICAgICAgUkVMRUFTRV9B
U1NFUlQoaml0Lm1fYXNzZW1ibGVyLmJ1ZmZlcigpLmNvZGVTaXplKCkgPD0gc3RhdGljX2Nhc3Q8
c2l6ZV90PihtX2lubGluZVNpemUpKTsK
</data>
<flag name="review"
          id="308431"
          type_id="1"
          status="-"
          setter="saam"
    />
          </attachment>
      

    </bug>

</bugzilla>