Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into 1.8.7
Browse files Browse the repository at this point in the history
Conflicts:
	kernel/common/gc.rb
	vm/builtin/data.cpp
	vm/llvm/state.cpp
  • Loading branch information
brixen committed Jun 26, 2015
2 parents d0d184f + 47fcb42 commit bbf6cfa
Show file tree
Hide file tree
Showing 34 changed files with 363 additions and 436 deletions.
2 changes: 2 additions & 0 deletions vm/builtin/block_environment.cpp
Expand Up @@ -83,6 +83,8 @@ namespace rubinius {
}
}

state->vm()->metrics().machine.blocks_invoked++;

#ifdef ENABLE_LLVM
if(executor ptr = mcode->unspecialized) {
return (*((BlockExecutor)ptr))(state, previous, env, args, invocation);
Expand Down
8 changes: 8 additions & 0 deletions vm/builtin/call_site.cpp
Expand Up @@ -80,6 +80,8 @@ namespace rubinius {
}
}

state->vm()->metrics().machine.methods_invoked++;

call_site->update(state, recv_class, dis);

Executable* meth = dis.method;
Expand Down Expand Up @@ -112,6 +114,8 @@ namespace rubinius {
}
}

state->vm()->metrics().machine.methods_invoked++;

call_site->update(state, recv_class, dis);

Executable* meth = dis.method;
Expand Down Expand Up @@ -146,6 +150,8 @@ namespace rubinius {
}
}

state->vm()->metrics().machine.methods_invoked++;

call_site->update(state, recv_class, dis);

Executable* meth = dis.method;
Expand Down Expand Up @@ -201,6 +207,8 @@ namespace rubinius {
state->vm()->global_cache()->add_seen(state, call_site->name());
}

state->vm()->metrics().machine.methods_invoked++;

call_site->update(state, recv_class, dis);

Executable* meth = dis.method;
Expand Down
2 changes: 1 addition & 1 deletion vm/builtin/data.cpp
Expand Up @@ -42,7 +42,7 @@ namespace rubinius {
state->memory()->needs_finalization(data, (FinalizerFunction)&Data::finalize);
}

state->vm()->metrics().m.ruby_metrics.memory_data_objects++;
state->vm()->metrics().memory.data_objects++;

return data;
}
Expand Down
12 changes: 6 additions & 6 deletions vm/builtin/io.cpp
Expand Up @@ -620,7 +620,7 @@ namespace rubinius {
data += wrote;
bytes -= wrote;

state->vm()->metrics().system_metrics.io_write_bytes += wrote;
state->vm()->metrics().system.write_bytes += wrote;
}
}
}
Expand Down Expand Up @@ -704,7 +704,7 @@ namespace rubinius {
return cNil;
}

state->vm()->metrics().system_metrics.io_read_bytes += bytes_read;
state->vm()->metrics().system.read_bytes += bytes_read;

String* str = String::create(state, buf, bytes_read);
if(malloc_buf) free(malloc_buf);
Expand Down Expand Up @@ -753,7 +753,7 @@ namespace rubinius {

if(bytes_read == 0) return cNil;

state->vm()->metrics().system_metrics.io_read_bytes += bytes_read;
state->vm()->metrics().system.read_bytes += bytes_read;

buffer->num_bytes(state, Fixnum::from(bytes_read));
return buffer;
Expand Down Expand Up @@ -808,7 +808,7 @@ namespace rubinius {
left -= cnt;
cur += cnt;

state->vm()->metrics().system_metrics.io_write_bytes += cnt;
state->vm()->metrics().system.write_bytes += cnt;
}
}

Expand Down Expand Up @@ -836,7 +836,7 @@ namespace rubinius {
int n = ::write(descriptor_->to_native(), buf->byte_address(), buf_size);
if(n == -1) Exception::errno_error(state, "write_nonblock");

state->vm()->metrics().system_metrics.io_write_bytes += n;
state->vm()->metrics().system.write_bytes += n;

return Fixnum::from(n);
}
Expand Down Expand Up @@ -1487,7 +1487,7 @@ namespace rubinius {
}
memcpy(self->at_unused(), temp_buffer, bytes_read);
self->read_bytes(state, bytes_read);
state->vm()->metrics().system_metrics.io_read_bytes += bytes_read;
state->vm()->metrics().system.read_bytes += bytes_read;
}

