Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed May 5, 2016
2 parents 4d20704 + e6eb8c4 commit e30409d
Show file tree
Hide file tree
Showing 71 changed files with 15,748 additions and 347 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Expand Up @@ -4,7 +4,7 @@ GEM
daedalus-core (0.5.0)
rake (10.5.0)
redcard (1.1.0)
rubinius-ast (3.5)
rubinius-ast (3.6)
rubinius-bridge (2.2)
redcard (~> 1.0)
rubinius-code (3.0)
Expand All @@ -14,7 +14,7 @@ GEM
rubinius-melbourne (~> 3)
rubinius-processor (~> 3)
rubinius-toolset (~> 3)
rubinius-compiler (3.3)
rubinius-compiler (3.4)
rubinius-instructions (3.0)
rubinius-melbourne (3.5)
rubinius-processor (3.0)
Expand Down
7 changes: 6 additions & 1 deletion core/proc.rb
Expand Up @@ -96,7 +96,12 @@ def arity
return arity < 0 ? -1 : arity
end

@block.arity
arity = @block.arity
return arity if self.lambda? ||
@block.compiled_code.splat ||
@block.compiled_code.total_args == arity

-arity - 1
end

alias_method :===, :call
Expand Down
4 changes: 2 additions & 2 deletions gems_list.txt
Expand Up @@ -9,10 +9,10 @@ rake-10.5.0.gem
rb-readline-0.5.3.gem
rdoc-4.2.2.gem
redcard-1.1.0.gem
rubinius-ast-3.5.gem
rubinius-ast-3.6.gem
rubinius-bridge-2.2.gem
rubinius-code-3.0.gem
rubinius-compiler-3.3.gem
rubinius-compiler-3.4.gem
rubinius-coverage-2.0.3.gem
rubinius-debugger-2.4.gem
rubinius-developer_tools-2.0.0.gem
Expand Down
51 changes: 31 additions & 20 deletions library/rubinius/configuration.rb
Expand Up @@ -182,38 +182,49 @@
s.vm_variable "tmp", "$TMPDIR",
"Default temp/fallback directory for the process"

s.vm_variable "console.path", "$TMPDIR/$PROGRAM_NAME-$USER-console",
"Path for Rubinius Console connection file"
s.section "console" do |c|
c.vm_variable "path", "$TMPDIR/$PROGRAM_NAME-$USER-console",
"Path for Rubinius Console connection file"

s.vm_variable "console.access", 0660,
"Permissions on the Rubinius Console connection file"
c.vm_variable "access", 0660,
"Permissions on the Rubinius Console connection file"
end

s.vm_variable "log", "$TMPDIR/$PROGRAM_NAME-$USER.log",
"Logging facility to use: 'syslog', 'console', or path"

s.vm_variable "log.limit", (10 * 1024 * 1024),
"The maximum size of the log file before log rotation is performed"
s.section "log" do |l|
l.vm_variable "limit", (10 * 1024 * 1024),
"The maximum size of the log file before log rotation is performed"

s.vm_variable "log.archives", 5,
"The number of prior logs that will be saved as '$(system.log).N.Z' zip files"
l.vm_variable "archives", 5,
"The number of prior logs that will be saved as '$(system.log).N.Z' zip files"

s.vm_variable "log.access", 0600,
"Permissions on the log file"
l.vm_variable "access", 0600,
"Permissions on the log file"

s.vm_variable "log.level", "warn",
"Logging level: fatal, error, warn, info, debug"
l.vm_variable "level", "warn",
"Logging level: fatal, error, warn, info, debug"
end

s.vm_variable "metrics.interval", 10000,
"Number of milliseconds between aggregation of VM metrics"
s.section "metrics" do |m|
m.vm_variable "interval", 10000,
"Number of milliseconds between aggregation of VM metrics"

s.vm_variable "metrics.target", "none",
"Location to send metrics every interval: 'statsd', path"
m.vm_variable "target", "none",
"Location to send metrics every interval: 'statsd', path"

s.vm_variable "metrics.statsd.server", "localhost:8125",
"The [host:]port of the StatsD server"
m.vm_variable "statsd.server", "localhost:8125",
"The [host:]port of the StatsD server"

s.vm_variable "metrics.statsd.prefix", "host.$nodename.$pid.app.rbx",
"Prefix for StatsD metric names"
m.vm_variable "statsd.prefix", "host.$nodename.$pid.app.rbx",
"Prefix for StatsD metric names"
end

s.section "diagnostics" do |d|
d.vm_variable "target", "none",
"Location to send diagnostics: host:port, path"
end
end
end

