Commits on Feb 6, 2013
  1. Remove trailing white space

    committed Feb 6, 2013
Commits on Feb 5, 2013
  1. Handle signals after pthread_cond_wait is interrupted

    There might be signals that need to be run if pthread_cond_wait is
    interrupted. Fixes #2093
    dbussink committed Feb 5, 2013
Commits on Feb 4, 2013
  1. Fixed Encoding::Converter#primitive_convert. Fixes #2139.

    The transcoders are restartable. Also removed the buffers for doing piece-wise
    conversions. The code had a latent GC bug in that at any ByteArray creation, a
    GC could occur and the Ruby objects on the stack (sourc, src, target) could move,
    leading to a segfault.
    brixen committed Feb 4, 2013
  2. Spec for round-trip encoding.

    brixen committed Feb 4, 2013
  3. Exit LLVM thread when stop is set

    When we are paused, a stop might be requested. This makes sure we check
    the stop_ and exit the thread if we have to. This prevents a deadlock /
    race for example if a just forked process exits immediately.
    dbussink committed Feb 4, 2013
  4. Move static definition outside function call

    Only in C++-03 this isn't defined as being thread safe, only in C++11.
    We should prefer using the style where we define these outside the
    functions so they are setup during load and not first execution of the
    For cases that we should not use static, we remove these so the
    functions are properly reentrant.
    dbussink committed Feb 4, 2013
Commits on Feb 3, 2013
  1. Remove peep hole optimization on JIT

    This optimization was problematic, since it assumed the called block was
    unpacking the block. This logic wasn't properly handled in at least 1.9
    mode, so removing this for now so we can design for a better version of
    Running the specs for datamapper/dm-core in 1.9 mode exposed this:
    dbussink committed Feb 3, 2013
Commits on Feb 2, 2013
  1. Setup Ruby side object for ThreadState

    For code that heavily uses ensure blocks, creating these thread state
    objects had quite a big overhead. We were abusing the Rubinius::Internal
    exception for this behavior and spend a lot of time for that code in
    symbol lookup for the instance variables.
    This solution removes the need for any symbol lookup and this also helps
    in concurrent scenarios since symbol lookup needs a lock around the
    symbol table.
    dbussink committed Feb 2, 2013
  2. Fix additional deadlocks when trying to pause

    The finalizer thread might have paused in a gc_dependent call so it
    might not be running. Therefore when we pause, if a thread state is not
    eRunning, we can also safely pause.
    This is safe because we also change to stop the world before trying to
    stop the auxiliary threads. This is also needed because other threads
    might actually be restarting stuff when they just did a fork after
    stopping auxiliary threads and before stopping all other threads.
    We also remove the gc_independent in the JIT, because it LLVM might have
    internal structures locked at that point and if we fork then, the new
    jit thread in the sub process can hang because of this locked thread.
    dbussink committed Feb 2, 2013
  3. Update Socket in 2.0 mode

    dbussink committed Feb 2, 2013
Commits on Feb 1, 2013
  1. Use explicit pausing around fork() for signal handler and finalizer

    This prevents deadlocks in situations where fork() is called from
    multiple threads. The problem is that it keeps spawning and killing
    threads that causes deadlocks in for example starting the thread in
    Thread::in_new_thread when the thread becomes GC dependent.
    The tricky interaction here between GC dependent and the worker_lock
    makes this solution much easier. We now define explicit pause points
    where it's fine that we can fork because these auxiliary threads aren't
    running any code at that point.
    These with all previous commits fixes #2138. This issues not only
    exposed the thread safety issue with the C-API constants but also caused
    the deadlocks that this commit and previous changes to the signal
    handler fixes.
    dbussink committed Feb 1, 2013
  2. Switch signal handler to use mutex and condition instead of pipes

    This matches the way the finalizer thread is setup and also solves
    inherent concurrency issues with using a pipe based solution here.
    dbussink committed Feb 1, 2013
Commits on Jan 31, 2013
  1. Ignore Fibers that have no more data

    During GC in the finalizers we might encounter fibers that have already
    been finalized and have the data cleaned up. We can just ignore these
    when this happens.
    dbussink committed Jan 31, 2013
  2. Ensure to reset the call frame before running finalizers

    The finalizers can trigger a GC and could try to scan the old call frame
    for the root vm that isn't valid anymore. Therefore we need to reset
    dbussink committed Jan 31, 2013
  3. Cleanup unused target VM

    dbussink committed Jan 31, 2013
  4. Move C-API constants into shared state

    This avoids having global data for C-API constants. It also makes it
    easier to wrap changes to these structures with a lock, which causes
    issues like #2138. This change therefore also adds that lock so the list
    of globals isn't modified concurrently.
    This also would improve future possibility of embedded, as long as
    people don't stuff things into global variables. The latter case is
    already problematic anyway for extensions, so this change doesn't make
    this problem worse and improves by not having the global state.
    dbussink committed Jan 31, 2013
  5. Move constants for C-Api constants into separate header file

    This makes it easier to remove the static global map we now keep and
    track this in the shared state. This also moves copied / shared header
    files between 1.8 and 1.9 C-Api into a separate header and copies them
    for the different modes.
    The mri_oop.h file was created staticly from the configure script. If
    it's static anyway, we might as well copy it from a file instead of
    having it all inline in configure.
    dbussink committed Jan 31, 2013