[Webkit-unassigned] [Bug 106740] Fix the atomicIncrement implementation for Windows

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 17 02:40:31 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=106740





--- Comment #5 from Csaba Osztrogonac <ossy at webkit.org>  2013-01-17 02:42:17 PST ---
I think we need something similar to GCC does.

Here is a small example:
-------------------------
long long a,b;
int main() {
    a = 0xDEADBEEF;
    b = __sync_add_and_fetch(&a, 0x11111111);
    return b;
}


and the assembly generated by GCC:
-----------------------------------

00000000 <main>:
   0:   55                      push   %ebp
   1:   89 e5                   mov    %esp,%ebp
   3:   57                      push   %edi
   4:   56                      push   %esi
   5:   53                      push   %ebx
   6:   83 ec 04                sub    $0x4,%esp
   9:   c7 05 00 00 00 00 ef    movl   $0xdeadbeef,0x0
  10:   be ad de
  13:   c7 05 04 00 00 00 00    movl   $0x0,0x4
  1a:   00 00 00
  1d:   a1 00 00 00 00          mov    0x0,%eax
  22:   8b 15 04 00 00 00       mov    0x4,%edx
  28:   89 c1                   mov    %eax,%ecx
  2a:   89 d3                   mov    %edx,%ebx
  2c:   81 c1 11 11 11 11       add    $0x11111111,%ecx
  32:   83 d3 00                adc    $0x0,%ebx
  35:   89 ce                   mov    %ecx,%esi
  37:   89 df                   mov    %ebx,%edi
  39:   89 0c 24                mov    %ecx,(%esp)
  3c:   89 d9                   mov    %ebx,%ecx
  3e:   8b 1c 24                mov    (%esp),%ebx
  41:   f0 0f c7 0d 00 00 00    lock cmpxchg8b 0x0
  48:   00
  49:   75 dd                   jne    28 <main+0x28>
  4b:   89 f0                   mov    %esi,%eax
  4d:   89 fa                   mov    %edi,%edx
  4f:   a3 00 00 00 00          mov    %eax,0x0
  54:   89 15 04 00 00 00       mov    %edx,0x4
  5a:   a1 00 00 00 00          mov    0x0,%eax
  5f:   8b 15 04 00 00 00       mov    0x4,%edx
  65:   83 c4 04                add    $0x4,%esp
  68:   5b                      pop    %ebx
  69:   5e                      pop    %esi
  6a:   5f                      pop    %edi
  6b:   5d                      pop    %ebp
  6c:   c3                      ret

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list