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: 22a22247fa8b
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3e4bb4168db6
Choose a head ref
  • 6 commits
  • 15 files changed
  • 1 contributor

Commits on Jan 30, 2015

  1. Copy the full SHA
    2997c30 View commit details
  2. Copy the full SHA
    1abe847 View commit details
  3. Checkpoint before fork().

    brixen committed Jan 30, 2015
    Copy the full SHA
    0ceab02 View commit details
  4. Updated compiler version.

    brixen committed Jan 30, 2015
    Copy the full SHA
    8b1d557 View commit details
  5. Updated gems_list.txt.

    brixen committed Jan 30, 2015
    Copy the full SHA
    cfe1af5 View commit details
  6. Copy the full SHA
    3e4bb41 View commit details
Showing with 71 additions and 40 deletions.
  1. +1 −1 Gemfile.lock
  2. +2 −2 gems_list.txt
  3. +3 −2 kernel/common/process.rb
  4. +1 −1 library/rubinius/configuration.rb
  5. +15 −5 vm/builtin/system.cpp
  6. +14 −15 vm/gc/finalize.cpp
  7. +2 −0 vm/gc/finalize.hpp
  8. +8 −8 vm/lock.hpp
  9. +8 −0 vm/metrics.cpp
  10. +5 −0 vm/park.cpp
  11. +1 −0 vm/park.hpp
  12. +4 −2 vm/shared_state.cpp
  13. +1 −1 vm/state.hpp
  14. +5 −1 vm/vm.cpp
  15. +1 −2 vm/vm.hpp
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ GEM
rubinius-melbourne (~> 2.0)
rubinius-processor (~> 2.0)
rubinius-toolset (~> 2.0)
rubinius-compiler (2.3.0)
rubinius-compiler (2.3.1)
rubinius-melbourne (2.3.1.0)
rubinius-processor (2.3.0)
rubinius-toolset (2.3.1)
4 changes: 2 additions & 2 deletions gems_list.txt
Original file line number Diff line number Diff line change
@@ -11,11 +11,11 @@ rdoc-4.2.0.gem
redcard-1.1.0.gem
rubinius-ast-2.3.1.gem
rubinius-build_tools-2.0.0.gem
rubinius-compiler-2.3.0.gem
rubinius-compiler-2.3.1.gem
rubinius-coverage-2.0.3.gem
rubinius-debugger-2.2.0.gem
rubinius-developer_tools-2.0.0.gem
rubinius-melbourne-2.3.0.0.gem
rubinius-melbourne-2.3.1.0.gem
rubinius-processor-2.3.0.gem
rubinius-profiler-2.0.1.gem
rubinius-toolset-2.3.1.gem
5 changes: 3 additions & 2 deletions kernel/common/process.rb
Original file line number Diff line number Diff line change
@@ -329,8 +329,9 @@ def self.setpriority(kind, id, priority)