return Fixnum::from(bytes_read);
Expand Down
2 changes: 2 additions & 0 deletions vm/builtin/mono_inline_cache.cpp
Expand Up @@ -70,6 +70,7 @@ namespace rubinius {

if(likely(cache->receiver_.raw == recv_data)) {
cache->hits_++;
state->vm()->metrics().machine.methods_invoked++;
return cache->method_->execute(state, call_frame, cache->method_, cache->stored_module_, args);
}

Expand All @@ -86,6 +87,7 @@ namespace rubinius {

if(likely(cache->receiver_.raw == recv_data)) {
cache->hits_++;
state->vm()->metrics().machine.methods_invoked++;
state->vm()->set_method_missing_reason(cache->method_missing_);
args.unshift(state, call_site->name_);
return cache->method_->execute(state, call_frame, cache->method_, cache->stored_module_, args);
Expand Down
1 change: 0 additions & 1 deletion vm/builtin/native_function.cpp
Expand Up @@ -338,7 +338,6 @@ namespace rubinius {
// Apparently we're running in a new thread here, setup
// everything we need here.
vm = stub->shared->new_vm();
vm->metrics().init(metrics::eRubyMetrics);

// Detect the stack size and set it up in the VM object
size_t stack_size;
Expand Down
1 change: 1 addition & 0 deletions vm/builtin/native_method.hpp
Expand Up @@ -41,6 +41,7 @@ namespace rubinius {
, current_native_frame_(0)
, current_ep_(0)
, outgoing_block_(0)
, metrics_()
{}

/** Obtain the NativeMethodEnvironment for this thread. */
Expand Down
2 changes: 2 additions & 0 deletions vm/builtin/poly_inline_cache.cpp
Expand Up @@ -103,6 +103,7 @@ namespace rubinius {
Executable* meth = entry->method();
Module* mod = entry->stored_module();
entry->hit();
state->vm()->metrics().machine.methods_invoked++;

return meth->execute(state, call_frame, meth, mod, args);
}
Expand All @@ -126,6 +127,7 @@ namespace rubinius {
Executable* meth = entry->method();
Module* mod = entry->stored_module();
entry->hit();
state->vm()->metrics().machine.methods_invoked++;

return meth->execute(state, call_frame, meth, mod, args);
}
Expand Down
2 changes: 1 addition & 1 deletion vm/builtin/system.cpp
Expand Up @@ -805,7 +805,7 @@ namespace rubinius {
state->vm()->global_cache()->clear(state, name);
mod->reset_method_cache(state, name);

state->vm()->metrics().system_metrics.vm_inline_cache_resets++;
state->vm()->metrics().machine.inline_cache_resets++;

if(state->shared().config.ic_debug) {
String* mod_name = mod->get_name(state);
Expand Down
3 changes: 1 addition & 2 deletions vm/builtin/thread.cpp
Expand Up @@ -84,7 +84,6 @@ namespace rubinius {

Thread* Thread::create(STATE, Object* self, ThreadFunction function) {
VM* vm = state->shared().new_vm();
vm->metrics().init(metrics::eRubyMetrics);

Thread* thr = Thread::create(state, as<Class>(self), vm);

Expand All @@ -93,7 +92,7 @@ namespace rubinius {
state->memory()->needs_finalization(thr, (FinalizerFunction)&Thread::finalize,
FinalizeObject::eUnmanaged);

state->vm()->metrics().system_metrics.vm_threads_created++;
state->vm()->metrics().system.threads_created++;

return thr;
}
Expand Down
4 changes: 2 additions & 2 deletions vm/console.cpp
Expand Up @@ -128,7 +128,7 @@ namespace rubinius {
req = new char[bytes+1];
memcpy(req, buf, bytes);
req[bytes] = 0;
metrics().m.console_metrics.requests_received++;
vm()->metrics().console.requests_received++;
} else if(bytes < 0) {
logger::error("%s: console: unable to read request", strerror(errno));
}
Expand Down Expand Up @@ -270,7 +270,7 @@ namespace rubinius {
logger::error("%s: console: unable to write response", strerror(errno));
}

metrics().m.console_metrics.responses_sent++;
vm()->metrics().console.responses_sent++;
}

void Response::run(STATE) {
Expand Down
1 change: 0 additions & 1 deletion vm/drivers/jit-test.cpp
Expand Up @@ -23,7 +23,6 @@ int main(int argc, char **argv) {
ConfigParser * config = new ConfigParser;
shared->user_config = config;
VM* state = shared->new_vm();
state->metrics()->init(metrics::eRubyMetrics);

state->initialize(VM::default_bytes);
state->boot();
Expand Down
1 change: 0 additions & 1 deletion vm/environment.cpp
Expand Up @@ -104,7 +104,6 @@ namespace rubinius {
check_io_descriptors();

root_vm = shared->new_vm("rbx.ruby.main");
root_vm->metrics().init(metrics::eRubyMetrics);
state = new State(root_vm);

loader_ = new TypedRoot<Object*>(state);
Expand Down
6 changes: 2 additions & 4 deletions vm/gc/finalize.cpp
Expand Up @@ -124,8 +124,6 @@ namespace rubinius {
void FinalizerThread::run(STATE) {
GCTokenImpl gct;

metrics().init(metrics::eFinalizerMetrics);

state->gc_dependent(gct, 0);

while(!thread_exit_) {
Expand Down Expand Up @@ -260,7 +258,7 @@ namespace rubinius {
process_list_ = NULL;
process_item_kind_ = eRuby;
lists_->pop_back();
metrics().m.finalizer_metrics.objects_finalized++;
vm()->metrics().gc.objects_finalized++;
break;
}
}
Expand Down Expand Up @@ -321,7 +319,7 @@ namespace rubinius {
// Makes a copy of fi.
live_list_->push_front(fi);

metrics().m.finalizer_metrics.objects_queued++;
vm()->metrics().gc.objects_queued++;
}

void FinalizerThread::set_ruby_finalizer(Object* obj, Object* finalizer) {
Expand Down
2 changes: 1 addition & 1 deletion vm/gc/immix.cpp
Expand Up @@ -19,7 +19,7 @@ namespace rubinius {
#endif

if(object_memory_) {
object_memory_->state()->metrics().m.ruby_metrics.memory_immix_chunks++;
object_memory_->state()->metrics().memory.immix_chunks++;

if(gc_->dec_chunks_left() <= 0) {
gc_->reset_chunks_left();
Expand Down
6 changes: 2 additions & 4 deletions vm/gc/immix_marker.cpp
Expand Up @@ -73,15 +73,13 @@ namespace rubinius {
void ImmixMarker::run(STATE) {
GCTokenImpl gct;

metrics().init(metrics::eRubyMetrics);

state->gc_dependent(gct, 0);

while(!thread_exit_) {
if(data_) {
{
timer::StopWatch<timer::milliseconds> timer(
state->vm()->metrics().m.ruby_metrics.gc_immix_concurrent_ms);
state->vm()->metrics().gc.immix_concurrent_ms);

// Allow for a young stop the world GC to occur
// every bunch of marks. 100 is a fairly arbitrary
Expand All @@ -98,7 +96,7 @@ namespace rubinius {

{
timer::StopWatch<timer::milliseconds> timer(
state->vm()->metrics().m.ruby_metrics.gc_immix_stop_ms);
state->vm()->metrics().gc.immix_stop_ms);

// Finish and pause
while(!state->stop_the_world()) {
Expand Down
3 changes: 1 addition & 2 deletions vm/gc/managed.cpp
Expand Up @@ -15,6 +15,7 @@ namespace rubinius {
: shared_(ss)
, run_state_(eIndependent)
, kind_(kind)
, metrics_()
, os_thread_(pthread_self())
, id_(id)
{
Expand All @@ -25,8 +26,6 @@ namespace rubinius {
thread_name << "rbx.ruby." << id_;
name_ = thread_name.str();
}

metrics_.init(metrics::eNone);
}

ManagedThread::~ManagedThread() {
Expand Down
11 changes: 5 additions & 6 deletions vm/gc/mark_sweep.cpp
Expand Up @@ -53,8 +53,8 @@ namespace rubinius {

entries.push_back(obj);

object_memory_->state()->metrics().m.ruby_metrics.memory_large_objects++;
object_memory_->state()->metrics().m.ruby_metrics.memory_large_bytes += bytes;
object_memory_->state()->metrics().memory.large_objects++;
object_memory_->state()->metrics().memory.large_bytes += bytes;

next_collection_bytes -= bytes;
if(next_collection_bytes < 0) {
Expand All @@ -73,8 +73,8 @@ namespace rubinius {

last_freed++;

object_memory_->state()->metrics().m.ruby_metrics.memory_large_objects--;
object_memory_->state()->metrics().m.ruby_metrics.memory_large_bytes -=
object_memory_->state()->metrics().memory.large_objects--;
object_memory_->state()->metrics().memory.large_bytes -=
obj->size_in_bytes(object_memory_->state());
}

Expand Down Expand Up @@ -122,8 +122,7 @@ namespace rubinius {
void MarkSweepGC::after_marked() {
metrics::MetricsData& metrics = object_memory_->state()->metrics();

timer::StopWatch<timer::milliseconds> timer(
metrics.m.ruby_metrics.gc_large_sweep_ms);
timer::StopWatch<timer::microseconds> timer(metrics.gc.large_sweep_us);

last_freed = 0;

Expand Down
1 change: 0 additions & 1 deletion vm/internal_threads.cpp
Expand Up @@ -15,7 +15,6 @@ namespace rubinius {
: vm_(state->shared().new_vm(name.c_str()))
, thread_running_(false)
, stack_size_(stack_size)
, metrics_(vm_->metrics())
, thread_exit_(false)
{
state->shared().internal_threads()->register_thread(this);
Expand Down
10 changes: 0 additions & 10 deletions vm/internal_threads.hpp
Expand Up @@ -10,19 +10,13 @@ namespace rubinius {
class InternalThread;
class VM;

namespace metrics {
struct MetricsData;
}

typedef std::list<InternalThread*> InternalThreadList;

class InternalThread {
VM* vm_;
bool thread_running_;
uint32_t stack_size_;

metrics::MetricsData& metrics_;

protected:

bool thread_exit_;
Expand Down Expand Up @@ -57,10 +51,6 @@ namespace rubinius {
return vm_;
}

metrics::MetricsData& metrics() {
return metrics_;
}

virtual void initialize(STATE);
virtual void start(STATE);
virtual void start_thread(STATE);
Expand Down

0 comments on commit bbf6cfa

Please sign in to comment.