Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ab87c8c

Browse files
committedJul 8, 2015
Merge remote-tracking branch 'origin' into 1.8.7
2 parents c107d85 + 12b9902 commit ab87c8c

7 files changed

+88
-57
lines changed
 

‎vm/gc/baker.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ namespace rubinius {
6060
diagnostics::Diagnostics::log();
6161

6262
utilities::logger::write("baker: diagnostics: " \
63-
"collections: %ld, bytes: %ld" \
63+
"collections: %ld, bytes: %ld, " \
6464
"10%%: %ld, 20%%: %ld, 30%%: %ld, 40%%: %ld, 50%%: %ld, " \
6565
"60%%: %ld, 70%%: %ld, 80%%: %ld, 90%%: %ld",
6666
collections_, bytes_,

‎vm/gc/immix.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef RBX_GC_IMMIX
2-
#define RBX_GC_IMMIX
1+
#ifndef RBX_GC_IMMIX_HPP
2+
#define RBX_GC_IMMIX_HPP
33

44
#include "util/address.hpp"
55
#include "util/immix.hpp"

‎vm/gc/inflated_headers.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#ifndef RBX_GC_INFLATED_HEADERS_HPP
2+
#define RBX_GC_INFLATED_HEADERS_HPP
3+
14
#include <stddef.h>
25
#include <list>
36
#include "diagnostics.hpp"
@@ -55,3 +58,5 @@ namespace rubinius {
5558
}
5659
};
5760
}
61+
62+
#endif

‎vm/object_memory.cpp

+8-23
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
66
#include "config.h"
77
#include "vm.hpp"
88
#include "object_memory.hpp"
9+
910
#include "capi/tag.hpp"
11+
1012
#include "gc/mark_sweep.hpp"
1113
#include "gc/baker.hpp"
1214
#include "gc/immix.hpp"
1315
#include "gc/inflated_headers.hpp"
1416
#include "gc/walker.hpp"
1517

