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: e36a12597f58
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 98288bfcce92
Choose a head ref
  • 11 commits
  • 48 files changed
  • 2 contributors

Commits on Jun 28, 2015

  1. More Metrics cleanup.

    brixen committed Jun 28, 2015
    Copy the full SHA
    1132e25 View commit details

Commits on Jun 30, 2015

  1. Copy the full SHA
    f35dfb5 View commit details

Commits on Jul 1, 2015

  1. Added config items -Xsystem.log.limit, -Xsystem.log.archives.

    The -Xsystem.log.limit sets the maximum size of the -Xsystem.log file
    before log rotation is performed. The -Xsystem.log.archives sets the
    number of prior log files that are retained as zip files.
    brixen committed Jul 1, 2015
    Copy the full SHA
    e5769d6 View commit details
  2. Fixed include for Linux.

    brixen committed Jul 1, 2015
    Copy the full SHA
    f52655e View commit details
  3. Fixed header file for GCC.

    brixen committed Jul 1, 2015
    Copy the full SHA
    0808464 View commit details

Commits on Jul 3, 2015

  1. Copy the full SHA
    677a149 View commit details

Commits on Jul 7, 2015

  1. Added Rubinius::Diagnostics.

    brixen committed Jul 7, 2015
    Copy the full SHA
    dff4b12 View commit details
  2. Copy the full SHA
    c660bba View commit details
  3. Fixed BakerGC diagnostics.

    brixen committed Jul 7, 2015
    Copy the full SHA
    a292fce View commit details
  4. Merge remote-tracking branch 'origin' into 1.8.7

    Conflicts:
    	vm/builtin/object.cpp
    	vm/symbol_table.cpp
    	vm/symbol_table.hpp
    	vm/test/test_symbol_table.hpp
    brixen committed Jul 7, 2015
    Copy the full SHA
    554a9a1 View commit details
  5. Copy the full SHA
    98288bf View commit details
Showing with 728 additions and 288 deletions.
  1. +9 −0 library/rubinius/configuration.rb
  2. +1 −0 rakelib/vm.rake
  3. +3 −1 vm/builtin/bignum.hpp
  4. +12 −0 vm/builtin/diagnostics.cpp
  5. +35 −0 vm/builtin/diagnostics.hpp
  6. +6 −4 vm/builtin/executable.cpp
  7. +2 −2 vm/builtin/executable.hpp
  8. +1 −1 vm/builtin/native_function.cpp
  9. +22 −1 vm/capi/handles.cpp
  10. +20 −1 vm/capi/handles.hpp
  11. +1 −1 vm/codegen/field_extract.rb
  12. +42 −0 vm/diagnostics.hpp
  13. +11 −2 vm/environment.cpp
  14. +11 −1 vm/environment.hpp
  15. +20 −4 vm/gc/baker.cpp
  16. +34 −0 vm/gc/baker.hpp
  17. +18 −0 vm/gc/code_manager.cpp
  18. +23 −0 vm/gc/code_manager.hpp
  19. +2 −2 vm/gc/gc.cpp
  20. +1 −1 vm/gc/gc.hpp
  21. +44 −79 vm/gc/immix.cpp
  22. +27 −0 vm/gc/immix.hpp
  23. +2 −0 vm/gc/inflated_headers.cpp
  24. +16 −0 vm/gc/inflated_headers.hpp
  25. +25 −72 vm/gc/mark_sweep.cpp
  26. +18 −5 vm/gc/mark_sweep.hpp
  27. +2 −2 vm/gc/object_mark.cpp
  28. +1 −1 vm/gc/object_mark.hpp
  29. +4 −2 vm/llvm/inline.cpp
  30. +2 −1 vm/llvm/jit_compiler.cpp
  31. +3 −1 vm/llvm/state.cpp
  32. +6 −0 vm/llvm/state.hpp
  33. +1 −1 vm/machine_code.cpp
  34. +10 −0 vm/metrics.cpp
  35. +5 −1 vm/metrics.hpp
  36. +41 −39 vm/object_memory.cpp
  37. +43 −19 vm/object_memory.hpp
  38. +2 −0 vm/ontology.cpp
  39. +2 −0 vm/oop.cpp
  40. +30 −10 vm/symbol_table.cpp
  41. +21 −3 vm/symbol_table.hpp
  42. +9 −0 vm/system_diagnostics.cpp
  43. +22 −0 vm/system_diagnostics.hpp
  44. +0 −2 vm/test/test_object_memory.hpp
  45. +7 −0 vm/test/test_symbol_table.hpp
  46. +99 −23 vm/util/logger.cpp
  47. +11 −5 vm/util/logger.hpp
  48. +1 −1 vm/vm.cpp
9 changes: 9 additions & 0 deletions library/rubinius/configuration.rb
Original file line number Diff line number Diff line change
@@ -167,6 +167,15 @@
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.vm_variable "log.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"

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

