1. Apr 10, 2019
  2. Apr 09, 2019
  3. Mar 26, 2019
    • Matthew Fernandez's avatar
      don't save signal mask when using setjmp/longjmp · 7a325bed
      Matthew Fernandez authored
      We never alter the signal mask, so it's an unnecessary overhead to save and
      restore it when using a jmp_buf. This should speed up the verifier when using
      assumptions and/or reporting multiple errors. This only occurred to me when
      reading Dmitry Vyukov's blog, 1024 Cores.
      7a325bed
  4. Mar 25, 2019
  5. Mar 24, 2019
    • Matthew Fernandez's avatar
      optimise refcounted_ptr_peek to only read one word · 9287f5af
      Matthew Fernandez authored
      By reducing this function to only read the ptr member of the struct, we can
      avoid more expensive operations on some platforms. E.g. on x86-64, this lets us
      drop a CMPXCHG16B followed by some juggling, for a regular 64-bit MOV.
      
      Github: related to #104 "remove set_expand_lock?"
      9287f5af
    • Matthew Fernandez's avatar
      avoid using set expansion mutex or next-peeking when single threaded · 606e91b3
      Matthew Fernandez authored
      When the verifier is single threaded, there's no need to use a mutex or snoop
      what other threads are doing. This allows us to optimise single threaded
      checking slightly.
      
      Github: related to #104 "remove set_expand_lock?"
      606e91b3
    • Matthew Fernandez's avatar
      use double-checked locking in set expansion · 5b29f2c4
      Matthew Fernandez authored
      As described in the comment, this is an optimisation for multithreaded
      execution.
      
      Github: closes #104 "remove set_expand_lock?"
      5b29f2c4
    • Matthew Fernandez's avatar
      make refcounted_ptr_set operate atomically · 2e84387e
      Matthew Fernandez authored
      This will be required for upcoming changes that allow reads to race with this
      operation.
      
      Github: related to #104 "remove set_expand_lock?"
      2e84387e
    • Matthew Fernandez's avatar
    • Matthew Fernandez's avatar
      move migration counter reset to rendezvous interstice · 5f4bb2cd
      Matthew Fernandez authored
      OK, let's unpack that cryptic headline a little... When the seen set exceeds a
      certain capacity, it gets expanded. The new set is allocated by one thread and
      then all threads participate in the migration of the contents of the old set to
      the new one. To arbitrate which thread is operating on any particular chunk of
      the old set they use a shared counter, next_migration.
      
      Prior to this commit, the counter was reset immediately preceding a migration.
      Following this commit, we do the reset at the other end, after a migration. It
      should be clear that the reset has to happen some time (so the counter starts at
      zero the next time the set needs to be expanded) but it is valid to do it at
      either end. The motivation for moving it to the end, is that we can do it in a
      single-threaded context. This is during what I've referred to above as the
      "rendezvous interstice." All threads arrive at the post-migration rendezvous
      point and block on a condition variable. The last thread to arrive is designated
      the "leader" and allowed a window of single-threaded execution before unblocking
      all the "followers." By putting the reset in this window, we guarantee it gets
      done in a way that (a) will not affect any ongoing migrations and (b) will be
      observable by all other threads at the start of the next migration.
      
      "But why did it need to move?" I hear you ask. It was already in a location that
      was a single-threaded context enforced by the set expansion mutex. Well, we are
      about to introduce an optimisation based on double-checked locking that allows
      threads to observe a set expansion has already started without acquiring the set
      expansion mutex. That is, they will be able to enter set_migrate having never
      acquired the set expansion mutex. This means, if the counter reset was left
      where it was, they could start migration work before the counter had been reset.
      This could be resolved by moving the counter reset ahead of the write to
      next_global_seen (what the DCLP check looks at) and adding some memory barriers
      but it's simpler to just move the reset out of this path to a safer location
      altogether.
      
      Github: related to #104 "remove set_expand_lock?"
      5f4bb2cd
    • Matthew Fernandez's avatar
      use peeking to read the refcounted pointer in set_expand · 022c3708
      Matthew Fernandez authored
      This avoids an unnecessary increment, then decrement of the pointer we're just
      trying to read.
      
      Github: related to #104 "remove set_expand_lock?"
      022c3708
    • Matthew Fernandez's avatar
      add a function for snooping the value of a refcounted pointer · ca0c3005
      Matthew Fernandez authored
      This will allow us to avoid the awkward get+put we do to read the pointer's
      value in set_expand.
      
      Github: related to #104 "remove set_expand_lock?"
      ca0c3005
    • Matthew Fernandez's avatar
      fix: use __typeof__ instead of typeof · 7e59f1c2
      Matthew Fernandez authored
      Some compilers do not treat typeof as a synonym and only recognise their own
      built-in, __typeof__ or __typeof. This was not picked up before because it seems
      we are not testing on any non-x86-64 platforms. It would be nice to address this
      but I don't currently have any other platforms available.
      7e59f1c2
  6. Mar 22, 2019
  7. Mar 19, 2019
  8. Mar 18, 2019
  9. Mar 17, 2019
  10. Mar 16, 2019
  11. Mar 15, 2019