1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* array.c (rb_ary_or): use RHASH_TBL_RAW instead of RHASH_TBL

* process.c (rb_execarg_fixup): use RHASH_TBL_RAW and insert write
  barriers where appropriate

* vm.c (kwmerge_i): use RHASH_TBL_RAW

* vm.c (HASH_ASET): use rb_hash_aset instead of calling directly into
  st_insert

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
charliesome 2013-12-08 00:41:01 +00:00
parent 0aada28159
commit e0290c9404
4 changed files with 22 additions and 8 deletions

View file

@ -1,3 +1,15 @@
Sun Dec 8 09:40:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
* array.c (rb_ary_or): use RHASH_TBL_RAW instead of RHASH_TBL
* process.c (rb_execarg_fixup): use RHASH_TBL_RAW and insert write
barriers where appropriate
* vm.c (kwmerge_i): use RHASH_TBL_RAW
* vm.c (HASH_ASET): use rb_hash_aset instead of calling directly into
st_insert
Sat Dec 7 11:15:52 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* hash.c (rb_hash_reject): copy unrejected elements only to new hash,

View file

@ -4058,7 +4058,7 @@ rb_ary_or(VALUE ary1, VALUE ary2)
for (i=0; i<RARRAY_LEN(ary2); i++) {
VALUE elt = RARRAY_AREF(ary2, i);
if (!st_update(RHASH_TBL(hash), (st_data_t)elt, ary_hash_orset, (st_data_t)elt)) {
if (!st_update(RHASH_TBL_RAW(hash), (st_data_t)elt, ary_hash_orset, (st_data_t)elt)) {
OBJ_WRITTEN(hash, Qundef, elt);
}
}

View file

@ -2316,7 +2316,7 @@ rb_execarg_fixup(VALUE execarg_obj)
}
hide_obj(envtbl);
if (envopts != Qfalse) {
st_table *stenv = RHASH_TBL(envtbl);
st_table *stenv = RHASH_TBL_RAW(envtbl);
long i;
for (i = 0; i < RARRAY_LEN(envopts); i++) {
VALUE pair = RARRAY_AREF(envopts, i);
@ -2328,12 +2328,14 @@ rb_execarg_fixup(VALUE execarg_obj)
}
else {
st_insert(stenv, (st_data_t)key, (st_data_t)val);
OBJ_WRITTEN(envtbl, Qundef, key);
OBJ_WRITTEN(envtbl, Qundef, val);
}
}
}
envp_buf = rb_str_buf_new(0);
hide_obj(envp_buf);
st_foreach(RHASH_TBL(envtbl), fill_envp_buf_i, (st_data_t)envp_buf);
st_foreach(RHASH_TBL_RAW(envtbl), fill_envp_buf_i, (st_data_t)envp_buf);
envp_str = rb_str_buf_new(sizeof(char*) * (RHASH_SIZE(envtbl) + 1));
hide_obj(envp_str);
p = RSTRING_PTR(envp_buf);

4
vm.c
View file

@ -2212,7 +2212,7 @@ static int
kwmerge_i(VALUE key, VALUE value, VALUE hash)
{
if (!SYMBOL_P(key)) Check_Type(key, T_SYMBOL);
if (st_update(RHASH_TBL(hash), key, kwmerge_ii, (st_data_t)value) == 0) { /* !existing */
if (st_update(RHASH_TBL_RAW(hash), key, kwmerge_ii, (st_data_t)value) == 0) { /* !existing */
OBJ_WRITTEN(hash, Qundef, value);
}
return ST_CONTINUE;
@ -2675,7 +2675,7 @@ VALUE rb_insn_operand_intern(rb_iseq_t *iseq,
#if VM_COLLECT_USAGE_DETAILS
#define HASH_ASET(h, k, v) st_insert(RHASH_TBL(h), (st_data_t)(k), (st_data_t)(v))
#define HASH_ASET(h, k, v) rb_hash_aset((h), (st_data_t)(k), (st_data_t)(v))
/* uh = {
* insn(Fixnum) => ihash(Hash)