Skip to content

Commit c6c12f3

Browse files
committed
Clean up a small bit of SharedState cruft.
1 parent f11375d commit c6c12f3

File tree

6 files changed

+10
-57
lines changed

6 files changed

+10
-57
lines changed

vm/environment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ namespace rubinius {
120120
delete finalizer_thread_;
121121

122122
VM::discard(state, root_vm);
123-
SharedState::discard(shared);
123+
delete shared;
124124
delete state;
125125

126126
for(int i = 0; i < argc_; i++) {

vm/shared_state.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ namespace rubinius {
5656
, username("")
5757
, pid("")
5858
{
59-
ref();
60-
6159
internal_threads_ = new InternalThreads();
6260

6361
for(int i = 0; i < Primitives::cTotalPrimitives; i++) {
@@ -94,26 +92,12 @@ namespace rubinius {
9492
delete internal_threads_;
9593
}
9694

97-
void SharedState::add_managed_thread(ManagedThread* thr) {
98-
SYNC_TL;
99-
threads_.push_back(thr);
100-
}
101-
102-
void SharedState::remove_managed_thread(ManagedThread* thr) {
103-
SYNC_TL;
104-
threads_.remove(thr);
105-
}
106-
10795
int SharedState::size() {
10896
return sizeof(SharedState) +
10997
sizeof(WorldState) +
11098
symbols.bytes_used();
11199
}
112100

113-
void SharedState::discard(SharedState* ss) {
114-
if(ss->deref()) delete ss;
115-
}
116-
117101
uint32_t SharedState::new_thread_id() {
118102
return atomic::fetch_and_add(&thread_ids_, 1);
119103
}
@@ -129,8 +113,6 @@ namespace rubinius {
129113
VM* vm = new VM(id, *this);
130114
threads_.push_back(vm);
131115

132-
this->ref();
133-
134116
// If there is no root vm, then the first one created becomes it.
135117
if(!root_vm_) root_vm_ = vm;
136118
return vm;
@@ -139,7 +121,6 @@ namespace rubinius {
139121
void SharedState::remove_vm(VM* vm) {
140122
SYNC_TL;
141123
threads_.remove(vm);
142-
this->deref();
143124

144125
// Don't delete ourself here, it's too problematic.
145126
}

vm/shared_state.hpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#include "config.h"
55

6-
#include "util/refcount.hpp"
76
#include "gc/variable_buffer.hpp"
87
#include "gc/root_buffer.hpp"
98

@@ -85,7 +84,7 @@ namespace rubinius {
8584
* single process.
8685
*/
8786

88-
class SharedState : public RefCount, public Lockable {
87+
class SharedState : public Lockable {
8988
private:
9089
InternalThreads* internal_threads_;
9190
SignalThread* signal_thread_;
@@ -150,8 +149,6 @@ namespace rubinius {
150149
SharedState(Environment* env, Configuration& config, ConfigParser& cp);
151150
~SharedState();
152151

153-
static void discard(SharedState* ss);
154-
155152
int size();
156153

157154
void set_initialized() {
@@ -188,9 +185,6 @@ namespace rubinius {
188185

189186
Array* vm_threads(STATE);
190187

191-
void add_managed_thread(ManagedThread* thr);
192-
void remove_managed_thread(ManagedThread* thr);
193-
194188
int global_serial() const {
195189
return global_serial_;
196190
}

vm/test/test.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "configuration.hpp"
99
#include "metrics.hpp"
1010
#include "vm/detection.hpp"
11+
#include "vm/gc/immix_marker.hpp"
1112

1213
#include <cxxtest/TestSuite.h>
1314

@@ -30,8 +31,14 @@ class VMTest {
3031
}
3132

3233
void destroy() {
34+
if(ObjectMemory* om = state->memory()) {
35+
if(ImmixMarker* im = om->immix_marker()) {
36+
im->stop(state);
37+
}
38+
}
39+
3340
VM::discard(state, state->vm());
34-
SharedState::discard(shared);
41+
delete shared;
3542
delete state;
3643
}
3744

vm/util/refcount.hpp

Lines changed: 0 additions & 28 deletions
This file was deleted.

vm/vm.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "gc/managed.hpp"
1010
#include "vm_thread_state.hpp"
1111

12-
#include "util/refcount.hpp"
1312
#include "util/thread.hpp"
1413

1514
#include "gc/variable_buffer.hpp"

0 commit comments

Comments
 (0)