mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm.c: frozen_strings in rb_vm_t
* vm.c (Init_vm_objects, rb_vm_fstring_table): use frozen_strings table in rb_vm_t. [ruby-core:70274] [Bug #11423] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ef53976662
commit
f7ab090635
4 changed files with 19 additions and 20 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Aug 9 14:15:54 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* vm.c (Init_vm_objects, rb_vm_fstring_table): use frozen_strings
|
||||
table in rb_vm_t. [ruby-core:70274] [Bug #11423]
|
||||
|
||||
Sat Aug 8 03:59:51 2015 Zachary Scott <zzak@ruby-lang.org>
|
||||
|
||||
* object.c: [DOC] Improve grammar for Module#===
|
||||
|
|
5
eval.c
5
eval.c
|
@ -44,18 +44,15 @@ ID ruby_static_id_signo, ruby_static_id_status;
|
|||
int
|
||||
ruby_setup(void)
|
||||
{
|
||||
static int initialized = 0;
|
||||
int state;
|
||||
|
||||
if (initialized)
|
||||
if (GET_VM())
|
||||
return 0;
|
||||
initialized = 1;
|
||||
|
||||
ruby_init_stack((void *)&state);
|
||||
Init_BareVM();
|
||||
Init_heap();
|
||||
Init_vm_objects();
|
||||
Init_frozen_strings();
|
||||
|
||||
PUSH_TAG();
|
||||
if ((state = EXEC_TAG()) == 0) {
|
||||
|
|
20
string.c
20
string.c
|
@ -216,17 +216,11 @@ mustnot_wchar(VALUE str)
|
|||
|
||||
static int fstring_cmp(VALUE a, VALUE b);
|
||||
|
||||
/* in case we restart MVM development, this needs to be per-VM */
|
||||
static st_table* frozen_strings;
|
||||
static VALUE register_fstring(VALUE str);
|
||||
|
||||
static inline st_table*
|
||||
rb_vm_fstring_table(void)
|
||||
{
|
||||
return frozen_strings;
|
||||
}
|
||||
st_table *rb_vm_fstring_table(void);
|
||||
|
||||
static const struct st_hash_type fstring_hash_type = {
|
||||
const struct st_hash_type rb_fstring_hash_type = {
|
||||
fstring_cmp,
|
||||
rb_str_hash,
|
||||
};
|
||||
|
@ -308,10 +302,11 @@ static VALUE
|
|||
register_fstring(VALUE str)
|
||||
{
|
||||
VALUE ret;
|
||||
st_table *frozen_strings = rb_vm_fstring_table();
|
||||
|
||||
do {
|
||||
ret = str;
|
||||
st_update(rb_vm_fstring_table(), (st_data_t)str,
|
||||
st_update(frozen_strings, (st_data_t)str,
|
||||
fstr_update_callback, (st_data_t)&ret);
|
||||
} while (ret == Qundef);
|
||||
|
||||
|
@ -9327,10 +9322,3 @@ Init_String(void)
|
|||
assert(rb_vm_fstring_table());
|
||||
st_foreach(rb_vm_fstring_table(), fstring_set_class_i, rb_cString);
|
||||
}
|
||||
|
||||
void
|
||||
Init_frozen_strings(void)
|
||||
{
|
||||
assert(!frozen_strings);
|
||||
frozen_strings = st_init_table_with_size(&fstring_hash_type, 1000);
|
||||
}
|
||||
|
|
9
vm.c
9
vm.c
|
@ -2786,6 +2786,8 @@ rb_vm_set_progname(VALUE filename)
|
|||
struct rb_objspace *rb_objspace_alloc(void);
|
||||
#endif
|
||||
|
||||
extern const struct st_hash_type rb_fstring_hash_type;
|
||||
|
||||
void
|
||||
Init_BareVM(void)
|
||||
{
|
||||
|
@ -2821,6 +2823,7 @@ Init_vm_objects(void)
|
|||
/* initialize mark object array, hash */
|
||||
vm->mark_object_ary = rb_ary_tmp_new(128);
|
||||
vm->loading_table = st_init_strtable();
|
||||
vm->frozen_strings = st_init_table_with_size(&rb_fstring_hash_type, 1000);
|
||||
}
|
||||
|
||||
/* top self */
|
||||
|
@ -2876,6 +2879,12 @@ VALUE rb_insn_operand_intern(const rb_iseq_t *iseq,
|
|||
VALUE insn, int op_no, VALUE op,
|
||||
int len, size_t pos, VALUE *pnop, VALUE child);
|
||||
|
||||
st_table *
|
||||
rb_vm_fstring_table(void)
|
||||
{
|
||||
return GET_VM()->frozen_strings;
|
||||
}
|
||||
|
||||
#if VM_COLLECT_USAGE_DETAILS
|
||||
|
||||
#define HASH_ASET(h, k, v) rb_hash_aset((h), (st_data_t)(k), (st_data_t)(v))
|
||||
|
|
Loading…
Add table
Reference in a new issue