Hi Dmitriy,
On Friday, August 8, 2014, Dmitriy V'jukov <
dvy...@gmail.com> wrote:
On Thu, Aug 7, 2014 at 8:29 PM, Ronald Landheer-Cieslak <r...@vlinder.ca> wrote:
> darn keyboard..
>
> anyways: 4) get it to work with all the (sane) compilers at my disposal (I
> have several versions of MSVC and several flavors of GCC on both x86 and
> x86_64, Linux and FreeBSD, and I think I have clang and maybe even icc lying
> around somewhere).
> 5) write a set of wrappers around std, so if not using Relacy to test, the
> rl:: namespace morphs into something that does "the real deal" (and ignores
> $)
How will the user code look like? Will it need to use std::atomic or
rl::atomic or RL(atomic)? Ideally, the user code uses std::atomic, but
that it turned into rl::atomic when relacy header is included.
Well, ideally Relacy uses the same instrumentation machinery as
ThreadSanitizer and just works transparently w/o any modifications to
code...
What I'm currently looking at doing is user code that uses rl::atomic, so there are so few annotations with $ signs etc. but still very readable.
The idea is to make the testing machinery disappear at the flip of a switch, so rl::atomic becomes equivalent to std::atomic and the $ signs simply get ignored.
The problem with trying to let the user write code using std::atomic is that we don't own the std namespace - compiler and standard library vendors do. The code I was using that first ran into trouble didn't use std::atomic and didn't include <atomic>, but still got an error in relacy_std.hpp. I tried (briefly) to keep the idea of std::atomic transforming magically into rl::atomic, but that ran into all kinds of compiler errors *and* still required $ annotations in places where using the real std would frown.
ThreadSanitizer is nice, but takes a completely different approach.
If someone wanted to go "belt and suspenders" they'd write unit tests using relacy, using the rl namespace for all atomic stuff, and use rl::var<> for anything they think might be shared but needs to be locked. Then, when convinced their algorithms work, they'd still run the complete program with ThreadSanitizer a couple of thousand times (hoping real-life scheduling does similar combination searching as the Relacy scheduler does).
Not sure which is the belt and which is the suspenders, but I think you see the idea.
[snip]
I currently have most of the examples working (one is broken because it tries to delete static thread-local data, one doesn't contain any code that wasn't commented out, all the others work).
Next step is to run it through the complete array of compilers I have at my disposal, before I write the non-testing wrapper classes.
If you want, I can post the patches I have so far.
rlc
--
--
Software for Embedded Industrial Devices
Software development & analysis