def self.groups
g = []
FFI::MemoryPointer.new(:int, @maxgroups) { |p|
num_groups = FFI::Platform::POSIX.getgroups(@maxgroups, p)
count = Rubinius::FFI::Platform::POSIX.getgroups(0, nil)
FFI::MemoryPointer.new(:int, count) { |p|
num_groups = FFI::Platform::POSIX.getgroups(count, p)
Errno.handle if num_groups == -1
g = p.read_array_of_int(num_groups)
}
2 changes: 1 addition & 1 deletion library/rubinius/configuration.rb
Original file line number Diff line number Diff line change
@@ -200,7 +200,7 @@
s.vm_variable "metrics.statsd.server", "localhost:8125",
"The [host:]port of the StatsD server"

s.vm_variable "metrics.statsd.prefix", "host.$nodename.app.rbx",
s.vm_variable "metrics.statsd.prefix", "host.$nodename.$pid.app.rbx",
"Prefix for StatsD metric names"
end
end
20 changes: 15 additions & 5 deletions vm/builtin/system.cpp
Original file line number Diff line number Diff line change
@@ -382,15 +382,21 @@ namespace rubinius {
return cNil;
}

static int fork_exec(STATE, int errors_fd) {
static int fork_exec(STATE, GCToken gct, CallFrame* call_frame, int errors_fd) {
utilities::thread::Mutex::LockGuard guard(state->shared().fork_exec_lock());

state->shared().auxiliary_threads()->before_fork_exec(state);

// If execvp() succeeds, we'll read EOF and know.
fcntl(errors_fd, F_SETFD, FD_CLOEXEC);

int pid = ::fork();
int pid;

{
StopTheWorld stw(state, gct, call_frame);

pid = ::fork();
}

if(pid > 0) {
state->shared().auxiliary_threads()->after_fork_exec_parent(state);
@@ -416,7 +422,7 @@ namespace rubinius {
return NULL;
}

int pid = fork_exec(state, errors[1]);
int pid = fork_exec(state, gct, calling_environment, errors[1]);

// error
if(pid == -1) {
@@ -524,7 +530,7 @@ namespace rubinius {
return NULL;
}

int pid = fork_exec(state, errors[1]);
int pid = fork_exec(state, gct, calling_environment, errors[1]);

// error
if(pid == -1) {
@@ -783,7 +789,11 @@ namespace rubinius {

state->shared().auxiliary_threads()->before_fork(state);

pid = ::fork();
{
StopTheWorld stw(state, gct, calling_environment);

pid = ::fork();
}

if(pid > 0) {
state->shared().auxiliary_threads()->after_fork_parent(state);
29 changes: 14 additions & 15 deletions vm/gc/finalize.cpp
Original file line number Diff line number Diff line change
@@ -99,12 +99,7 @@ namespace rubinius {
lists_ = new FinalizeObjectsList();
live_list_ = new FinalizeObjects();

live_guard_.init();
worker_lock_.init();
worker_cond_.init();

supervisor_lock_.init();
supervisor_cond_.init();
initialize(state);
}

FinalizerHandler::~FinalizerHandler() {
@@ -121,6 +116,18 @@ namespace rubinius {
}
}

void FinalizerHandler::initialize(STATE) {
live_guard_.init();
worker_lock_.init();
worker_cond_.init();
supervisor_lock_.init();
supervisor_cond_.init();
thread_exit_ = false;
thread_running_ = false;
finishing_ = false;
vm_ = NULL;
}

void FinalizerHandler::start_thread(STATE) {
SYNC(state);
if(vm_) return;
@@ -165,15 +172,7 @@ namespace rubinius {
}

void FinalizerHandler::after_fork_child(STATE) {
live_guard_.init();
worker_lock_.init();
worker_cond_.init();
supervisor_lock_.init();
supervisor_cond_.init();
thread_exit_ = false;
thread_running_ = false;
finishing_ = false;
vm_ = NULL;
initialize(state);

start_thread(state);
}
2 changes: 2 additions & 0 deletions vm/gc/finalize.hpp
Original file line number Diff line number Diff line change
@@ -127,6 +127,8 @@ namespace rubinius {
void supervisor_wait();
void wakeup();

void initialize(STATE);

void start_thread(STATE);
void stop_thread(STATE);

16 changes: 8 additions & 8 deletions vm/lock.hpp
Original file line number Diff line number Diff line change
@@ -69,7 +69,7 @@ namespace rubinius {
lock_line_ = line;
}

void unlock(ManagedThread* th) {
void unlock() {
locking_thread_ = 0;
utilities::thread::Mutex::unlock();
lock_file_ = "";
@@ -97,7 +97,7 @@ namespace rubinius {
lock_line_ = line;
}

void unlock(ManagedThread* th) {
void unlock() {
locking_thread_ = 0;
utilities::thread::SpinLock::unlock();
lock_file_ = "";
@@ -138,9 +138,9 @@ namespace rubinius {

~ScopeLock() {
if(Mutex* mutex = lock_->as_mutex()) {
mutex->unlock(thread_);
mutex->unlock();
} else if(SpinLock* sl = lock_->as_spinlock()) {
sl->unlock(thread_);
sl->unlock();
} else {
std::cerr << "Syncronize used with confusing lock type.\n";
}
@@ -169,8 +169,8 @@ namespace rubinius {
mutex_.lock(th, file, line);
}

void unlock(ManagedThread* th) {
mutex_.unlock(th);
void unlock() {
mutex_.unlock();
}
};

@@ -205,7 +205,7 @@ namespace rubinius {

if(locked_) {
locked_ = false;
lock_->unlock(thread_);
lock_->unlock();
}
}

@@ -219,7 +219,7 @@ namespace rubinius {
}

~LockableScopedLock() {
if(locked_) lock_->unlock(thread_);
if(locked_) lock_->unlock();
}
};

8 changes: 8 additions & 0 deletions vm/metrics.cpp
Original file line number Diff line number Diff line change
@@ -116,6 +116,14 @@ namespace rubinius {
prefix_ = prefix;
}

index = prefix_.find("$pid");
if(index != std::string::npos) {
std::ostringstream pid;
pid << getpid();

prefix_.replace(index, strlen("$pid"), pid.str());
}

if(prefix_.size() > 0) prefix_ += ".";

initialize();
5 changes: 5 additions & 0 deletions vm/park.cpp
Original file line number Diff line number Diff line change
@@ -66,4 +66,9 @@ namespace rubinius {

return timeout;
}

void Park::reset_parked() {
mutex_.init();
cond_.init();
}
}
1 change: 1 addition & 0 deletions vm/park.hpp
Original file line number Diff line number Diff line change
@@ -32,6 +32,7 @@ namespace rubinius {
return sleeping_;
}

void reset_parked();
Object* park(STATE, CallFrame* call_frame);
Object* park_timed(STATE, CallFrame* call_frame, struct timespec* ts);
};
6 changes: 4 additions & 2 deletions vm/shared_state.cpp
Original file line number Diff line number Diff line change
@@ -204,7 +204,9 @@ namespace rubinius {
thread->stopped();
}

vm->unlock(state->vm());
vm->unlock();
vm->reset_parked();

delete vm;
}
}
@@ -332,7 +334,7 @@ namespace rubinius {
void SharedState::leave_capi(STATE) {
NativeMethodEnvironment* env = state->vm()->native_method_environment;
if(int lock_index = env->current_native_frame()->capi_lock_index()) {
capi_locks_[lock_index - 1]->unlock(state->vm());
capi_locks_[lock_index - 1]->unlock();
}
}

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

void unlock() {
vm_->unlock(vm_);
vm_->unlock();
}

Object* park(GCToken gct, CallFrame* call_frame);
6 changes: 5 additions & 1 deletion vm/vm.cpp
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@ namespace rubinius {
vm->lock(state->vm());
vm->saved_call_frame_ = 0;
vm->shared.remove_vm(vm);
vm->unlock(state->vm());
vm->unlock();

state->vm()->metrics()->system_metrics.vm_threads--;

@@ -445,6 +445,10 @@ namespace rubinius {
thread->sleep(this, cFalse);
}

void VM::reset_parked() {
park_->reset_parked();
}

void VM::register_raise(STATE, Exception* exc) {
SYNC(state);
interrupted_exception_.set(exc);
3 changes: 1 addition & 2 deletions vm/vm.hpp
Original file line number Diff line number Diff line change
@@ -434,8 +434,7 @@ namespace rubinius {
void clear_waiter();
bool wakeup(STATE, GCToken gct, CallFrame* call_frame);

void set_parked();
void set_unparked();
void reset_parked();

void set_sleeping();
void clear_sleeping();