Permalink
Browse files

Create global for encoding list

This way we don't need a symbol lookup inside the path for symbol
lookup. This would cause a deadlock with fixing some SymbolTable locking
issues.
  • Loading branch information...
1 parent 2641525 commit 38a013a343215c92791738466f1aa1d7e4c1c308 @dbussink dbussink committed Aug 31, 2013
Showing with 5 additions and 2 deletions.
  1. +3 −2 vm/builtin/encoding.cpp
  2. +2 −0 vm/globals.hpp
View
@@ -56,8 +56,9 @@ namespace rubinius {
G(encoding)->set_object_type(state, EncodingType);
+ GO(encoding_list).set(Array::create(state, 3));
G(encoding)->set_const(state, "EncodingMap", LookupTable::create(state));
- G(encoding)->set_const(state, "EncodingList", Array::create(state, 3));
+ G(encoding)->set_const(state, "EncodingList", G(encoding_list));
G(encoding)->set_ivar(state, state->symbol("@default_external"), G(undefined));
G(encoding)->set_ivar(state, state->symbol("@default_internal"), G(undefined));
@@ -419,7 +420,7 @@ namespace rubinius {
}
Array* Encoding::encoding_list(STATE) {
- return as<Array>(G(encoding)->get_const(state, state->symbol("EncodingList")));
+ return as<Array>(G(encoding_list));
}
LookupTable* Encoding::transcoding_map(STATE) {
View
@@ -120,6 +120,7 @@ namespace rubinius {
TypedRoot<Class*> fiber;
TypedRoot<Class*> alias;
TypedRoot<Class*> encoding;
+ TypedRoot<Object*> encoding_list;
TypedRoot<Module*> type;
TypedRoot<Class*> vm_class;
TypedRoot<Class*> atomic_ref;
@@ -247,6 +248,7 @@ namespace rubinius {
fiber(&roots),
alias(&roots),
encoding(&roots),
+ encoding_list(&roots),
type(&roots),
vm_class(&roots),
atomic_ref(&roots),

0 comments on commit 38a013a

Please sign in to comment.