Rune - Major run-time threading work, locked storage work
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 24 Mar 2016 07:06:23 +0000 (00:06 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 24 Mar 2016 07:06:23 +0000 (00:06 -0700)
commiteb79be14d0bd282274168d81079adf35229ee42c
tree40a53c0580d8c8d8883769a40094b36bd72c1a31
parent81a9e7130729159939bca01eac0735de788af808
Rune - Major run-time threading work, locked storage work

* Start adding the locked storage mechanics.  We want procedure arguments,
  return values, and local variables to be 'locked', meaning that any
  lvalues, pointers, or references are naturally LOCK+REFD instead of just
  REFD.  This allows the code generator to optimize away quite a few locks.

  Current status: Mostly works but does not yet work for elements of
  compound types, or return values.  Also lvalues are not double-locked.
  Method calls are ok because those objects are passed directly, but any
  pointer-method calls (i.e. ptr.new(), not ptr->method()) may get confused.

* Throw mutexes around some of the X11 text routines.

* Major refactoring of libdthread.  Fix many bugs, stabilize the code base,
  simplify the APIs, and so forth.  There are plenty of SMP collisions still
  to be improved upon.

  In particular fix context-switching races where a thread on one cpu
  (pthread) places itself on the RunQueue and release the mutex before
  completely switching out, creating races with another cpu trying to
  pick the thread up.

* Use atomic ops for rs_Refs (obviously).  It just wasn't done yet.  Now it's
  done.

* Make KQueue mandatory.  It is still not entirely clear whether we can depend
  on new ADDs being picked up by a blocked kevent() in another thread across
  multiple platforms.  For now I'm depending on it.
41 files changed:
ext_x11/dll/draw.c
ext_x11/dll/fill.c
ext_x11/dll/main.c
ext_x11/dll/pen.c
ext_x11/dll/text.c
ext_x11/link/defs.h
ext_x11/link/main.c
ext_x11/link/text.c
libdthread/defs.h
libdthread/event.c
libdthread/export.h
libdthread/lock.c
libdthread/side.c
libdthread/thread.c
libdthread/thread.h
libdthread/timer.h
libgen/backend_llvm.c
libgen/backend_ras.c
libgen/defs.h
libgen/export.h
libgen/gen_context.c
libgen/gen_emit.c
libgen/gen_exp.c
libgen/gen_refstor.c
libgen/gen_syscalls.c
libgen/run_syscalls.c
librune/export.h
librune/heap.c
librune/parse2.c
librune/type.h
librune/typeq.c
libruntime/main.c
libruntime/memory.c
libruntime/refs.c
libruntime/thread.c
libsupport/defs.h
libsupport/hash.c
libsupport/init.c
ras/insnx86.c
tests/cmp1.d
tests/threads.d