<?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>172767</bug_id>
          
          <creation_ts>2017-05-31 12:08:19 -0700</creation_ts>
          <short_desc>[JSC][ARMv6] Fix ARMv6 JIT support</short_desc>
          <delta_ts>2017-07-12 11:15:24 -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>NEW</bug_status>
          <resolution></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>108645</blocked>
    
    <blocked>172765</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Caio Lima">ticaiolima</reporter>
          <assigned_to name="Caio Lima">ticaiolima</assigned_to>
          <cc>buildbot</cc>
    
    <cc>fpizlo</cc>
    
    <cc>guijemont</cc>
    
    <cc>jacob.bramley+webkit</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>1314254</commentid>
    <comment_count>0</comment_count>
    <who name="Caio Lima">ticaiolima</who>
    <bug_when>2017-05-31 12:08:19 -0700</bug_when>
    <thetext>...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1314269</commentid>
    <comment_count>1</comment_count>
      <attachid>311619</attachid>
    <who name="Caio Lima">ticaiolima</who>
    <bug_when>2017-05-31 12:30:52 -0700</bug_when>
    <thetext>Created attachment 311619
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1314271</commentid>
    <comment_count>2</comment_count>
    <who name="Build Bot">buildbot</who>
    <bug_when>2017-05-31 12:32:37 -0700</bug_when>
    <thetext>Attachment 311619 did not pass style-queue:


ERROR: Source/JavaScriptCore/assembler/ARMAssembler.h:218:  enum members should use InterCaps with an initial capital letter or initial &apos;k&apos; for C-style enums.  [readability/enum_casing] [4]
Total errors found: 1 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1316531</commentid>
    <comment_count>3</comment_count>
      <attachid>311619</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2017-06-07 10:28:23 -0700</bug_when>
    <thetext>Comment on attachment 311619
Patch

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

&gt; Source/JavaScriptCore/assembler/ARMAssembler.h:218
&gt; +            // mcr     15, 0, r6, cr7, cr10, {5}
&gt; +            ARM6_MEMFENCE = 0xee076fba,

I think this may not be correct.  Someone who knows ARM better should take a closer look.  Here&apos;s why:

1. The instruction you&apos;re replacing is DMBSY.
    The spec for DMBSY (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0646a/BABDFABI.html) says:
    &quot;DMB acts as a data memory barrier. It ensures that all explicit memory accesses that appear, in program order, before the DMB instruction are completed before any explicit memory accesses that appear, in program order, after the DMB instruction. DMB does not affect the ordering or execution of instructions that do not access memory.&quot;
    Specifically, it ensures that memory access are completed in program order.

2. You&apos;re replacing it with &quot;mcr 15, 0, r6, cr7, cr10, {5}&quot;.
    The spec for MCR (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/I1014942.html) says:
    &quot;... As such, DMB ensures the apparent order of the explicit memory operations before and after the DMB instruction, but does not ensure the completion of those memory operations.&quot;

    I suspect what you really want is a &quot;Data Synchronization Barrier&quot;, but I&apos;m not certain.  Someone who knows better needs to review this.

Also, you picked r6 for the &lt;Rd&gt; argument in the instruction.  What&apos;s the reason for this?  It&apos;s not clear from the spec what &lt;Rd&gt; is for in terms of the &quot;Data Memory Barrier&quot; or &quot;Data Synchronization Barrier&quot;.  Maybe it doesn&apos;t matter, but someone who knows traditional ARM better should review this.

&gt; Source/JavaScriptCore/jit/RegisterSet.cpp:163
&gt; +#elif CPU(ARM)
&gt; +    result.set(ARMRegisters::r4);
&gt; +    result.set(ARMRegisters::r5);
&gt; +    result.set(ARMRegisters::r6);
&gt; +    result.set(ARMRegisters::r7);
&gt; +    result.set(ARMRegisters::r8);
&gt; +    result.set(ARMRegisters::r9);
&gt; +    result.set(ARMRegisters::r10);

There&apos;s already a section for CPU(ARM_TRADITIONAL) above.  This is not needed.  Please remove and remember to update your ChangeLog.

Also, I think this set is incomplete.  https://stackoverflow.com/questions/261419/arm-to-c-calling-convention-registers-to-save says the callee saved regs are r4-r8, r9 (possibly), and r10-r11.  Your new set is missing r11.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1319124</commentid>
    <comment_count>4</comment_count>
      <attachid>311619</attachid>
    <who name="Caio Lima">ticaiolima</who>
    <bug_when>2017-06-14 08:16:47 -0700</bug_when>
    <thetext>Comment on attachment 311619
Patch

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

Thank you for the review

&gt;&gt; Source/JavaScriptCore/assembler/ARMAssembler.h:218
&gt;&gt; +            ARM6_MEMFENCE = 0xee076fba,
&gt; 
&gt; I think this may not be correct.  Someone who knows ARM better should take a closer look.  Here&apos;s why:
&gt; 
&gt; 1. The instruction you&apos;re replacing is DMBSY.
&gt;     The spec for DMBSY (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0646a/BABDFABI.html) says:
&gt;     &quot;DMB acts as a data memory barrier. It ensures that all explicit memory accesses that appear, in program order, before the DMB instruction are completed before any explicit memory accesses that appear, in program order, after the DMB instruction. DMB does not affect the ordering or execution of instructions that do not access memory.&quot;
&gt;     Specifically, it ensures that memory access are completed in program order.
&gt; 
&gt; 2. You&apos;re replacing it with &quot;mcr 15, 0, r6, cr7, cr10, {5}&quot;.
&gt;     The spec for MCR (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/I1014942.html) says:
&gt;     &quot;... As such, DMB ensures the apparent order of the explicit memory operations before and after the DMB instruction, but does not ensure the completion of those memory operations.&quot;
&gt; 
&gt;     I suspect what you really want is a &quot;Data Synchronization Barrier&quot;, but I&apos;m not certain.  Someone who knows better needs to review this.
&gt; 
&gt; Also, you picked r6 for the &lt;Rd&gt; argument in the instruction.  What&apos;s the reason for this?  It&apos;s not clear from the spec what &lt;Rd&gt; is for in terms of the &quot;Data Memory Barrier&quot; or &quot;Data Synchronization Barrier&quot;.  Maybe it doesn&apos;t matter, but someone who knows traditional ARM better should review this.

