PSA: Now jitting some atomic operations used by C++

Lars Hansen <[email protected]> Mon, 21 Jan 2019 08:55:40 +0100
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <CAHOPy=pB9RH-MfU1LOj0xErQ+3Poa51tWkUek26LkKnmhOwe1A@mail.gmail.com>
I just landed https://bugzilla.mozilla.org/show_bug.cgi?id=1394420; see
that bug + long commit msgs on the patches for more information.

The work has some observable consequences for teams porting to tier-3
platforms:

- if your platform does not have a JIT you probably won't notice much
except if you have local patches; code in jit/AtomicOperations* and
jit/*/AtomicOperations* has moved around and you'll need to adapt.

- if your platform makes use of a JIT for a tier-1 platform but is not
itself tier-1 (hello tier-3 x86/ARM/ARM64 Linux rebuilds), SpiderMonkey
will now call jit-generated atomics from C++, rather than the
unsafe/undefined C++ atomics placeholders.  In particular, it should no
longer be necessary for you to link with -latomic on x86 Linux.

- if your platform has a JIT for a tier-3 platform (hello MIPS) you are
currently stuck with your private unsafe/undefined C++ atomics
placeholders, which I hope I did not break.  However you may now be able to
move from your private C++ definitions to the jitted definitions by
rewriting some code; start at the end of jit/AtomicOperations.h and look at
similar code for ARM/ARM64.  There's a little platform-specific code in
jit/shared/AtomicsOperations-shared-jit.cpp that has to be adapted.  Reach
out to me if you run into trouble.  Patches welcome.  etc.

--lars