Commits on Mar 7, 2017
Commits on Mar 6, 2017
  1. Disable a WeakRef spec when compiling with GC debug

    ggiraldez committed Mar 6, 2017
    For yet unknown reasons, this spec crashes when compiling with the GC debug
  2. Use Boehm's GC debugging functions if complied with -Dgc_debug

    ggiraldez committed Mar 6, 2017
    This should aid in debugging memory corruption problems, missing GC roots, etc.
  3. Push LibXML's global state to the list of GC roots

    ggiraldez committed Mar 6, 2017
    We are using the GC to allocate memory in LibXML, but it keeps a per-thread
    global structure with pointers to dynamically allocated objects, which is
    allocated using a regular malloc(). Push this structure to the GC's roots list
    such that the GC knows about these pointers and doesn't free them on collection.
Commits on Feb 24, 2017
  1. Use Thread instance variables to handle XML errors

    ggiraldez committed Feb 24, 2017
    Use instead of ThreadLocal variables which don't play well with the GC and they
    are not supported in all platforms. Thanks @asterite, @RX14 and @ysbaddaden!
  2. Refactor: remove scheduler for event loop thread

    juanedi authored and Juan Edi committed Feb 24, 2017
    Decouple events queue from schedulers, to avoid initializing a dummy
    scheduler for the event loop thread (which enqueues events only to be
    stolen by other threads but never executes anything else)
  3. Use separate thread for the event loop

    juanedi authored and Juan Edi committed Feb 22, 2017
    Running the event loop in the main thread means background threads won't
    receive IO notifications if the main thread is stuck computing.
Commits on Feb 23, 2017
  1. Chain Fiber callbacks instead of replacing them

    ggiraldez committed Feb 23, 2017
    This allows for multiple callbacks to be executed after a Fiber is switched.
  2. Allow compiling in "single thread" mode with a compiler flag

    ggiraldez committed Feb 23, 2017
    Passing -Dsingle_thread will simply not start new worker threads.
Commits on Feb 22, 2017
  1. Rewrite channel select mechanism to avoid resuming a fiber twice

    ggiraldez committed Feb 22, 2017
    Introduce a new class `FiberTicket` to represent a fiber willing to send/receive
    in a channel. The channels needs to checkout the fiber from the ticket before
    enqueueing it in the scheduler. It also has a lock which allows for safe usage
    in a select operation.
Commits on Feb 17, 2017
  1. Fix some race conditions in Process

    ggiraldez committed Feb 17, 2017
    - Reify the channel used for synchronization of stream copy fibers in the
      invoking fiber instead of waiting to lazily initialize it in each fiber
    - Make sure the SIGCHLD handler is installed before performing the fork, to
      avoid losing the signal
Commits on Feb 16, 2017
  1. Wrap the SignalChildHandler singleton creation in a spinlock

    ggiraldez committed Feb 16, 2017
    Avoids creating more than one SignalChildHandler if invoked simultaneously from
    different threads.
  2. Use a stamp to detect late added runnables in scheduler

    ggiraldez committed Feb 16, 2017
    Every time a runnable is added to the runnables queue in a scheduler, increment
    a global atomic stamp to signal other spinning threads, even after they have
    attempted to steal jobs from all existing schedulers. This avoids the rare race
    condition where all threads go to the sleeping state and there are still
    runnables in some schedulers.
Commits on Feb 13, 2017
  1. Unregister fiber brlock reader when the thread finishes

    ggiraldez committed Feb 13, 2017
    This is to avoid re-registering the same reader twice. Apparently thread-local
    storage is reused after a thread is terminated, and since the reader is in such
    address space it was being registered twice, forming a loop in the brlock
    readers list.
Commits on Feb 9, 2017
  1. Compiler: disable paralellization of codegen step

    ggiraldez committed Feb 9, 2017
    Forking the process as it was previously done is no longer supported (and is not
    expected to be in the near future) and parallelization using threads is not yet
    possible because we are not using LLVM in a thread-safe way.
Commits on Feb 7, 2017
  1. Mutex for readers/writers in `IO::FileDescriptor`

    ggiraldez committed Feb 7, 2017
    - Add a mutex to protect access to `@readers` and `@WriterS` in
    - Install read/write event immediately if after a successful read/write there
      are still fibers pending on the fd. Ie. don't use the fiber callback in this
      case since it can be overwritten later by the next blocking operation (eg.
      channel IO)
    - Add logging in various classes participating in scheduling and concurrent
  2. Tidy up in Channel

    juanedi authored and Juan Edi committed Feb 7, 2017
    Remove duplicated code between send/receive and send_immediate/receive_immediate.