Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Small cleanup of source

Removes some unused stuff and marks appropriate stuff as const.
  • Loading branch information...
commit 627bf39d6a6be783a736fabb0e3040bcecf55d19 1 parent 1e54637
@dbussink dbussink authored
View
2  vm/builtin/fixnum.hpp
@@ -18,7 +18,7 @@ namespace rubinius {
/* WARNING. Do not use this version if +num+ has the chance of being
* greater than FIXNUM_MAX or less than FIXNUM_MIN. */
static Fixnum* from(native_int num) {
- return (Fixnum*)APPLY_FIXNUM_TAG(num);
+ return reinterpret_cast<Fixnum*>(APPLY_FIXNUM_TAG(num));
}
native_int to_native() const {
View
4 vm/builtin/nativemethod.cpp
@@ -142,10 +142,6 @@ namespace rubinius {
return 0; // keep compiler happy
}
- void NativeMethodEnvironment::delete_global(VALUE val) {
- rubinius::bug("NME::delete_global was used");
- }
-
Object* NativeMethodEnvironment::block() {
if(!current_native_frame_) return cNil;
return get_object(current_native_frame_->block());
View
3  vm/builtin/nativemethod.hpp
@@ -47,9 +47,6 @@ namespace rubinius {
/** Create or retrieve VALUE for obj. */
VALUE get_handle(Object* obj);
- /** Delete a global Object and its VALUE. */
- void delete_global(VALUE handle);
-
/** GC marking for Objects behind VALUEs. */
void mark_handles(ObjectMark& mark);
View
2  vm/builtin/symbol.hpp
@@ -17,7 +17,7 @@ namespace rubinius {
const static object_type type = SymbolType;
static Symbol* from_index(size_t index) {
- return (Symbol*)APPLY_SYMBOL_TAG(index);
+ return reinterpret_cast<Symbol*>(APPLY_SYMBOL_TAG(index));
}
native_int index() const;
View
1  vm/call_frame.hpp
@@ -225,7 +225,6 @@ namespace rubinius {
VariableScope* promote_scope_full(STATE);
VariableScope* promote_scope(STATE) {
- if(!scope) rubinius::bug("bad CallFrame to promote");
if(VariableScope* vs = scope->on_heap()) return vs;
return promote_scope_full(state);
}
View
9 vm/codegen/field_extract.rb
@@ -9,18 +9,9 @@ class BasicPrimitive
attr_accessor :safe
attr_accessor :can_fail
- def emit_counter
- @@counter ||= 0
- str = " check_counter(state, call_frame, #{@@counter});\n"
- @@counter += 1
- return str
- end
-
def output_header(str)
str << "Object* Primitives::#{@name}(STATE, CallFrame* call_frame, Executable* exec, Module* mod, Arguments& args) {\n"
str << " state->set_call_frame(call_frame);\n"
- str << emit_counter
- # str << " std::cout << \"[Primitive #{@name}]\\n\";\n"
str << " Object* ret;\n"
return str if @raw
str << " Object* self;\n" if @pass_self
View
3  vm/gc/baker.cpp
@@ -160,7 +160,6 @@ namespace rubinius {
check_growth_start();
- Object* tmp;
ObjectArray *current_rs = object_memory_->swap_remember_set();
total_objects = 0;
@@ -172,7 +171,7 @@ namespace rubinius {
for(ObjectArray::iterator oi = current_rs->begin();
oi != current_rs->end();
++oi) {
- tmp = *oi;
+ Object* tmp = *oi;
// unremember_object throws a NULL in to remove an object
// so we don't have to compact the set in unremember
if(tmp) {
View
18 vm/gc/code_manager.cpp
@@ -140,24 +140,6 @@ namespace rubinius {
}
}
- int CodeManager::calculate_size() {
- Chunk* chunk = first_chunk_;
-
- int total = 0;
-
- while(chunk) {
- for(int i = 0; i < chunk_size_; i++) {
- if(CodeResource* cr = chunk->resources[i]) {
- total += cr->size();
- }
- }
-
- chunk = chunk->next;
- }
-
- return total;
- }
-
void CodeManager::clear_marks() {
Chunk* chunk = first_chunk_;
View
5 vm/gc/code_manager.hpp
@@ -81,6 +81,10 @@ namespace rubinius {
return bytes_used_;
}
+ size_t size() const {
+ return bytes_used_;
+ }
+
public:
CodeManager(SharedState* shared, int chunk_size=cDefaultChunkSize);
~CodeManager();
@@ -88,7 +92,6 @@ namespace rubinius {
void add_resource(CodeResource* cr, bool* collect_now);
void clear_marks();
void sweep();
- int calculate_size();
private:
void add_chunk();
View
2  vm/gc/gc.cpp
@@ -479,7 +479,7 @@ namespace rubinius {
}
}
- size_t GCData::jit_bytes_allocated() {
+ size_t GCData::jit_bytes_allocated() const {
#ifdef ENABLE_LLVM
if(llvm_state_) {
return llvm_state_->code_bytes();
View
10 vm/gc/gc.hpp
@@ -101,23 +101,23 @@ namespace rubinius {
}
#endif
- size_t young_bytes_allocated() {
+ size_t young_bytes_allocated() const {
return young_bytes_allocated_;
}
- size_t mature_bytes_allocated() {
+ size_t mature_bytes_allocated() const {
return mature_bytes_allocated_;
}
- size_t code_bytes_allocated() {
+ size_t code_bytes_allocated() const {
return code_bytes_allocated_;
}
- size_t symbol_bytes_allocated() {
+ size_t symbol_bytes_allocated() const {
return symbol_bytes_allocated_;
}
- size_t jit_bytes_allocated();
+ size_t jit_bytes_allocated() const;
};
class AddressDisplacement {
View
36 vm/gc/marksweep.cpp
@@ -185,42 +185,6 @@ namespace rubinius {
<< " objects: " << i->second.objects << "\n"
<< " bytes: " << i->second.bytes << "\n";
}
-
- /*
- int count = 0;
-
- for(std::list<Object*>::reverse_iterator i = entries.rbegin();
- i != entries.rend();
- i++) {
- Object* obj = *i;
- if(ByteArray* ba = try_as<ByteArray>(obj)) {
- ba->show(object_memory_->state());
- if(++count == 10) break;
- }
- }
- */
-
- /*
- std::list<Object*> sorted = entries;
- sorted.sort(sort_by_size);
-
- std::list<Object*>::iterator i;
-
- std::cout << "Top 30:\n";
-
- int count = 0;
-
- for(i = sorted.begin(); i != sorted.end();) {
- Object* obj = *i;
-
- size_t sz = obj->size_in_bytes(object_memory_->state());
-
- std::cout << obj->to_s(object_memory_->state(), true)->c_str() << " bytes=" << sz << "\n";
- if(++count == 30) break;
-
- i++;
- }
- */
}
ObjectPosition MarkSweepGC::validate_object(Object* obj) {
View
3  vm/gc/walker.cpp
@@ -20,13 +20,12 @@ namespace rubinius {
}
void ObjectWalker::seed(GCData& data) {
- Object* tmp;
ObjectArray *current_rs = object_memory_->remember_set();
for(ObjectArray::iterator oi = current_rs->begin();
oi != current_rs->end();
++oi) {
- tmp = *oi;
+ Object* tmp = *oi;
// unremember_object throws a NULL in to remove an object
// so we don't have to compact the set in unremember
if(tmp) saw_object(tmp);
View
17 vm/method_primitives.cpp
@@ -26,23 +26,6 @@ namespace rubinius {
return cNil;
}
-#ifdef ENABLE_LLVM
- void Primitives::queue_for_jit(STATE, CallFrame* call_frame, int which) {
- // LLVMState* ls = LLVMState::get(state);
- // ls->compile_callframe(state, 0, call_frame, which);
- }
-#endif
-
- static inline void check_counter(STATE, CallFrame* call_frame, int which) {
-#ifdef ENABLE_LLVM
- int& hits = state->shared().primitive_hits(which);
- if(hits >= 0 && ++hits >= state->shared().config.jit_call_til_compile) {
- hits = -1;
- Primitives::queue_for_jit(state, call_frame, which);
- }
-#endif
- }
-
#include "gen/method_primitives.cpp"
#include "gen/method_resolver.cpp"
}
View
10 vm/objectmemory.cpp
@@ -807,23 +807,23 @@ namespace rubinius {
}
}
- size_t ObjectMemory::young_bytes_allocated() {
+ size_t ObjectMemory::young_bytes_allocated() const {
return young_->bytes_size();
}
- size_t ObjectMemory::mature_bytes_allocated() {
+ size_t ObjectMemory::mature_bytes_allocated() const {
return immix_->bytes_allocated() + mark_sweep_->allocated_bytes;
}
- size_t ObjectMemory::code_bytes_allocated() {
+ size_t ObjectMemory::code_bytes_allocated() const {
return code_manager_.size();
}
- size_t ObjectMemory::symbol_bytes_allocated() {
+ size_t ObjectMemory::symbol_bytes_allocated() const {
return shared_.symbols.size();
}
- size_t ObjectMemory::jit_bytes_allocated() {
+ size_t ObjectMemory::jit_bytes_allocated() const {
#if ENABLE_LLVM
return shared_.llvm_state->code_bytes();
#else
View
10 vm/objectmemory.hpp
@@ -373,11 +373,11 @@ namespace rubinius {
ObjectPosition validate_object(Object* obj);
bool valid_young_object_p(Object* obj);
- size_t young_bytes_allocated();
- size_t mature_bytes_allocated();
- size_t code_bytes_allocated();
- size_t symbol_bytes_allocated();
- size_t jit_bytes_allocated();
+ size_t young_bytes_allocated() const;
+ size_t mature_bytes_allocated() const;
+ size_t code_bytes_allocated() const;
+ size_t symbol_bytes_allocated() const;
+ size_t jit_bytes_allocated() const;
void collect_maybe(STATE, GCToken gct, CallFrame* call_frame);
View
2  vm/oop.hpp
@@ -553,7 +553,7 @@ Object* const cUndef = reinterpret_cast<Object*>(0x22L);
void set_untrusted(int val=1);
- uint32_t object_id(STATE) {
+ uint32_t object_id(STATE) const {
// Pull this out into a local so that we don't see any concurrent
// changes to header.
HeaderWord tmp = header;
View
4 vm/primitives.hpp
@@ -77,10 +77,6 @@ namespace rubinius {
return reinterpret_cast<Object*>(kPrimitiveFailed);
}
-#ifdef ENABLE_LLVM
- static void queue_for_jit(STATE, CallFrame* call_frame, int which);
-#endif
-
/*
* The primitive generator emits one 'executor' function per
* primitive. This simply checks the argument types and then
View
2  vm/shared_state.cpp
@@ -232,7 +232,7 @@ namespace rubinius {
world_->become_independent(state);
}
- const unsigned int* SharedState::object_memory_mark_address() {
+ const unsigned int* SharedState::object_memory_mark_address() const {
return om->mark_address();
}
View
2  vm/shared_state.hpp
@@ -279,7 +279,7 @@ namespace rubinius {
return &check_global_interrupts_;
}
- const unsigned int* object_memory_mark_address();
+ const unsigned int* object_memory_mark_address() const;
void set_use_capi_lock(bool s) {
use_capi_lock_ = s;
View
2  vm/util/address.hpp
@@ -79,7 +79,7 @@ namespace memory {
return Address(0);
}
- intptr_t as_int() const {
+ uintptr_t as_int() const {
return address_;
}
View
4 vm/util/immix.hpp
@@ -270,14 +270,14 @@ namespace immix {
* Returns the offset in bytes from the start of the block to the start of
* the specified +line+.
*/
- int offset_of_line(int line) const {
+ static int offset_of_line(int line) {
return line * cLineSize;
}
/**
* Returns the memory Address of the start of the specified line.
*/
- Address address_of_line(int line) {
+ Address address_of_line(int line) const {
return address_ + (line * cLineSize);
}
View
3  vm/vm.hpp
@@ -397,8 +397,7 @@ namespace rubinius {
TypeInfo* find_type(int type);
- void init_ffi(STATE);
- void init_native_libraries();
+ static void init_ffi(STATE);
/// Check the GC flags in ObjectMemory and collect if we need to.
void collect_maybe(GCToken gct, CallFrame* call_frame);
Please sign in to comment.
Something went wrong with that request. Please try again.