18+
#include "system_diagnostics.hpp"
19+
1620
#if ENABLE_LLVM
1721
#include "llvm/state.hpp"
1822
#endif
@@ -54,27 +58,6 @@ namespace rubinius {
5458

5559
Object* object_watch = 0;
5660

57-
void ObjectMemory::Diagnostics::log() {
58-
diagnostics::Diagnostics::log();
59-
60-
baker_->diagnostics().log();
61-
immix_->diagnostics().log();
62-
mark_sweep_->diagnostics().log();
63-
headers_->diagnostics().log();
64-
handles_->diagnostics().log();
65-
code_->diagnostics().log();
66-
symbols_->diagnostics().log();
67-
68-
utilities::logger::write("object memory: diagnostics: total memory: %ld",
69-
baker_->diagnostics().bytes_ +
70-
immix_->diagnostics().bytes_ +
71-
mark_sweep_->diagnostics().bytes_ +
72-
headers_->diagnostics().bytes_ +
73-
handles_->diagnostics().bytes_ +
74-
code_->diagnostics().bytes_ +
75-
symbols_->diagnostics().bytes_);
76-
}
77-
7861
/* ObjectMemory methods */
7962
ObjectMemory::ObjectMemory(VM* vm, SharedState& shared)
8063
: young_(new BakerGC(this, shared.config))
@@ -90,8 +73,10 @@ namespace rubinius {
9073
, mature_gc_in_progress_(false)
9174
, slab_size_(4096)
9275
, shared_(vm->shared)
93-
, diagnostics_(Diagnostics(young_, immix_, mark_sweep_,
94-
inflated_headers_, capi_handles_, &code_manager_, &shared.symbols))
76+
, diagnostics_(new diagnostics::ObjectDiagnostics(young_->diagnostics(),
77+
immix_->diagnostics(), mark_sweep_->diagnostics(),
78+
inflated_headers_->diagnostics(), capi_handles_->diagnostics(),
79+
code_manager_.diagnostics(), shared.symbols.diagnostics()))
9580
, collect_young_now(false)
9681
, collect_mature_now(false)
9782
, vm_(vm)

‎vm/object_memory.hpp

+6-28
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ namespace rubinius {
3535
class FinalizerThread;
3636
class ImmixMarker;
3737

38+
namespace diagnostics {
39+
class ObjectDiagnostics;
40+
}
41+
3842
namespace gc {
3943
class Slab;
4044
}
@@ -68,32 +72,6 @@ namespace rubinius {
6872
*/
6973

7074
class ObjectMemory : public gc::WriteBarrier {
71-
public:
72-
class Diagnostics : public diagnostics::Diagnostics {
73-
BakerGC* baker_;
74-
ImmixGC* immix_;
75-
MarkSweepGC* mark_sweep_;
76-
InflatedHeaders* headers_;
77-
capi::Handles* handles_;
78-
CodeManager* code_;
79-
SymbolTable* symbols_;
80-
81-
public:
82-
Diagnostics(BakerGC* baker, ImmixGC* immix, MarkSweepGC* mark_sweep,
83-
InflatedHeaders* inflated_headers, capi::Handles* capi_handles,
84-
CodeManager* code_manager, SymbolTable* symbols)
85-
: baker_(baker)
86-
, immix_(immix)
87-
, mark_sweep_(mark_sweep)
88-
, headers_(inflated_headers)
89-
, handles_(capi_handles)
90-
, code_(code_manager)
91-
, symbols_(symbols)
92-
{ }
93-
94-
void log();
95-
};
96-
9775
private:
9876
utilities::thread::SpinLock allocation_lock_;
9977
utilities::thread::SpinLock inflation_lock_;
@@ -145,7 +123,7 @@ namespace rubinius {
145123

146124
SharedState& shared_;
147125

148-
Diagnostics diagnostics_;
126+
diagnostics::ObjectDiagnostics* diagnostics_;
149127

150128
public:
151129
/// Flag indicating whether a young collection should be performed soon
@@ -342,7 +320,7 @@ namespace rubinius {
342320
mature_gc_in_progress_ = false;
343321
}
344322

345-
Diagnostics& diagnostics() {
323+
diagnostics::ObjectDiagnostics* diagnostics() {
346324
return diagnostics_;
347325
}
348326

‎vm/system_diagnostics.cpp

+26-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,33 @@
22

33
namespace rubinius {
44
namespace diagnostics {
5+
void ObjectDiagnostics::log() {
6+
bool summarize = baker_.modified_p() || immix_.modified_p() ||
7+
mark_sweep_.modified_p() || headers_.modified_p() ||
8+
handles_.modified_p() || code_.modified_p() || symbols_.modified_p();
9+
10+
baker_.log();
11+
immix_.log();
12+
mark_sweep_.log();
13+
headers_.log();
14+
handles_.log();
15+
code_.log();
16+
symbols_.log();
17+
18+
if(summarize) {
19+
utilities::logger::write("object memory: diagnostics: total memory: %ld",
20+
baker_.bytes_ +
21+
immix_.bytes_ +
22+
mark_sweep_.bytes_ +
23+
headers_.bytes_ +
24+
handles_.bytes_ +
25+
code_.bytes_ +
26+
symbols_.bytes_);
27+
}
28+
}
29+
530
void SystemDiagnostics::log() {
6-
memory_.log();
31+
memory_->log();
732
}
833
}
934
}

‎vm/system_diagnostics.hpp

+40-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,52 @@
33

44
#include "diagnostics.hpp"
55
#include "object_memory.hpp"
6+
#include "symbol_table.hpp"
7+
8+
#include "capi/handles.hpp"
9+
10+
#include "gc/baker.hpp"
11+
#include "gc/code_manager.hpp"
12+
#include "gc/immix.hpp"
13+
#include "gc/inflated_headers.hpp"
14+
#include "gc/mark_sweep.hpp"
615

716
namespace rubinius {
817
namespace diagnostics {
18+
class ObjectDiagnostics {
19+
rubinius::BakerGC::Diagnostics& baker_;
20+
rubinius::ImmixGC::Diagnostics& immix_;
21+
rubinius::MarkSweepGC::Diagnostics& mark_sweep_;
22+
rubinius::InflatedHeaders::Diagnostics& headers_;
23+
rubinius::capi::Handles::Diagnostics& handles_;
24+
rubinius::CodeManager::Diagnostics& code_;
25+
rubinius::SymbolTable::Diagnostics& symbols_;
26+
27+
public:
28+
ObjectDiagnostics(rubinius::BakerGC::Diagnostics& baker,
29+
rubinius::ImmixGC::Diagnostics& immix,
30+
rubinius::MarkSweepGC::Diagnostics& mark_sweep,
31+
rubinius::InflatedHeaders::Diagnostics& inflated_headers,
32+
rubinius::capi::Handles::Diagnostics& capi_handles,
33+
rubinius::CodeManager::Diagnostics& code_manager,
34+
rubinius::SymbolTable::Diagnostics& symbols)
35+
: baker_(baker)
36+
, immix_(immix)
37+
, mark_sweep_(mark_sweep)
38+
, headers_(inflated_headers)
39+
, handles_(capi_handles)
40+
, code_(code_manager)
41+
, symbols_(symbols)
42+
{ }
43+
44+
void log();
45+
};
46+
947
class SystemDiagnostics {
10-
rubinius::ObjectMemory::Diagnostics& memory_;
48+
ObjectDiagnostics* memory_;
1149

1250
public:
13-
SystemDiagnostics(rubinius::ObjectMemory::Diagnostics& memory)
51+
SystemDiagnostics(ObjectDiagnostics* memory)
1452
: memory_(memory)
1553
{ }
1654

0 commit comments

Comments
 (0)
Please sign in to comment.