Yes. I was researching about your questions and I&apos;m not able to give you 100% of certain about them, so I just pinged the original authors of the Patch and they are going to give clarifications here soon.

One thing that I noticed between DSB and DMB in ARM11 is that instructions after DSB don&apos;t execute until it finishes. If I didn&apos;t misunderstood, &quot;dmb sy&quot;doesn&apos;t impose it and the code is more performant in practice. Following the ARM spec, It seems that we probably don&apos;t have a &quot;dmb sy&quot; equivalent instruction into ARM11 and we will probably need to choose which one is better.

&gt;&gt; Source/JavaScriptCore/jit/RegisterSet.cpp:163
&gt;&gt; +    result.set(ARMRegisters::r10);
&gt; 
&gt; There&apos;s already a section for CPU(ARM_TRADITIONAL) above.  This is not needed.  Please remove and remember to update your ChangeLog.
&gt; 
&gt; Also, I think this set is incomplete.  https://stackoverflow.com/questions/261419/arm-to-c-calling-convention-registers-to-save says the callee saved regs are r4-r8, r9 (possibly), and r10-r11.  Your new set is missing r11.

Ok.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1321653</commentid>
    <comment_count>5</comment_count>
      <attachid>311619</attachid>
    <who name="Guillaume Emont">guijemont</who>
    <bug_when>2017-06-21 15:27:56 -0700</bug_when>
    <thetext>Comment on attachment 311619
Patch

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

&gt;&gt;&gt; Source/JavaScriptCore/assembler/ARMAssembler.h:218
&gt;&gt;&gt; +            ARM6_MEMFENCE = 0xee076fba,
&gt;&gt; 
&gt;&gt; I think this may not be correct.  Someone who knows ARM better should take a closer look.  Here&apos;s why:
&gt;&gt; 
&gt;&gt; 1. The instruction you&apos;re replacing is DMBSY.
&gt;&gt;     The spec for DMBSY (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0646a/BABDFABI.html) says:
&gt;&gt;     &quot;DMB acts as a data memory barrier. It ensures that all explicit memory accesses that appear, in program order, before the DMB instruction are completed before any explicit memory accesses that appear, in program order, after the DMB instruction. DMB does not affect the ordering or execution of instructions that do not access memory.&quot;
&gt;&gt;     Specifically, it ensures that memory access are completed in program order.
&gt;&gt; 
&gt;&gt; 2. You&apos;re replacing it with &quot;mcr 15, 0, r6, cr7, cr10, {5}&quot;.
&gt;&gt;     The spec for MCR (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/I1014942.html) says:
&gt;&gt;     &quot;... As such, DMB ensures the apparent order of the explicit memory operations before and after the DMB instruction, but does not ensure the completion of those memory operations.&quot;
&gt;&gt; 
&gt;&gt;     I suspect what you really want is a &quot;Data Synchronization Barrier&quot;, but I&apos;m not certain.  Someone who knows better needs to review this.
&gt;&gt; 
&gt;&gt; Also, you picked r6 for the &lt;Rd&gt; argument in the instruction.  What&apos;s the reason for this?  It&apos;s not clear from the spec what &lt;Rd&gt; is for in terms of the &quot;Data Memory Barrier&quot; or &quot;Data Synchronization Barrier&quot;.  Maybe it doesn&apos;t matter, but someone who knows traditional ARM better should review this.
&gt; 
&gt; Yes. I was researching about your questions and I&apos;m not able to give you 100% of certain about them, so I just pinged the original authors of the Patch and they are going to give clarifications here soon.
&gt; 
&gt; One thing that I noticed between DSB and DMB in ARM11 is that instructions after DSB don&apos;t execute until it finishes. If I didn&apos;t misunderstood, &quot;dmb sy&quot;doesn&apos;t impose it and the code is more performant in practice. Following the ARM spec, It seems that we probably don&apos;t have a &quot;dmb sy&quot; equivalent instruction into ARM11 and we will probably need to choose which one is better.

Original author of the patch here, sorry for the delay.

Regarding difference of DMB/DSB: I think the wording &quot;but does not ensure the completion of those memory operations.&quot; means that the previous memory operations are not guaranteed to finish before the MCR finishes, but it provides a guarantee that they will be finished before other memory accesses after the MCR. My impression is that this second guarantee is enough for our needs, but I cannot claim I understand all the (present and future) uses of memoryBarrier in JavaScriptCore, so it could be good to have somebody else (not sure whom) weigh in on what are the needs here.

Also, we do have a Data Synchronisation Barrier similar to DMB SY: it&apos;s the same instruction, but with cr7, cr10, {4}, though in that case I think the register passed has a meaning, which I don&apos;t fully understand.

Regarding the use of $r6, my understanding from the documentation is that it is not modified, and I could confirm that on my device with gdb, so I just picked a random register.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1322835</commentid>
    <comment_count>6</comment_count>
    <who name="Caio Lima">ticaiolima</who>
    <bug_when>2017-06-26 08:07:29 -0700</bug_when>
    <thetext>Hi all, here are some updates that I&apos;ve got in a new round of research.

I&apos;ve found the following reference of ARM11:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0301h/Babhejba.html

&quot;The purpose of the Data Memory Barrier operation is to ensure that all outstanding explicit memory transactions complete before any following explicit memory transactions begin. This ensures that data in memory is up to date before any memory transaction that depends on it.&quot;

