Skip to content

Commit

Permalink
Clean up a small bit of SharedState cruft.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed May 17, 2015
1 parent f11375d commit c6c12f3
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 57 deletions.
2 changes: 1 addition & 1 deletion vm/environment.cpp
Expand Up @@ -120,7 +120,7 @@ namespace rubinius {
delete finalizer_thread_;

VM::discard(state, root_vm);
SharedState::discard(shared);
delete shared;
delete state;

for(int i = 0; i < argc_; i++) {
Expand Down
19 changes: 0 additions & 19 deletions vm/shared_state.cpp
Expand Up @@ -56,8 +56,6 @@ namespace rubinius {
, username("")
, pid("")
{
ref();

internal_threads_ = new InternalThreads();

for(int i = 0; i < Primitives::cTotalPrimitives; i++) {
Expand Down Expand Up @@ -94,26 +92,12 @@ namespace rubinius {
delete internal_threads_;
}

void SharedState::add_managed_thread(ManagedThread* thr) {
SYNC_TL;
threads_.push_back(thr);
}

void SharedState::remove_managed_thread(ManagedThread* thr) {
SYNC_TL;
threads_.remove(thr);
}

int SharedState::size() {
return sizeof(SharedState) +
sizeof(WorldState) +
symbols.bytes_used();
}

void SharedState::discard(SharedState* ss) {
if(ss->deref()) delete ss;
}

uint32_t SharedState::new_thread_id() {
return atomic::fetch_and_add(&thread_ids_, 1);
}
Expand All @@ -129,8 +113,6 @@ namespace rubinius {
VM* vm = new VM(id, *this);
threads_.push_back(vm);

this->ref();

// If there is no root vm, then the first one created becomes it.
if(!root_vm_) root_vm_ = vm;
return vm;
Expand All @@ -139,7 +121,6 @@ namespace rubinius {
void SharedState::remove_vm(VM* vm) {
SYNC_TL;
threads_.remove(vm);
this->deref();

// Don't delete ourself here, it's too problematic.
}
Expand Down
8 changes: 1 addition & 7 deletions vm/shared_state.hpp
Expand Up @@ -3,7 +3,6 @@

#include "config.h"

#include "util/refcount.hpp"
#include "gc/variable_buffer.hpp"
#include "gc/root_buffer.hpp"

Expand Down Expand Up @@ -85,7 +84,7 @@ namespace rubinius {
* single process.
*/

class SharedState : public RefCount, public Lockable {
class SharedState : public Lockable {
private:
InternalThreads* internal_threads_;
SignalThread* signal_thread_;
Expand Down Expand Up @@ -150,8 +149,6 @@ namespace rubinius {
SharedState(Environment* env, Configuration& config, ConfigParser& cp);
~SharedState();

static void discard(SharedState* ss);

int size();

void set_initialized() {
Expand Down Expand Up @@ -188,9 +185,6 @@ namespace rubinius {

Array* vm_threads(STATE);

void add_managed_thread(ManagedThread* thr);
void remove_managed_thread(ManagedThread* thr);

int global_serial() const {
return global_serial_;
}
Expand Down
9 changes: 8 additions & 1 deletion vm/test/test.hpp
Expand Up @@ -8,6 +8,7 @@
#include "configuration.hpp"
#include "metrics.hpp"
#include "vm/detection.hpp"
#include "vm/gc/immix_marker.hpp"

#include <cxxtest/TestSuite.h>

Expand All @@ -30,8 +31,14 @@ class VMTest {
}

void destroy() {
if(ObjectMemory* om = state->memory()) {
if(ImmixMarker* im = om->immix_marker()) {
im->stop(state);
}
}

VM::discard(state, state->vm());
SharedState::discard(shared);
delete shared;
delete state;
}

Expand Down
28 changes: 0 additions & 28 deletions vm/util/refcount.hpp

This file was deleted.

1 change: 0 additions & 1 deletion vm/vm.hpp
Expand Up @@ -9,7 +9,6 @@
#include "gc/managed.hpp"
#include "vm_thread_state.hpp"

#include "util/refcount.hpp"
#include "util/thread.hpp"

#include "gc/variable_buffer.hpp"
Expand Down

0 comments on commit c6c12f3

Please sign in to comment.