1 change: 1 addition & 0 deletions rakelib/vm.rake
Original file line number Diff line number Diff line change
@@ -116,6 +116,7 @@ field_extract_headers = %w[
vm/builtin/atomic.hpp
vm/builtin/thread_state.hpp
vm/builtin/jit.hpp
vm/builtin/diagnostics.hpp
]

transcoders_src_dir = File.expand_path "../../vendor/oniguruma/enc/trans", __FILE__
4 changes: 3 additions & 1 deletion vm/builtin/bignum.hpp
Original file line number Diff line number Diff line change
@@ -2,12 +2,14 @@
#define RBX_BUILTIN_BIGNUM_HPP

#include "tommath.h"

#include "builtin/integer.hpp"

namespace rubinius {
class Array;
class String;
class Fixnum;
class Float;
class String;

class Bignum : public Integer {
public:
12 changes: 12 additions & 0 deletions vm/builtin/diagnostics.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "builtin/class.hpp"
#include "builtin/diagnostics.hpp"
#include "builtin/lookup_table.hpp"

namespace rubinius {
void Diagnostics::init(STATE) {
Module* diagnostics = state->new_object<Diagnostics>(G(module));
diagnostics->setup(state, "Diagnostics", G(rubinius));

diagnostics->set_const(state, "Map", LookupTable::create(state));
}
}
35 changes: 35 additions & 0 deletions vm/builtin/diagnostics.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef RBX_BUILTIN_DIAGNOSTICS_HPP
#define RBX_BUILTIN_DIAGNOSTICS_HPP

#include "builtin/class.hpp"
#include "builtin/module.hpp"
#include "builtin/object.hpp"

#include "object_utils.hpp"
#include "diagnostics.hpp"

namespace rubinius {
class LookupTable;

class Diagnostics : public Module {
public:
const static object_type type = DiagnosticsType;

private:
LookupTable* map_; // slot

public:
attr_accessor(map, LookupTable);

public:
static void init(STATE);


class Info : public Module::Info {
public:
BASIC_TYPEINFO(Module::Info)
};
};
}

#endif
10 changes: 6 additions & 4 deletions vm/builtin/executable.cpp
Original file line number Diff line number Diff line change
@@ -62,8 +62,10 @@ namespace rubinius {
return dis.send(state, call_frame, args);
}

void Executable::add_inliner(ObjectMemory* om, CompiledCode* code) {
if(!inliners_ || inliners_ == (Inliners*)cNil) inliners_ = new Inliners(om);
void Executable::add_inliner(STATE, ObjectMemory* om, CompiledCode* code) {
if(!inliners_ || inliners_ == (Inliners*)cNil) {
inliners_ = new Inliners(state, om);
}
inliners_->inliners().push_back(code);

om->write_barrier(this, code);
@@ -106,8 +108,8 @@ namespace rubinius {
}
}

Inliners::Inliners(ObjectMemory* om) {
om->add_code_resource(this);
Inliners::Inliners(STATE, ObjectMemory* om) {
om->add_code_resource(state, this);
}

void Inliners::cleanup(STATE, CodeManager* cm) {
4 changes: 2 additions & 2 deletions vm/builtin/executable.hpp
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ namespace rubinius {
std::vector<CompiledCode*> inliners_;

public:
Inliners(ObjectMemory* om);
Inliners(STATE, ObjectMemory* om);

std::vector<CompiledCode*>& inliners() {
return inliners_;
@@ -81,7 +81,7 @@ namespace rubinius {

bool resolve_primitive(STATE);

void add_inliner(ObjectMemory* om, CompiledCode* code);
void add_inliner(STATE, ObjectMemory* om, CompiledCode* code);
void clear_inliners(STATE);

class Info : public TypeInfo {
2 changes: 1 addition & 1 deletion vm/builtin/native_function.cpp
Original file line number Diff line number Diff line change
@@ -264,7 +264,7 @@ namespace rubinius {
rubinius::bug("ffi_prep_cif failed");
}

state->shared().om->add_code_resource(data);
state->shared().om->add_code_resource(state, data);
this->ffi_data = data;
}

23 changes: 22 additions & 1 deletion vm/capi/handles.cpp
Original file line number Diff line number Diff line change
@@ -3,18 +3,30 @@
#include "gc/baker.hpp"
#include "capi/capi.hpp"
#include "capi/handles.hpp"
#include "util/logger.hpp"

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

diagnostics::Diagnostics::log();

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

Handle* Handles::allocate(STATE, Object* obj) {
bool needs_gc = false;
Handle* handle = allocator_->allocate(&needs_gc);
handle->set_object(obj);
handle->validate();
if(needs_gc) {
diagnostics_.collections_++;
state->memory()->collect_mature_now = true;
}
diagnostics_.objects_++;
atomic::memory_barrier();
return handle;
}
@@ -29,8 +41,10 @@ namespace rubinius {
handle->set_object(obj);
handle->validate();
if(needs_gc) {
diagnostics_.collections_++;
state->memory()->collect_mature_now = true;
}
diagnostics_.objects_++;
atomic::memory_barrier();

if(handle_index > UINT32_MAX) {
@@ -58,7 +72,9 @@ namespace rubinius {
delete allocator_;
}

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

for(std::vector<int>::size_type i = 0; i < allocator_->chunks_.size(); ++i) {
@@ -94,6 +110,7 @@ namespace rubinius {
// A weakref pointing to a dead young object
} else {
handle->clear();
diagnostics_.objects_--;
}
} else {
// Not a young object, so won't be GC'd so mark
@@ -104,6 +121,7 @@ namespace rubinius {
// A weakref pointing to a dead mature object
} else if(!obj->marked_p(mark)) {
handle->clear();
diagnostics_.objects_--;
} else {
chunk_marks[i] = true;
}
@@ -122,6 +140,9 @@ namespace rubinius {
}

allocator_->rebuild_freelist(&chunk_marks);

diagnostics_.bytes_ = allocator_->in_use_;
diagnostics_.modify();
}
}
}
21 changes: 20 additions & 1 deletion vm/capi/handles.hpp
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
#ifndef RBX_CAPI_HANDLES_HPP
#define RBX_CAPI_HANDLES_HPP

#include "diagnostics.hpp"
#include "vm.hpp"
#include "gc/root.hpp"
#include "util/allocator.hpp"
#include "capi/handle.hpp"

#include <vector>
#include <stdint.h>

namespace rubinius {
class BakerGC;

namespace capi {

class Handles {
public:
class Diagnostics : public diagnostics::MemoryDiagnostics {
public:
int64_t collections_;

Diagnostics()
: diagnostics::MemoryDiagnostics()
, collections_(0)
{ }

void log();
};

private:
Allocator<Handle>* allocator_;

Diagnostics diagnostics_;

public:

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

~Handles();
@@ -48,6 +64,9 @@ namespace rubinius {
return allocator_->in_use_;
}

Diagnostics& diagnostics() {
return diagnostics_;
}
};
}
}
2 changes: 1 addition & 1 deletion vm/codegen/field_extract.rb
Original file line number Diff line number Diff line change
@@ -744,7 +744,7 @@ def generate_marks(cpp)
if(target->#{name}()->reference_p()) {
Object* old = target->#{name}();
Object* cur = mark.call(old);
if(cur && cur != old) target->#{name}(mark.state(), force_as<#{type}>(cur));
if(cur && cur != old) target->#{name}(mark.vm(), force_as<#{type}>(cur));
}
}
42 changes: 42 additions & 0 deletions vm/diagnostics.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#ifndef RBX_DIAGNOSTICS_HPP
#define RBX_DIAGNOSTICS_HPP

#include <stdint.h>

namespace rubinius {
namespace diagnostics {
class Diagnostics {
bool modified_;

public:
Diagnostics() : modified_(false) { }
virtual ~Diagnostics() { }

virtual void log() {
modified_ = false;
}

bool modified_p() {
return modified_;
}

void modify() {
modified_ = true;
}
};

class MemoryDiagnostics : public Diagnostics {
public:
int64_t objects_;
int64_t bytes_;

MemoryDiagnostics()
: Diagnostics()
, objects_(0)
, bytes_(0)
{ }
};
}
}

#endif
13 changes: 11 additions & 2 deletions vm/environment.cpp
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@
#include "config_parser.hpp"
#include "compiled_file.hpp"
#include "object_memory.hpp"

#include "exception.hpp"
#include "system_diagnostics.hpp"

#include "builtin/array.hpp"
#include "builtin/class.hpp"
@@ -207,6 +207,11 @@ namespace rubinius {
finalizer_thread_->start(state);
}

void Environment::start_diagnostics(STATE) {
diagnostics_ = new diagnostics::SystemDiagnostics(
state->shared().memory()->diagnostics());
}

void Environment::start_logging(STATE) {
utilities::logger::logger_level level = utilities::logger::eWarn;

@@ -232,7 +237,10 @@ namespace rubinius {
expand_config_value(config.system_log.value, "$USER", shared->username.c_str());

utilities::logger::open(utilities::logger::eFileLogger,
config.system_log.value.c_str(), level);
config.system_log.value.c_str(), level,
config.system_log_limit.value,
config.system_log_archives.value,
config.system_log_access.value);
}
}

@@ -833,6 +841,7 @@ namespace rubinius {
load_platform_conf(runtime);
boot_vm();

start_diagnostics(state);
start_finalizer(state);

load_argv(argc_, argv_);
Loading