Coder Social home page Coder Social logo

Comments (9)

ivmai avatar ivmai commented on June 16, 2024

While doc/README.txt is not clear about it, AO_REQUIRE_CAS ensures AO_compare_and_swap* are defined (not AO_fetch_compare_and_swap), so it's not a bug.

At the same time, it would be good to add support of AO_fetch_compare_and_swap_full on S390. The right way is to copy-paste-edit AO_compare_and_swap_full in gcc/s390.h. Could you contribute it please?

from libatomic_ops.

FROGGS avatar FROGGS commented on June 16, 2024

Hi, after staring at the code and the z/Architecture documentation I can say that I'm unable to contribute code here. However, I can test stuff on my s390x vm.

from libatomic_ops.

ivmai avatar ivmai commented on June 16, 2024

How about this implementation?
AO_INLINE AO_t AO_fetch_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val) { __asm __volatile ("csg %0,%2,%1" : "+d" (old), "=Q" (*addr) : "d" (new_val), "m" (*addr) : "cc", "memory"); return old; }
#define AO_HAVE_fetch_compare_and_swap_full

from libatomic_ops.

FROGGS avatar FROGGS commented on June 16, 2024

I've just added a PR for this, which passes libatomic_ops's own four test and my little example from my initial message.

from libatomic_ops.

ivmai avatar ivmai commented on June 16, 2024

Thank you. Could you please also temporarily delete AO_compare_and_swap_full and rerun make check

from libatomic_ops.

FROGGS avatar FROGGS commented on June 16, 2024

Hi, it passes too... is that expected? O.o

Also, I'm wondering if these symbols are correct:
With code of PR#21:

atomic_ops.o:
00000000000001c0 T AO_compare_double_and_swap_double_emulation
0000000000000358 T AO_fetch_compare_and_swap_emulation
0000000000000000 B AO_locks
0000000000000000 T AO_pause
0000000000000080 B AO_pt_lock
0000000000000148 T AO_store_full_emulation
                 U __stack_chk_fail
00000000000000b8 b all_sigs
00000000000000a8 b init_lock
00000000000000b0 b initialized
00000000000000e0 t lock_ool
                 U select
                 U sigfillset
                 U sigprocmask
0000000000000000 d spin_dummy

When removing AO_compare_and_swap_full:

0000000000000188 T AO_compare_double_and_swap_double_emulation
0000000000000370 T AO_fetch_compare_and_swap_emulation
0000000000000000 B AO_locks
0000000000000000 T AO_pause
0000000000000080 B AO_pt_lock
00000000000000e0 T AO_store_full_emulation
                 U __stack_chk_fail
00000000000000b8 b all_sigs
00000000000000a8 b init_lock
00000000000000b0 b initialized
                 U select
                 U sigfillset
                 U sigprocmask
0000000000000000 d spin_dummy

from libatomic_ops.

ivmai avatar ivmai commented on June 16, 2024

Looks ok.

from libatomic_ops.

ivmai avatar ivmai commented on June 16, 2024

The patch (with some modifications) merged to master - see c2edeab

from libatomic_ops.

ivmai avatar ivmai commented on June 16, 2024

Also cherry-picked to release-7_4 branch - 148dfd5

from libatomic_ops.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.