Permalink
Switch branches/tags
Commits on Mar 29, 2013
  1. Plug memory leaks of DIBuilder

    ryoqun committed Mar 28, 2013
    Checked with LLVM 3.0, 3.1, 3.2, 3.3
Commits on Mar 28, 2013
  1. Use set inflated header helper where appropriate

    dbussink committed Mar 28, 2013
    We can use the set_inflated_header method in these two places instead of
    writing the same code manually.
  2. Use inflation functions consistently

    dbussink committed Mar 28, 2013
    We don't pass down the objectmemory to other similar methods, so don't
    do it for this one either. Also move find_index to the header so it can
    be inlined in places where it's used.
  3. Make error message more explicit about what the problem is

    dbussink committed Mar 28, 2013
    Apparently it still wasn't clear what the issue was, given we still got
    issues opened on this problem. Make it even more explicit so people
    hopefully read it all now and know how to solve it.
  4. Switch to LLVM 3.2 as the default for prebuilts

    dbussink committed Mar 28, 2013
    There are now prebuilt LLVM images for OS X 10.6, 10.7, 10.8 and Linux
    versions based on GCC 4.1, 4.2, 4.3, 4.4, 4.5, 4.6 and 4.7, both for
    i686 and x86_64 architectures. This should cover most of the systems
    that people use.
  5. Fix building for LLVM from source

    dbussink committed Mar 28, 2013
    Also removes old unused debugging tasks and uses system() like Daedalus
    does.
Commits on Mar 27, 2013
  1. Increase default IOBuffer size to 32k

    dbussink committed Mar 27, 2013
    Results in another significant performance increase for File.read, since
    it has to flush the buffer fewer times.
  2. Introduce ByteArray::create_dirty and use where safe

    dbussink committed Mar 27, 2013
    This allocates a ByteArray without zero'ing all the memory. This is for
    example useful when used in String::create, where the memory will be
    overwritten anyway. Other cases are where ByteArray used as backing
    store for Bignum and Regexp.
  3. Use a larger stack buffer when filling IOBuffer

    dbussink committed Mar 27, 2013
    Increases performance of reading IO, for example for File.read
  4. Clear all allocated bytes in ByteArray::create

    dbussink committed Mar 27, 2013
    This makes sure there are no non zero bytes in the resulting memory,
    which could result in information leakage for example that people would
    not expect.
  5. Ensure that the saved TZ is actually 0 terminated

    dbussink committed Mar 27, 2013
    Valgrind caught this by marking it as an uninitialized jump, because
    strcmp was used later on.
  6. Remove unneeded OnStack in VariableScope

    dbussink committed Mar 27, 2013
    The original problem was not due to the variable not being marked
    OnStack, but because of another initialization ordering issue. This was
    added during debugging, but should have been removed before committing
    the code.
  7. Merge pull request #2232 from YorickPeterse/master

    dbussink committed Mar 27, 2013
    Fix for retrieving UnboundMethod parameters
  8. Use a general reference check, not only cTrue

    dbussink committed Mar 27, 2013
    There shouldn't be any other immediates set than cTrue, but using a
    reference check is a better match for the needed behavior and would
    prevent a crash if anyone manages to set another immediate.
  9. Merge pull request #2239 from ryoqun/finalizer-gc-crash

    ryoqun committed Mar 27, 2013
    Fix Crash with ObjectSpace.define_finalizer(obj)
