Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: be424e03946f
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1dcc82aa338a
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Mar 2, 2016

  1. Copy the full SHA
    04ab979 View commit details

Commits on Mar 6, 2016

  1. Fixed synchronizing threads.

    brixen committed Mar 6, 2016
    Copy the full SHA
    63ab734 View commit details
  2. Fixed allocating GCData for concurrent marker.

    This GCData structure needs to be removed and STATE properly passed through
    the garbage collection methods.
    brixen committed Mar 6, 2016
    Copy the full SHA
    1dcc82a View commit details
Showing with 25 additions and 16 deletions.
  1. +13 −9 machine/memory.cpp
  2. +1 −1 machine/memory.hpp
  3. +3 −3 machine/test/test_object_memory.hpp
  4. +8 −3 machine/thread_nexus.cpp
22 changes: 13 additions & 9 deletions machine/memory.cpp
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ namespace rubinius {
, code_manager_(&vm->shared)
, mark_(2)
, allow_gc_(true)
, mature_mark_concurrent_(false /* TODO: GC shared.config.gc_immix_concurrent*/)
, mature_mark_concurrent_(shared.config.gc_immix_concurrent)
, mature_gc_in_progress_(false)
, slab_size_(4096)
, collect_young_flag_(false)
@@ -537,14 +537,12 @@ namespace rubinius {
}

if(collect_full_flag_) {
memory::GCData gc_data(state->vm());

RUBINIUS_GC_BEGIN(1);
if(unlikely(state->vm()->tooling())) {
tooling::GCEntry method(state, tooling::GCMature);
collect_full(state, &gc_data);
collect_full(state);
} else {
collect_full(state, &gc_data);
collect_full(state);
}
}

@@ -601,7 +599,7 @@ namespace rubinius {
collect_young_flag_ = false;
}

void Memory::collect_full(STATE, memory::GCData* data) {
void Memory::collect_full(STATE) {
timer::StopWatch<timer::milliseconds> timerx(
state->vm()->metrics().gc.immix_concurrent_ms);

@@ -613,17 +611,23 @@ namespace rubinius {
}

code_manager_.clear_marks();
clear_fiber_marks(data);

immix_->reset_stats();

// TODO: GC hacks hacks hacks fix fix fix.
if(mature_mark_concurrent_) {
memory::GCData* data = new memory::GCData(state->vm());

clear_fiber_marks(data);
immix_->start_marker(state);
immix_->collect_start(data);
mature_gc_in_progress_ = true;
} else {
immix_->collect(data);
collect_full_finish(state, data);
memory::GCData data(state->vm());

clear_fiber_marks(&data);
immix_->collect(&data);
collect_full_finish(state, &data);
}
}

2 changes: 1 addition & 1 deletion machine/memory.hpp
Original file line number Diff line number Diff line change
@@ -573,7 +573,7 @@ namespace rubinius {
}

void collect_young(STATE, memory::GCData* data);
void collect_full(STATE, memory::GCData* data);
void collect_full(STATE);
void collect_full_finish(STATE, memory::GCData* data);

public:
6 changes: 3 additions & 3 deletions machine/test/test_object_memory.hpp
Original file line number Diff line number Diff line change
@@ -322,7 +322,7 @@ class TestMemory : public CxxTest::TestSuite, public VMTest {
TS_ASSERT(!mature->marked_p(mark));
memory::Root r(roots, mature);

om.collect_full(state, gc_data);
om.collect_full(state);
// marker thread cleans up gc_data
gc_data = NULL;

@@ -343,7 +343,7 @@ class TestMemory : public CxxTest::TestSuite, public VMTest {
TS_ASSERT(!young->marked_p(mark));
memory::Root r(roots, young);

om.collect_full(state, gc_data);
om.collect_full(state);
gc_data = NULL;

TS_ASSERT(young->marked_p(mark));
@@ -367,7 +367,7 @@ class TestMemory : public CxxTest::TestSuite, public VMTest {

memory::Root r(roots, young);

om.collect_full(state, gc_data);
om.collect_full(state);
gc_data = NULL;

mature = as<Tuple>(young->field[0]);
11 changes: 8 additions & 3 deletions machine/thread_nexus.cpp
Original file line number Diff line number Diff line change
@@ -18,14 +18,17 @@ namespace rubinius {
}

bool ThreadNexus::blocking_p(VM* vm) {
atomic::memory_barrier();
return (vm->thread_phase() & cBlocking) == cBlocking;
}

bool ThreadNexus::sleeping_p(VM* vm) {
atomic::memory_barrier();
return (vm->thread_phase() & cSleeping) == cSleeping;
}

bool ThreadNexus::yielding_p(VM* vm) {
atomic::memory_barrier();
return (vm->thread_phase() & cYielding) == cYielding;
}

@@ -131,7 +134,7 @@ namespace rubinius {
}
}

#define RBX_MAX_STOP_NANOSECONDS 500000000
#define RBX_MAX_STOP_NANOSECONDS 5000000000

void ThreadNexus::detect_lock_deadlock(uint64_t nanoseconds, VM* vm) {
if(nanoseconds > RBX_MAX_STOP_NANOSECONDS) {
@@ -157,8 +160,10 @@ namespace rubinius {

uint64_t ThreadNexus::delay() {
static int i = 0;
static int delay[] = { 1, 21, 270, 482, 268, 169, 224, 481,
262, 79, 133, 448, 227, 249, 22 };
static int delay[] = {
133, 464, 254, 306, 549, 287, 358, 638, 496, 81,
472, 288, 131, 31, 435, 258, 221, 73, 537, 854
};
static int modulo = sizeof(delay) / sizeof(int);
static struct timespec ts = {0, 0};