Also, we can check the last ARMv6-M Arch Reference (http://infocenter.arm.com/help/topic/com.arm.doc.ddi0419d/DDI0419D_armv6m_arm.pdf) the following statement in page A3-59:

&quot;The DMB instruction is a data memory barrier. DMB exhibits the following behavior:
- All explicit memory accesses by instructions occurring in program order before this instruction are globally observed before any explicit memory accesses because of instructions occurring in program order after this instruction are observed.
- The DMB instruction has no effect on the ordering of other instructions executing on the processor.
As such, DMB ensures the apparent order of the explicit memory operations before and after the instruction, without
ensuring their completion. For details on the DMB instruction, see DMB on page A6-121.&quot;

In the same manual, we can find at page A3-57:

&quot;For all memory, a read or write is defined to be complete when it is globally observed:
- A branch predictor maintenance operation is defined to be complete when the effects of operation are globally observed.&quot;

About the statement:

&quot;DMB ensures the apparent order of the explicit memory operations before and after the instruction, without ensuring their completion.&quot;

I understand that the &quot;dmb&quot; doesn&apos;t wait until the completion of memory access. The instruction that assures that is &quot;dsb&quot;, since it&apos;s completion just happens when the memory access before it are complete. We can check that in http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0646a/CHDDGICF.html

Given that, I think we really want &quot;mcr 15, 0, &lt;rd&gt;, cr7, cr10, {5}&quot; in ARMv6 since it&apos;s equivalent of ARMv7 &quot;dmb sy;&quot;.

PS.: The manual I&apos;m pointing in ARM11 is the manual of the processor I&apos;m testing the ARMv6 support. I could find the &quot;dmb sy&quot; instruction in ARMv6-M reference, however it isn&apos;t present in the ARM11 reference.

Who could we ask this kind of question that is ARM related?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1325348</commentid>
    <comment_count>7</comment_count>
      <attachid>311619</attachid>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2017-07-03 18:01:58 -0700</bug_when>
    <thetext>Comment on attachment 311619
Patch

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

&gt;&gt;&gt;&gt; Source/JavaScriptCore/assembler/ARMAssembler.h:218
&gt;&gt;&gt;&gt; +            ARM6_MEMFENCE = 0xee076fba,
&gt;&gt;&gt; 
&gt;&gt;&gt; I think this may not be correct.  Someone who knows ARM better should take a closer look.  Here&apos;s why:
&gt;&gt;&gt; 
&gt;&gt;&gt; 1. The instruction you&apos;re replacing is DMBSY.
&gt;&gt;&gt;     The spec for DMBSY (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0646a/BABDFABI.html) says:
&gt;&gt;&gt;     &quot;DMB acts as a data memory barrier. It ensures that all explicit memory accesses that appear, in program order, before the DMB instruction are completed before any explicit memory accesses that appear, in program order, after the DMB instruction. DMB does not affect the ordering or execution of instructions that do not access memory.&quot;
&gt;&gt;&gt;     Specifically, it ensures that memory access are completed in program order.
&gt;&gt;&gt; 
&gt;&gt;&gt; 2. You&apos;re replacing it with &quot;mcr 15, 0, r6, cr7, cr10, {5}&quot;.
&gt;&gt;&gt;     The spec for MCR (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/I1014942.html) says:
&gt;&gt;&gt;     &quot;... As such, DMB ensures the apparent order of the explicit memory operations before and after the DMB instruction, but does not ensure the completion of those memory operations.&quot;
&gt;&gt;&gt; 
&gt;&gt;&gt;     I suspect what you really want is a &quot;Data Synchronization Barrier&quot;, but I&apos;m not certain.  Someone who knows better needs to review this.
&gt;&gt;&gt; 
&gt;&gt;&gt; Also, you picked r6 for the &lt;Rd&gt; argument in the instruction.  What&apos;s the reason for this?  It&apos;s not clear from the spec what &lt;Rd&gt; is for in terms of the &quot;Data Memory Barrier&quot; or &quot;Data Synchronization Barrier&quot;.  Maybe it doesn&apos;t matter, but someone who knows traditional ARM better should review this.
&gt;&gt; 
&gt;&gt; Yes. I was researching about your questions and I&apos;m not able to give you 100% of certain about them, so I just pinged the original authors of the Patch and they are going to give clarifications here soon.
&gt;&gt; 
&gt;&gt; One thing that I noticed between DSB and DMB in ARM11 is that instructions after DSB don&apos;t execute until it finishes. If I didn&apos;t misunderstood, &quot;dmb sy&quot;doesn&apos;t impose it and the code is more performant in practice. Following the ARM spec, It seems that we probably don&apos;t have a &quot;dmb sy&quot; equivalent instruction into ARM11 and we will probably need to choose which one is better.
&gt; 
&gt; Original author of the patch here, sorry for the delay.
&gt; 
&gt; Regarding difference of DMB/DSB: I think the wording &quot;but does not ensure the completion of those memory operations.&quot; means that the previous memory operations are not guaranteed to finish before the MCR finishes, but it provides a guarantee that they will be finished before other memory accesses after the MCR. My impression is that this second guarantee is enough for our needs, but I cannot claim I understand all the (present and future) uses of memoryBarrier in JavaScriptCore, so it could be good to have somebody else (not sure whom) weigh in on what are the needs here.
&gt; 
&gt; Also, we do have a Data Synchronisation Barrier similar to DMB SY: it&apos;s the same instruction, but with cr7, cr10, {4}, though in that case I think the register passed has a meaning, which I don&apos;t fully understand.
&gt; 
&gt; Regarding the use of $r6, my understanding from the documentation is that it is not modified, and I could confirm that on my device with gdb, so I just picked a random register.

Hi everyone,

I&apos;m probably the best point of reference for the meaning of the various fences in JSC.  MacroAssembler::memoryFence() is supposed to mean an acqrel fence: all accesses from before the acqrel will indeed happen before all of the accesses after the acqrel.  This is indeed weaker than the DSB fence, which also forces the entire execution of those prior instructions to finish before any execution of those after it start.  DSB is probably meant for what we call the WTF::crossModifyingCodeFence(), in &lt;wtf/Atomics.h&gt;.

Here are two code snippets that I read in order to reach the conclusion that MacroAssembler::memoryFence() means acqrel.  I never remember this stuff, but I do remember where to look.

In MacroAssemblerARM64.h, we have:

    // We take memoryFence to mean acqrel. This has acqrel semantics on ARM64.
    void memoryFence()
    {
        m_assembler.dmbISH();
    }

Look at that great comment!  I like looking at the ARM64 assembler because our memory model is essentially the philosophical superset of x86-TSO and ARM64 memory models.  Most of the hard stuff is because of ARM64, not x86.  So, typically, you can find out the most about crazy memory model stuff by just seeing what the ARM64 assembler does.

Another place to look is B3LowerToAir.  Note that Air instructions are almost always MacroAssembler method names, so &quot;MemoryFence&quot; means MacroAssembler::memoryFence().

        case Fence: {
            FenceValue* fence = m_value-&gt;as&lt;FenceValue&gt;();
            if (!fence-&gt;write &amp;&amp; !fence-&gt;read)
                return;
            if (!fence-&gt;write) {
                // A fence that reads but does not write is for protecting motion of stores.
                append(StoreFence);
                return;
            }
            if (!fence-&gt;read) {
                // A fence that writes but does not read is for protecting motion of loads.
                append(LoadFence);
                return;
            }
            append(MemoryFence);
            return;
        }

This is the one mention of MemoryFence.  Here we see that we select MemoryFence from B3::Fence when we want to protect the motion of both reads and writes.  Sounds about right and DMB does that.

So, yeah, this should be DMB.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1325377</commentid>
    <comment_count>8</comment_count>
      <attachid>314551</attachid>
    <who name="Caio Lima">ticaiolima</who>
    <bug_when>2017-07-03 20:53:36 -0700</bug_when>
    <thetext>Created attachment 314551
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1325378</commentid>
    <comment_count>9</comment_count>
    <who name="Build Bot">buildbot</who>
    <bug_when>2017-07-03 20:54:47 -0700</bug_when>
    <thetext>Attachment 314551 did not pass style-queue:


ERROR: Source/JavaScriptCore/assembler/ARMAssembler.h:218:  enum members should use InterCaps with an initial capital letter or initial &apos;k&apos; for C-style enums.  [readability/enum_casing] [4]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1326261</commentid>
    <comment_count>10</comment_count>
      <attachid>311619</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2017-07-06 17:32:05 -0700</bug_when>
    <thetext>Comment on attachment 311619
Patch

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

&gt;&gt;&gt;&gt;&gt; Source/JavaScriptCore/assembler/ARMAssembler.h:218
&gt;&gt;&gt;&gt;&gt; +            ARM6_MEMFENCE = 0xee076fba,
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; I think this may not be correct.  Someone who knows ARM better should take a closer look.  Here&apos;s why:
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; 1. The instruction you&apos;re replacing is DMBSY.
&gt;&gt;&gt;&gt;     The spec for DMBSY (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0646a/BABDFABI.html) says:
&gt;&gt;&gt;&gt;     &quot;DMB acts as a data memory barrier. It ensures that all explicit memory accesses that appear, in program order, before the DMB instruction are completed before any explicit memory accesses that appear, in program order, after the DMB instruction. DMB does not affect the ordering or execution of instructions that do not access memory.&quot;
&gt;&gt;&gt;&gt;     Specifically, it ensures that memory access are completed in program order.
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; 2. You&apos;re replacing it with &quot;mcr 15, 0, r6, cr7, cr10, {5}&quot;.
&gt;&gt;&gt;&gt;     The spec for MCR (http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/I1014942.html) says:
&gt;&gt;&gt;&gt;     &quot;... As such, DMB ensures the apparent order of the explicit memory operations before and after the DMB instruction, but does not ensure the completion of those memory operations.&quot;
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt;     I suspect what you really want is a &quot;Data Synchronization Barrier&quot;, but I&apos;m not certain.  Someone who knows better needs to review this.
&gt;&gt;&gt;&gt; 
&gt;&gt;&gt;&gt; Also, you picked r6 for the &lt;Rd&gt; argument in the instruction.  What&apos;s the reason for this?  It&apos;s not clear from the spec what &lt;Rd&gt; is for in terms of the &quot;Data Memory Barrier&quot; or &quot;Data Synchronization Barrier&quot;.  Maybe it doesn&apos;t matter, but someone who knows traditional ARM better should review this.
&gt;&gt;&gt; 
&gt;&gt;&gt; Yes. I was researching about your questions and I&apos;m not able to give you 100% of certain about them, so I just pinged the original authors of the Patch and they are going to give clarifications here soon.
&gt;&gt;&gt; 
&gt;&gt;&gt; One thing that I noticed between DSB and DMB in ARM11 is that instructions after DSB don&apos;t execute until it finishes. If I didn&apos;t misunderstood, &quot;dmb sy&quot;doesn&apos;t impose it and the code is more performant in practice. Following the ARM spec, It seems that we probably don&apos;t have a &quot;dmb sy&quot; equivalent instruction into ARM11 and we will probably need to choose which one is better.
&gt;&gt; 
&gt;&gt; Original author of the patch here, sorry for the delay.
&gt;&gt; 
&gt;&gt; Regarding difference of DMB/DSB: I think the wording &quot;but does not ensure the completion of those memory operations.&quot; means that the previous memory operations are not guaranteed to finish before the MCR finishes, but it provides a guarantee that they will be finished before other memory accesses after the MCR. My impression is that this second guarantee is enough for our needs, but I cannot claim I understand all the (present and future) uses of memoryBarrier in JavaScriptCore, so it could be good to have somebody else (not sure whom) weigh in on what are the needs here.
&gt;&gt; 
&gt;&gt; Also, we do have a Data Synchronisation Barrier similar to DMB SY: it&apos;s the same instruction, but with cr7, cr10, {4}, though in that case I think the register passed has a meaning, which I don&apos;t fully understand.
&gt;&gt; 
&gt;&gt; Regarding the use of $r6, my understanding from the documentation is that it is not modified, and I could confirm that on my device with gdb, so I just picked a random register.
&gt; 
&gt; Hi everyone,
&gt; 
&gt; I&apos;m probably the best point of reference for the meaning of the various fences in JSC.  MacroAssembler::memoryFence() is supposed to mean an acqrel fence: all accesses from before the acqrel will indeed happen before all of the accesses after the acqrel.  This is indeed weaker than the DSB fence, which also forces the entire execution of those prior instructions to finish before any execution of those after it start.  DSB is probably meant for what we call the WTF::crossModifyingCodeFence(), in &lt;wtf/Atomics.h&gt;.
&gt; 
&gt; Here are two code snippets that I read in order to reach the conclusion that MacroAssembler::memoryFence() means acqrel.  I never remember this stuff, but I do remember where to look.
&gt; 
&gt; In MacroAssemblerARM64.h, we have:
&gt; 
&gt;     // We take memoryFence to mean acqrel. This has acqrel semantics on ARM64.
&gt;     void memoryFence()
&gt;     {
&gt;         m_assembler.dmbISH();
&gt;     }
&gt; 
&gt; Look at that great comment!  I like looking at the ARM64 assembler because our memory model is essentially the philosophical superset of x86-TSO and ARM64 memory models.  Most of the hard stuff is because of ARM64, not x86.  So, typically, you can find out the most about crazy memory model stuff by just seeing what the ARM64 assembler does.
&gt; 
&gt; Another place to look is B3LowerToAir.  Note that Air instructions are almost always MacroAssembler method names, so &quot;MemoryFence&quot; means MacroAssembler::memoryFence().
&gt; 
&gt;         case Fence: {
&gt;             FenceValue* fence = m_value-&gt;as&lt;FenceValue&gt;();
&gt;             if (!fence-&gt;write &amp;&amp; !fence-&gt;read)
&gt;                 return;
&gt;             if (!fence-&gt;write) {
&gt;                 // A fence that reads but does not write is for protecting motion of stores.
&gt;                 append(StoreFence);
&gt;                 return;
&gt;             }
&gt;             if (!fence-&gt;read) {
&gt;                 // A fence that writes but does not read is for protecting motion of loads.
&gt;                 append(LoadFence);
&gt;                 return;
&gt;             }
&gt;             append(MemoryFence);
&gt;             return;
&gt;         }
&gt; 
&gt; This is the one mention of MemoryFence.  Here we see that we select MemoryFence from B3::Fence when we want to protect the motion of both reads and writes.  Sounds about right and DMB does that.
&gt; 
&gt; So, yeah, this should be DMB.

@Guillaume, can you point me to the documentation (url) about the use of &lt;Rd&gt; in the mcr instruction for DMB?  You&apos;re passing r6.  r6 may not be modified, but is it supposed to provide some sort of input value?  I have not yet seen ARM documentation that explains what the expectation is (other than &lt;Rd&gt; cannot be PC).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1327491</commentid>
    <comment_count>11</comment_count>
    <who name="Jacob Bramley">jacob.bramley+webkit</who>
    <bug_when>2017-07-11 08:51:37 -0700</bug_when>
    <thetext>Hello all,

I hope you don&apos;t mind me chipping in. I think most of the issues in the discussion were resolved but it looks like there were one or two unanswered questions which I might be able to help with. I&apos;ve had to interpret the barrier documentation enough times that some of it has actually stuck.

@Filip, based on your description of memoryFence, your conclusion that DMB is appropriate is correct. I wonder if the SY (system) shareability domain is necessary, though, or if something like ISH (inner shareable) would suffice. This depends on the system design, and how memoryFence is used.

&gt; @Guillaume, can you point me to the documentation (url) about the use of
&gt; &lt;Rd&gt; in the mcr instruction for DMB?  You&apos;re passing r6.  r6 may not be
&gt; modified, but is it supposed to provide some sort of input value?  I have
&gt; not yet seen ARM documentation that explains what the expectation is (other
&gt; than &lt;Rd&gt; cannot be PC).

The `mcr` instruction takes a register (as an input) but for the DMB operation it is ignored (and doesn&apos;t have to be initialised to anything in particular). This is stated at the bottom of page B6-1945 of the ARMv7-AR ARM (edition 0406C.c): https://developer.arm.com/docs/ddi0406/latest/arm-architecture-reference-manual-armv7-a-and-armv7-r-edition


@Caio:
&gt; Also, we can check the last ARMv6-M Arch Reference (http://infocenter.arm.com/help/topic/com.arm.doc.ddi0419d/DDI0419D_armv6m_arm.pdf) the following statement in page A3-59

Although I think the wording you quoted still applies, note that the ARMv6-M document refers only to M-class (microcontroller) systems with, no MMU and suchlike. It doesn&apos;t refer to the likes of ARM11. At one time I think there was an &quot;ARMv6&quot; reference manual but now it&apos;s all covered in the ARMv7-AR one that I mentioned above.


Also note that the ARMv6 MCR-based DMB performs the same operation as the ARMv7 DMB. The wording is different in the various different documents but the operation is the same either way.


@Guillaume:
&gt; Also, we do have a Data Synchronisation Barrier similar to DMB SY: it&apos;s the same instruction, but with cr7, cr10, {4}, though in that case I think the register passed has a meaning, which I don&apos;t fully understand.

Actually the register has no meaning to DSB (nor for ISB) as far as I&apos;m aware. I&apos;m curious, though: where did you find that information?


Thanks,
Jacob</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1327543</commentid>
    <comment_count>12</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2017-07-11 10:04:11 -0700</bug_when>
    <thetext>(In reply to Jacob Bramley from comment #11)
&gt; The `mcr` instruction takes a register (as an input) but for the DMB
&gt; operation it is ignored (and doesn&apos;t have to be initialised to anything in
&gt; particular). This is stated at the bottom of page B6-1945 of the ARMv7-AR
&gt; ARM (edition 0406C.c):
&gt; https://developer.arm.com/docs/ddi0406/latest/arm-architecture-reference-
&gt; manual-armv7-a-and-armv7-r-edition

Jacob, thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1327548</commentid>
    <comment_count>13</comment_count>
      <attachid>314551</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2017-07-11 10:19:09 -0700</bug_when>
    <thetext>Comment on attachment 314551
Patch

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

I think this patch is almost ready now that we have the spec so that we know it&apos;s doing the right thing.  Please apply the changes.  r- for now.  Thanks.

&gt; Source/JavaScriptCore/ChangeLog:8
&gt; +        Original author is Guillaume Emont.

Any specific reason why Guillaume isn&apos;t posting the patch himself?

&gt; Source/JavaScriptCore/assembler/ARMAssembler.h:217
&gt; +            // mcr     15, 0, r6, cr7, cr10, {5}

I think it&apos;s helpful to add a comment here saying:
    // The r6 argument register is ignored by this operation. Hence, it does not need to be initialized.
    // See section B6.2.2 in page B6-1945 of https://static.docs.arm.com/ddi0406/c/DDI0406C_C_arm_architecture_reference_manual.pdf.

It also seems quite arbitrary and out of left field to choose r6 (as if there&apos;s some special reason for its choice).  Why not just choose r0?

&gt; Source/JavaScriptCore/assembler/ARMAssembler.h:218
&gt; +            ARM6_MEMFENCE = 0xee076fba,

The spec for the in section B6.2.2 page B6-1946 of https://static.docs.arm.com/ddi0406/c/DDI0406C_C_arm_architecture_reference_manual.pdf says:
&quot;CP15DMB, Data Memory Barrier operation
In ARMv7, use the DMB instruction to perform a Data Memory Barrier, see DMB on page A8-378.
The deprecated CP15 c7 encoding for a Data Memory Barrier is an MCR instruction with &lt;opc1&gt; set to 0, &lt;CRn&gt; set to c7, &lt;CRm&gt; set to c10, and &lt;opc2&gt; set to 5. This operation performs the full system barrier performed by the DMB instruction.&quot;

Note the part that says &quot;full system barrier performed by the DMB instruction&quot;.

Hence, let&apos;s rename ARM6_MEMFENCE as ARM6_DMB_SY.

&gt; Source/JavaScriptCore/assembler/ARMAssembler.h:733
&gt; -        void dmbSY()
&gt; +        void memoryFence()

Let&apos;s undo this.

&gt; Source/JavaScriptCore/assembler/ARMAssembler.h:738
&gt; +            m_buffer.putInt(ARM6_MEMFENCE);

Rename to ARM6_DMB_SY.

&gt; Source/JavaScriptCore/assembler/MacroAssemblerARM.h:1489
&gt; -        m_assembler.dmbSY();
&gt; +        m_assembler.memoryFence();

Undo this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1327741</commentid>
    <comment_count>14</comment_count>
      <attachid>314551</attachid>
    <who name="Guillaume Emont">guijemont</who>
    <bug_when>2017-07-11 14:28:08 -0700</bug_when>
    <thetext>Comment on attachment 314551
Patch

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

&gt;&gt; Source/JavaScriptCore/ChangeLog:8
&gt;&gt; +        Original author is Guillaume Emont.
&gt; 
&gt; Any specific reason why Guillaume isn&apos;t posting the patch himself?

I initially made this as a dirty downstream patch, Caio is kindly cleaning it up and sending it here. The main motivation for this is to help him understand this code. A secondary motivation is that I am busy with other things and without his help, who knows when I would have found the time.

&gt;&gt; Source/JavaScriptCore/assembler/ARMAssembler.h:217
&gt;&gt; +            // mcr     15, 0, r6, cr7, cr10, {5}
&gt; 
&gt; I think it&apos;s helpful to add a comment here saying:
&gt;     // The r6 argument register is ignored by this operation. Hence, it does not need to be initialized.
&gt;     // See section B6.2.2 in page B6-1945 of https://static.docs.arm.com/ddi0406/c/DDI0406C_C_arm_architecture_reference_manual.pdf.
&gt; 
&gt; It also seems quite arbitrary and out of left field to choose r6 (as if there&apos;s some special reason for its choice).  Why not just choose r0?

My bad, I think I indeed chose $r6 arbitrarily. I think $r0 should be fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1327750</commentid>
    <comment_count>15</comment_count>
    <who name="Guillaume Emont">guijemont</who>
    <bug_when>2017-07-11 14:36:26 -0700</bug_when>
    <thetext>(In reply to Jacob Bramley from comment #11)
&gt; 
&gt; @Guillaume:
&gt; &gt; Also, we do have a Data Synchronisation Barrier similar to DMB SY: it&apos;s the same instruction, but with cr7, cr10, {4}, though in that case I think the register passed has a meaning, which I don&apos;t fully understand.
&gt; 
&gt; Actually the register has no meaning to DSB (nor for ISB) as far as I&apos;m
&gt; aware. I&apos;m curious, though: where did you find that information?

I have an old pdf lying around tiled &quot;ARM Architecture
Reference Manual&quot; that seems to be from 2005. It has a table on page B6-21 and B6-22 describing the mcr 15 cr7 operations. for (c10, 4), it says &quot;SBZ&quot; in the data field. I did not understand what that means. I just did some more research in the document, and it seems to mean &quot;Should Be Zero&quot;. I think that therefore we definitely want to use $r0 instead of $r6.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1327757</commentid>
    <comment_count>16</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2017-07-11 14:48:27 -0700</bug_when>
    <thetext>(In reply to Guillaume Emont from comment #15)
&gt; (In reply to Jacob Bramley from comment #11)
&gt; &gt; 
&gt; &gt; @Guillaume:
&gt; &gt; &gt; Also, we do have a Data Synchronisation Barrier similar to DMB SY: it&apos;s the same instruction, but with cr7, cr10, {4}, though in that case I think the register passed has a meaning, which I don&apos;t fully understand.
&gt; &gt; 
&gt; &gt; Actually the register has no meaning to DSB (nor for ISB) as far as I&apos;m
&gt; &gt; aware. I&apos;m curious, though: where did you find that information?
&gt; 
&gt; I have an old pdf lying around tiled &quot;ARM Architecture
&gt; Reference Manual&quot; that seems to be from 2005. It has a table on page B6-21
&gt; and B6-22 describing the mcr 15 cr7 operations. for (c10, 4), it says &quot;SBZ&quot;
&gt; in the data field. I did not understand what that means. I just did some
&gt; more research in the document, and it seems to mean &quot;Should Be Zero&quot;. I
&gt; think that therefore we definitely want to use $r0 instead of $r6.

The documentation isn&apos;t very clear about what SBZ means but I quite sure it doesn&apos;t means using r0.  I think I read somewhere that SBZ implies that the input should have a zero value.  Regardless, that is irrelevant here.  The docs that Jacob point to is clear on the fact that the Rd argument register is ignored.  So, r0 or r6 is fine.  I just thought r0 is better because using r6 implies more purpose than it has.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1327817</commentid>
    <comment_count>17</comment_count>
    <who name="Caio Lima">ticaiolima</who>
    <bug_when>2017-07-11 16:17:08 -0700</bug_when>
    <thetext>@Jacob

Thanks for the support here. Do you mind answer another question we discussed in the mailing list? 
Is there any ARMv6 processor that doesn&apos;t support the &quot;mcr&quot; operations? The problem here is because if the support is limited to some family of chips, our solution here isn&apos;t enough.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1327991</commentid>
    <comment_count>18</comment_count>
    <who name="Jacob Bramley">jacob.bramley+webkit</who>
    <bug_when>2017-07-12 03:42:04 -0700</bug_when>
    <thetext>(In reply to Mark Lam from comment #16)
&gt; (In reply to Guillaume Emont from comment #15)
&gt; &gt; [...]
&gt; &gt; 
&gt; &gt; I have an old pdf lying around tiled &quot;ARM Architecture
&gt; &gt; Reference Manual&quot; that seems to be from 2005. It has a table on page B6-21
&gt; &gt; and B6-22 describing the mcr 15 cr7 operations. for (c10, 4), it says &quot;SBZ&quot;
&gt; &gt; in the data field. I did not understand what that means. I just did some
&gt; &gt; more research in the document, and it seems to mean &quot;Should Be Zero&quot;. I
&gt; &gt; think that therefore we definitely want to use $r0 instead of $r6.
&gt; 
&gt; The documentation isn&apos;t very clear about what SBZ means but I quite sure it
&gt; doesn&apos;t means using r0.  I think I read somewhere that SBZ implies that the
&gt; input should have a zero value.  Regardless, that is irrelevant here.  The
&gt; docs that Jacob point to is clear on the fact that the Rd argument register
&gt; is ignored.  So, r0 or r6 is fine.  I just thought r0 is better because
&gt; using r6 implies more purpose than it has.

I think I&apos;ve found that table (in document 0100I), and I interpret it the same way that you do. I would speculate that the SBZ specification was relaxed for ARMv7, and then applied retrospectively based on real implementations of ARMv6.

In any case, the ARMv7-AR document I linked to is the latest official documentation for ARMv6 so I would prefer the explanation in that one.

(In reply to Caio Lima from comment #17)
&gt; @Jacob
&gt; 
&gt; Thanks for the support here. Do you mind answer another question we
&gt; discussed in the mailing list? 
&gt; Is there any ARMv6 processor that doesn&apos;t support the &quot;mcr&quot; operations? The
&gt; problem here is because if the support is limited to some family of chips,
&gt; our solution here isn&apos;t enough.

As far as I&apos;m aware, all ARMv6 processors support these `mcr` operations. If that were not the case, the document would typically refer to something like &quot;ARMv6K&quot;.

Also note that the ARMv6 barriers were deprecated in ARMv7, and privileged code can deny access to them, so on newer architectures you may have problems if they are used in some lowest-common-supported-platform situation.

Thanks,
Jacob</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1328137</commentid>
    <comment_count>19</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2017-07-12 11:15:24 -0700</bug_when>
    <thetext>(In reply to Mark Lam from comment #16)
&gt; (In reply to Guillaume Emont from comment #15)
&gt; &gt; (In reply to Jacob Bramley from comment #11)
&gt; &gt; &gt; 
&gt; &gt; &gt; @Guillaume:
&gt; &gt; &gt; &gt; Also, we do have a Data Synchronisation Barrier similar to DMB SY: it&apos;s the same instruction, but with cr7, cr10, {4}, though in that case I think the register passed has a meaning, which I don&apos;t fully understand.
&gt; &gt; &gt; 
&gt; &gt; &gt; Actually the register has no meaning to DSB (nor for ISB) as far as I&apos;m
&gt; &gt; &gt; aware. I&apos;m curious, though: where did you find that information?
&gt; &gt; 
&gt; &gt; I have an old pdf lying around tiled &quot;ARM Architecture
&gt; &gt; Reference Manual&quot; that seems to be from 2005. It has a table on page B6-21
&gt; &gt; and B6-22 describing the mcr 15 cr7 operations. for (c10, 4), it says &quot;SBZ&quot;
&gt; &gt; in the data field. I did not understand what that means. I just did some
&gt; &gt; more research in the document, and it seems to mean &quot;Should Be Zero&quot;. I
&gt; &gt; think that therefore we definitely want to use $r0 instead of $r6.
&gt; 
&gt; The documentation isn&apos;t very clear about what SBZ means but I quite sure it
&gt; doesn&apos;t means using r0.  I think I read somewhere that SBZ implies that the
&gt; input should have a zero value.  Regardless, that is irrelevant here.  The
&gt; docs that Jacob point to is clear on the fact that the Rd argument register
&gt; is ignored.  So, r0 or r6 is fine.  I just thought r0 is better because
&gt; using r6 implies more purpose than it has.

@Guillaume, I apologize.  You were right: if the doc says SBZ, then the field should be 0.  In the register field, this means r0.

That said, I think the latest document is clear that the register value doesn&apos;t matter (except that it cannot be r15/pc).  But it also doesn&apos;t hurt to set it to r0.  Thanks.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>311619</attachid>
            <date>2017-05-31 12:30:52 -0700</date>
            <delta_ts>2017-07-03 20:53:31 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-172767-20170531163051.patch</filename>
            <type>text/plain</type>
            <size>4652</size>
            <attacher name="Caio Lima">ticaiolima</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjE3NjEwCmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlw
dENvcmUvQ2hhbmdlTG9nIGIvU291cmNlL0phdmFTY3Jpc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OGY0OSAxMDA2NDQKLS0tIGEvU291cmNlL0phdmFTY3JpcHRDb3JlL2ppdC9SZWdp
c3RlclNldC5jcHAKKysrIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL2ppdC9SZWdpc3RlclNldC5j
cHAKQEAgLTE1Myw2ICsxNTMsMTQgQEAgUmVnaXN0ZXJTZXQgUmVnaXN0ZXJTZXQ6OmNhbGxlZVNh
dmVSZWdpc3RlcnMoKQogICAgICAgICByZWcgPSBzdGF0aWNfY2FzdDxBUk02NFJlZ2lzdGVyczo6
RlBSZWdpc3RlcklEPihyZWcgKyAxKSkKICAgICAgICAgcmVzdWx0LnNldChyZWcpOwogI2VsaWYg
Q1BVKE1JUFMpCisjZWxpZiBDUFUoQVJNKQorICAgIHJlc3VsdC5zZXQoQVJNUmVnaXN0ZXJzOjpy
NCk7CisgICAgcmVzdWx0LnNldChBUk1SZWdpc3RlcnM6OnI1KTsKKyAgICByZXN1bHQuc2V0KEFS
TVJlZ2lzdGVyczo6cjYpOworICAgIHJlc3VsdC5zZXQoQVJNUmVnaXN0ZXJzOjpyNyk7CisgICAg
cmVzdWx0LnNldChBUk1SZWdpc3RlcnM6OnI4KTsKKyAgICByZXN1bHQuc2V0KEFSTVJlZ2lzdGVy
czo6cjkpOworICAgIHJlc3VsdC5zZXQoQVJNUmVnaXN0ZXJzOjpyMTApOwogI2Vsc2UKICAgICBV
TlJFQUNIQUJMRV9GT1JfUExBVEZPUk0oKTsKICNlbmRpZgo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>314551</attachid>
            <date>2017-07-03 20:53:36 -0700</date>
            <delta_ts>2017-07-11 10:19:09 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-172767-20170704005334.patch</filename>
            <type>text/plain</type>
            <size>3854</size>
            <attacher name="Caio Lima">ticaiolima</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjE5MTExCmRpZmYgLS1naX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vaWQgc3RvcmVGZW5j
ZSgpCmRpZmYgLS1naXQgYS9Tb3VyY2UvSmF2YVNjcmlwdENvcmUvaml0L0pJVE9wZXJhdGlvbnMu
Y3BwIGIvU291cmNlL0phdmFTY3JpcHRDb3JlL2ppdC9KSVRPcGVyYXRpb25zLmNwcAppbmRleCAx
MWNjODZkZTI4NmNlNzg0MWZlN2RlODExODNlYmRkNDA3NTBhNWM5Li45Zjk2NjE5OGU3OWUwYzNk
Y2EyMThlNmUzMWI3NjRjYzgyYmUzZDMzIDEwMDY0NAotLS0gYS9Tb3VyY2UvSmF2YVNjcmlwdENv
cmUvaml0L0pJVE9wZXJhdGlvbnMuY3BwCisrKyBiL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9qaXQv
SklUT3BlcmF0aW9ucy5jcHAKQEAgLTI4MDgsNiArMjgwOCw3IEBAIFNZTUJPTF9TVFJJTkcoZ2V0
SG9zdENhbGxSZXR1cm5WYWx1ZSkgIjoiICJcbiIKICNlbGlmIENPTVBJTEVSKEdDQ19PUl9DTEFO
RykgJiYgQ1BVKEFSTV9UUkFESVRJT05BTCkKIGFzbSAoCiAiLnRleHQiICJcbiIKKyIuYWxpZ24g
MiIgIlxuIgogIi5nbG9ibCAiIFNZTUJPTF9TVFJJTkcoZ2V0SG9zdENhbGxSZXR1cm5WYWx1ZSkg
IlxuIgogSElERV9TWU1CT0woZ2V0SG9zdENhbGxSZXR1cm5WYWx1ZSkgIlxuIgogSU5MSU5FX0FS
TV9GVU5DVElPTihnZXRIb3N0Q2FsbFJldHVyblZhbHVlKQo=
</data>
<flag name="review"
          id="335424"
          type_id="1"
          status="-"
          setter="mark.lam"
    />
          </attachment>
      

    </bug>

</bugzilla>