Commits on Mar 26, 2013
  1. Merge pull request #2238 from stouset/getbyte-gets-bytes-not-chars

    carlosgaldino committed Mar 26, 2013
    StringIO#getbyte should work in terms of bytes rather than characters
  2. Fix Crash with ObjectSpace.define_finalizer(obj)

    ryoqun committed Mar 26, 2013
    This code produces a crash:
    
        class Foo
          def __finalize__
          end
        end
        foo = Foo.new
    
        ObjectSpace.define_finalizer(foo)
        GC.run(true)
    
    When run:
    
        ---------------------------------------------
        CRASH: A fatal error has occurred.
    
        Backtrace:
        ./bin/rbx[0x4a5370]
        /lib/x86_64-linux-gnu/libc.so.6(+0x364a0)[0x7f5ab242e4a0]
        ./bin/rbx(_ZN8rubinius7BakerGC15walk_finalizersEv+0x69)[0x619bd9]
        ./bin/rbx(_ZN8rubinius7BakerGC7collectERNS_6GCDataEPNS_17YoungCollectStatsE+0x3a1)[0x61a031]
        ./bin/rbx(_ZN8rubinius12ObjectMemory13collect_youngERNS_6GCDataEPNS_17YoungCollectStatsE+0x66)[0x549de6]
        ./bin/rbx(_ZN8rubinius12ObjectMemory13collect_maybeEPNS_5StateERNS_11GCTokenImplEPNS_9CallFrameE+0x160)[0x54a170]
        ./bin/rbx(_ZN8rubinius2VM13collect_maybeERNS_11GCTokenImplEPNS_9CallFrameE+0x3f)[0x57f2ff]
        ./bin/rbx(_ZN8rubinius6System11vm_gc_startEPNS_5StateERNS_11GCTokenImplEPNS_6ObjectEPNS_9CallFrameE+0x31)[0x5e5091]
        ./bin/rbx(_ZN8rubinius10Primitives11vm_gc_startEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE+0xcf)[0x50e20f]
        ...
    
    ObjectSpace.define_finalizer stores cTrue as a finalizer placeholder in this
    case. And when GC runs, it doesn't consider there may be immediates and
    dereferences that cTrue. Thereby, a crash is waiting for you. :p
  3. Don't return before waking up condition

    dbussink committed Mar 26, 2013
    Fixes #2220
  4. Don't setup GC state around waiting for JIT requests in sync mode

    dbussink committed Mar 26, 2013
    The JIT thread itself managed the GC state of LLVMState, so we shouldn't
    interfere with that logic from the compile_soon logic that actually gets
    executed by another thread.
    
    Fixes #2226
  5. Make StringIO operations byte based

    dbussink committed Mar 26, 2013
    StringIO works like an IO object and basically operates on strings as
    them being byte arrays without encodings. This fixes a bunch of test
    failures on Nokogiri as well, which uses a StringIO internally and got
    results back with the wrong encoding.
    
    Also fixes #2163 because the wrong encoding came out, because the
    encoding aware methods used in StringIO before would change the encoding
    if a ASCII-8BIT string was written to the StringIO. With this change,
    they retain the original encoding, so things come out in the right
    encoding from Nokogiri.
  6. Prevent having to search twice when adding handle to slow handle set

    dbussink committed Mar 26, 2013
    This uses the return value of the insert to determine if the value was
    already in the set or not, so we only reference it if it was newly
    added.
  7. Use std::set since it never invalidates on insert()

    dbussink committed Mar 26, 2013
    When flushing handles, it can happen that new handles are added to the
    set. This mainly happens for cases where we flush an RArray handle,
    because that also gets handles for all elements in the array.
    
    std::tr1::unordered_set doesn't give the insert guarantees we need,
    namely:
    
    Iterator validity
    
    On most cases, all iterators in the container remain valid after the
    insertion. The only exception being when the growth of the container
    forces a rehash. In this case, all iterators in the container are
    invalidated.
    
    So if a rehash is forced, all iterators are invalid. This means we have
    undefined behavior that can result for example in crashes (which was
    happening in the Nokogiri test suite for example).
    
    std::set explicitly states it doesn't affect iterator validity, so it
    doesn't suffer from this problem. The downside is less performant
    insert() but there isn't really another option without redoing this
    completely.
  8. Merge pull request #2235 from ryoqun/valgrind-error-hits

    dbussink committed Mar 26, 2013
    Set hits to 0 for inline block's JITMethodInfo
  9. Set hits to 0 for inline block's JITMethodInfo

    ryoqun committed Mar 25, 2013
    This fixes the following valgrind error:
    
        ==13303== Thread 4:
        ==13303== Conditional jump or move depends on uninitialised value(s)
        ==13303==    at 0x7826ED: rubinius::Inliner::inline_for_class(rubinius::Class*, int) (inline.cpp:159)
        ==13303==    by 0x782312: rubinius::Inliner::consider_mono() (inline.cpp:35)
        ==13303==    by 0x7A9EFE: rubinius::JITVisit::visit_send_stack(unsigned long, unsigned long) (jit_visit.hpp:1481)
        ==13303==    by 0x7A1CD6: rubinius::VisitInstructions<rubinius::JITVisit>::dispatch(int) (jit_visit.hpp:1565)
        ==13303==    by 0x7A1426: rubinius::jit::Walker::call(rubinius::OpcodeIterator&) (jit_builder.cpp:554)
        ==13303==    by 0x7A11B4: void rubinius::jit::ControlFlowWalker::run<rubinius::jit::Walker>(rubinius::jit::Walker&) (control_flow.hpp:49)
        ==13303==    by 0x79FB30: rubinius::jit::Builder::generate_body() (jit_builder.cpp:591)
        ==13303==    by 0x788576: rubinius::Inliner::emit_inline_block(rubinius::JITInlineBlock*, llvm::Value*) (inline.cpp:648)
        ==13303==    by 0x78809A: rubinius::Inliner::inline_block(rubinius::JITInlineBlock*, llvm::Value*) (inline.cpp:284)
        ==13303==    by 0x7AD231: rubinius::JITVisit::visit_yield_stack(unsigned long) (jit_visit.hpp:2709)
        ==13303==    by 0x7A1E55: rubinius::VisitInstructions<rubinius::JITVisit>::dispatch(int) (instruction_visitors.hpp:62)
        ==13303==    by 0x7A1426: rubinius::jit::Walker::call(rubinius::OpcodeIterator&) (jit_builder.cpp:554)
        ==13303==
    
    This valgrind error is introduced by this commit:
    
    a787d83
        Don't inline calls for not often called methods
  10. Use RBOOL and CBOOL where appropriate

    dbussink committed Mar 26, 2013
    In a lot of places we used ? : or multiple return style to return Ruby
    boolean values. We have a helper for that, RBOOL so we might as well use
    it. Also switch to using CBOOL where it's appropriate for Ruby to C(++)
    boolean checks.