2 changes: 2 additions & 0 deletions machine/builtin/thread.cpp
@@ -1,6 +1,7 @@
#include "memory.hpp"
#include "call_frame.hpp"
#include "environment.hpp"
#include "diagnostics.hpp"
#include "metrics.hpp"
#include "object_utils.hpp"
#include "on_stack.hpp"
Expand Down Expand Up @@ -326,6 +327,7 @@ namespace rubinius {

state->shared().start_console(state);
state->shared().start_metrics(state);
state->shared().start_diagnostics(state);

Object* klass = G(rubinius)->get_const(state, state->symbol("Loader"));
if(klass->nil_p()) {
Expand Down
31 changes: 13 additions & 18 deletions machine/capi/handles.cpp
Expand Up @@ -11,14 +11,7 @@

namespace rubinius {
namespace capi {
void Handles::Diagnostics::log() {
if(!modified_p()) return;

diagnostics::Diagnostics::log();

logger::write("C-API handles: diagnostics: " \
"objects: %ld, bytes: %ld, collections: %ld\n",
objects_, bytes_, collections_);
void Handles::Diagnostics::update() {
}

Handle* Handles::allocate(STATE, Object* obj) {
Expand All @@ -27,7 +20,7 @@ namespace rubinius {
handle->set_object(obj);
handle->validate();
if(needs_gc) {
diagnostics_.collections_++;
diagnostics()->collections_++;
state->memory()->schedule_full_collection(
"CAPI handles",
state->vm()->metrics().gc.handles_set);
Expand All @@ -48,7 +41,7 @@ namespace rubinius {
handle->set_object(obj);
handle->validate();
if(needs_gc) {
diagnostics_.collections_++;
diagnostics()->collections_++;
state->memory()->schedule_full_collection(
"CAPI handles",
state->vm()->metrics().gc.handles_set);
Expand All @@ -73,15 +66,18 @@ namespace rubinius {
}
}
}

delete allocator_;

if(diagnostics()) delete diagnostics();
}

void Handles::deallocate_handles(std::list<Handle*>* cached,
unsigned int mark, /* BakerGC */ void* young)
{
std::vector<bool> chunk_marks(allocator_->chunks_.size(), false);

diagnostics_.objects_ = 0;
diagnostics()->objects_ = 0;

for(std::vector<int>::size_type i = 0; i < allocator_->chunks_.size(); ++i) {
Handle* chunk = allocator_->chunks_[i];
Expand All @@ -98,7 +94,7 @@ namespace rubinius {
// Strong references will already have been updated.
if(!handle->weak_p()) {
chunk_marks[i] = true;
diagnostics_.objects_++;
diagnostics()->objects_++;
continue;
}

Expand All @@ -111,12 +107,12 @@ namespace rubinius {
// a collection. In this state, valid objects are only in current.
if(young->in_current_p(obj)) {
chunk_marks[i] = true;
diagnostics_.objects_++;
diagnostics()->objects_++;
// A weakref pointing to a forwarded young object
} else if(obj->forwarded_p()) {
handle->set_object(obj->forward());
chunk_marks[i] = true;
diagnostics_.objects_++;
diagnostics()->objects_++;
// A weakref pointing to a dead young object
} else {
handle->clear();
Expand All @@ -125,7 +121,7 @@ namespace rubinius {
// Not a young object, so won't be GC'd so mark
// chunk as still active
chunk_marks[i] = true;
diagnostics_.objects_++;
diagnostics()->objects_++;
}
*/

Expand All @@ -134,7 +130,7 @@ namespace rubinius {
handle->clear();
} else {
chunk_marks[i] = true;
diagnostics_.objects_++;
diagnostics()->objects_++;
}
}
}
Expand All @@ -152,8 +148,7 @@ namespace rubinius {

allocator_->rebuild_freelist(&chunk_marks);

diagnostics_.bytes_ = allocator_->in_use_ * sizeof(Handle);
diagnostics_.modify();
diagnostics()->bytes_ = allocator_->in_use_ * sizeof(Handle);
}
}
}
8 changes: 4 additions & 4 deletions machine/capi/handles.hpp
Expand Up @@ -24,19 +24,19 @@ namespace rubinius {
, collections_(0)
{ }

void log();
void update();
};

private:
memory::Allocator<Handle>* allocator_;

Diagnostics diagnostics_;
Diagnostics* diagnostics_;

public:

Handles()
: allocator_(new memory::Allocator<Handle>())
, diagnostics_(Diagnostics())
, diagnostics_(new Diagnostics())
{}

~Handles();
Expand All @@ -63,7 +63,7 @@ namespace rubinius {
return allocator_->in_use_;
}

Diagnostics& diagnostics() {
Diagnostics* diagnostics() {
return diagnostics_;
}
};
Expand Down

0 comments on commit e30409d

Please sign in to comment.