зеркало из https://github.com/github/ruby.git
* hash.c (rb_hash_tbl_raw), internal.h: added.
Returns st_table without shading hash. * array.c: use rb_hash_tbl_raw() for read-only purpose. * compile.c (iseq_compile_each): ditto. * gc.c (count_objects): ditto. * insns.def: ditto. * process.c: ditto. * thread.c (clear_coverage): ditto. * vm_insnhelper.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9ae121d6df
Коммит
c4c821a7d7
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
||||||
|
Mon May 27 01:15:22 2013 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* hash.c (rb_hash_tbl_raw), internal.h: added.
|
||||||
|
Returns st_table without shading hash.
|
||||||
|
|
||||||
|
* array.c: use rb_hash_tbl_raw() for read-only purpose.
|
||||||
|
|
||||||
|
* compile.c (iseq_compile_each): ditto.
|
||||||
|
|
||||||
|
* gc.c (count_objects): ditto.
|
||||||
|
|
||||||
|
* insns.def: ditto.
|
||||||
|
|
||||||
|
* process.c: ditto.
|
||||||
|
|
||||||
|
* thread.c (clear_coverage): ditto.
|
||||||
|
|
||||||
|
* vm_insnhelper.c: ditto.
|
||||||
|
|
||||||
Mon May 27 00:31:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
Mon May 27 00:31:09 2013 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* tool/make-snapshot: use ENV["AUTOCONF"] instead of directly using
|
* tool/make-snapshot: use ENV["AUTOCONF"] instead of directly using
|
||||||
|
|
16
array.c
16
array.c
|
@ -3840,7 +3840,7 @@ rb_ary_diff(VALUE ary1, VALUE ary2)
|
||||||
ary3 = rb_ary_new();
|
ary3 = rb_ary_new();
|
||||||
|
|
||||||
for (i=0; i<RARRAY_LEN(ary1); i++) {
|
for (i=0; i<RARRAY_LEN(ary1); i++) {
|
||||||
if (st_lookup(RHASH_TBL(hash), RARRAY_AREF(ary1, i), 0)) continue;
|
if (st_lookup(rb_hash_tbl_raw(hash), RARRAY_AREF(ary1, i), 0)) continue;
|
||||||
rb_ary_push(ary3, rb_ary_elt(ary1, i));
|
rb_ary_push(ary3, rb_ary_elt(ary1, i));
|
||||||
}
|
}
|
||||||
ary_recycle_hash(hash);
|
ary_recycle_hash(hash);
|
||||||
|
@ -3881,7 +3881,7 @@ rb_ary_and(VALUE ary1, VALUE ary2)
|
||||||
|
|
||||||
for (i=0; i<RARRAY_LEN(ary1); i++) {
|
for (i=0; i<RARRAY_LEN(ary1); i++) {
|
||||||
vv = (st_data_t)(v = rb_ary_elt(ary1, i));
|
vv = (st_data_t)(v = rb_ary_elt(ary1, i));
|
||||||
if (st_delete(RHASH_TBL(hash), &vv, 0)) {
|
if (st_delete(rb_hash_tbl_raw(hash), &vv, 0)) {
|
||||||
rb_ary_push(ary3, v);
|
rb_ary_push(ary3, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3917,13 +3917,13 @@ rb_ary_or(VALUE ary1, VALUE ary2)
|
||||||
|
|
||||||
for (i=0; i<RARRAY_LEN(ary1); i++) {
|
for (i=0; i<RARRAY_LEN(ary1); i++) {
|
||||||
vv = (st_data_t)(v = rb_ary_elt(ary1, i));
|
vv = (st_data_t)(v = rb_ary_elt(ary1, i));
|
||||||
if (st_delete(RHASH_TBL(hash), &vv, 0)) {
|
if (st_delete(rb_hash_tbl_raw(hash), &vv, 0)) {
|
||||||
rb_ary_push(ary3, v);
|
rb_ary_push(ary3, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i=0; i<RARRAY_LEN(ary2); i++) {
|
for (i=0; i<RARRAY_LEN(ary2); i++) {
|
||||||
vv = (st_data_t)(v = rb_ary_elt(ary2, i));
|
vv = (st_data_t)(v = rb_ary_elt(ary2, i));
|
||||||
if (st_delete(RHASH_TBL(hash), &vv, 0)) {
|
if (st_delete(rb_hash_tbl_raw(hash), &vv, 0)) {
|
||||||
rb_ary_push(ary3, v);
|
rb_ary_push(ary3, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3983,7 +3983,7 @@ rb_ary_uniq_bang(VALUE ary)
|
||||||
FL_SET_EMBED(ary);
|
FL_SET_EMBED(ary);
|
||||||
}
|
}
|
||||||
ary_resize_capa(ary, i);
|
ary_resize_capa(ary, i);
|
||||||
st_foreach(RHASH_TBL(hash), push_value, ary);
|
st_foreach(rb_hash_tbl_raw(hash), push_value, ary);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hash = ary_make_hash(ary);
|
hash = ary_make_hash(ary);
|
||||||
|
@ -3992,7 +3992,7 @@ rb_ary_uniq_bang(VALUE ary)
|
||||||
}
|
}
|
||||||
for (i=j=0; i<RARRAY_LEN(ary); i++) {
|
for (i=j=0; i<RARRAY_LEN(ary); i++) {
|
||||||
st_data_t vv = (st_data_t)(v = rb_ary_elt(ary, i));
|
st_data_t vv = (st_data_t)(v = rb_ary_elt(ary, i));
|
||||||
if (st_delete(RHASH_TBL(hash), &vv, 0)) {
|
if (st_delete(rb_hash_tbl_raw(hash), &vv, 0)) {
|
||||||
rb_ary_store(ary, j++, v);
|
rb_ary_store(ary, j++, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4033,14 +4033,14 @@ rb_ary_uniq(VALUE ary)
|
||||||
if (rb_block_given_p()) {
|
if (rb_block_given_p()) {
|
||||||
hash = ary_make_hash_by(ary);
|
hash = ary_make_hash_by(ary);
|
||||||
uniq = ary_new(rb_obj_class(ary), RHASH_SIZE(hash));
|
uniq = ary_new(rb_obj_class(ary), RHASH_SIZE(hash));
|
||||||
st_foreach(RHASH_TBL(hash), push_value, uniq);
|
st_foreach(rb_hash_tbl_raw(hash), push_value, uniq);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hash = ary_make_hash(ary);
|
hash = ary_make_hash(ary);
|
||||||
uniq = ary_new(rb_obj_class(ary), RHASH_SIZE(hash));
|
uniq = ary_new(rb_obj_class(ary), RHASH_SIZE(hash));
|
||||||
for (i=0; i<RARRAY_LEN(ary); i++) {
|
for (i=0; i<RARRAY_LEN(ary); i++) {
|
||||||
st_data_t vv = (st_data_t)(v = rb_ary_elt(ary, i));
|
st_data_t vv = (st_data_t)(v = rb_ary_elt(ary, i));
|
||||||
if (st_delete(RHASH_TBL(hash), &vv, 0)) {
|
if (st_delete(rb_hash_tbl_raw(hash), &vv, 0)) {
|
||||||
rb_ary_push(uniq, v);
|
rb_ary_push(uniq, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3244,7 +3244,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
|
||||||
INIT_ANCHOR(body_seq);
|
INIT_ANCHOR(body_seq);
|
||||||
INIT_ANCHOR(cond_seq);
|
INIT_ANCHOR(cond_seq);
|
||||||
|
|
||||||
RHASH_TBL(literals)->type = &cdhash_type;
|
rb_hash_tbl_raw(literals)->type = &cdhash_type;
|
||||||
|
|
||||||
if (node->nd_head == 0) {
|
if (node->nd_head == 0) {
|
||||||
COMPILE_(ret, "when", node->nd_body, poped);
|
COMPILE_(ret, "when", node->nd_body, poped);
|
||||||
|
|
2
gc.c
2
gc.c
|
@ -1979,7 +1979,7 @@ count_objects(int argc, VALUE *argv, VALUE os)
|
||||||
hash = rb_hash_new();
|
hash = rb_hash_new();
|
||||||
}
|
}
|
||||||
else if (!RHASH_EMPTY_P(hash)) {
|
else if (!RHASH_EMPTY_P(hash)) {
|
||||||
st_foreach(RHASH_TBL(hash), set_zero, hash);
|
st_foreach(RHASH_TBL_RAW(hash), set_zero, hash);
|
||||||
}
|
}
|
||||||
rb_hash_aset(hash, ID2SYM(rb_intern("TOTAL")), SIZET2NUM(total));
|
rb_hash_aset(hash, ID2SYM(rb_intern("TOTAL")), SIZET2NUM(total));
|
||||||
rb_hash_aset(hash, ID2SYM(rb_intern("FREE")), SIZET2NUM(freed));
|
rb_hash_aset(hash, ID2SYM(rb_intern("FREE")), SIZET2NUM(freed));
|
||||||
|
|
6
hash.c
6
hash.c
|
@ -295,6 +295,12 @@ rb_hash_tbl(VALUE hash)
|
||||||
return hash_tbl(hash);
|
return hash_tbl(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct st_table *
|
||||||
|
rb_hash_tbl_raw(VALUE hash)
|
||||||
|
{
|
||||||
|
return hash_tbl(hash);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rb_hash_modify(VALUE hash)
|
rb_hash_modify(VALUE hash)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1272,7 +1272,7 @@ opt_case_dispatch
|
||||||
BIGNUM_REDEFINED_OP_FLAG |
|
BIGNUM_REDEFINED_OP_FLAG |
|
||||||
STRING_REDEFINED_OP_FLAG)) {
|
STRING_REDEFINED_OP_FLAG)) {
|
||||||
st_data_t val;
|
st_data_t val;
|
||||||
if (st_lookup(RHASH_TBL(hash), key, &val)) {
|
if (st_lookup(RHASH_TBL_RAW(hash), key, &val)) {
|
||||||
JUMP(FIX2INT((VALUE)val));
|
JUMP(FIX2INT((VALUE)val));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -189,6 +189,10 @@ void rb_w32_init_file(void);
|
||||||
void Init_heap(void);
|
void Init_heap(void);
|
||||||
void *ruby_mimmalloc(size_t size);
|
void *ruby_mimmalloc(size_t size);
|
||||||
|
|
||||||
|
/* hash.c */
|
||||||
|
struct st_table *rb_hash_tbl_raw(VALUE hash);
|
||||||
|
#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
|
||||||
|
|
||||||
/* inits.c */
|
/* inits.c */
|
||||||
void rb_call_inits(void);
|
void rb_call_inits(void);
|
||||||
|
|
||||||
|
|
|
@ -1884,7 +1884,7 @@ rb_check_exec_options(VALUE opthash, VALUE execarg_obj)
|
||||||
{
|
{
|
||||||
if (RHASH_EMPTY_P(opthash))
|
if (RHASH_EMPTY_P(opthash))
|
||||||
return;
|
return;
|
||||||
st_foreach(RHASH_TBL(opthash), check_exec_options_i, (st_data_t)execarg_obj);
|
st_foreach(rb_hash_tbl_raw(opthash), check_exec_options_i, (st_data_t)execarg_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
|
@ -1895,7 +1895,7 @@ rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash)
|
||||||
return Qnil;
|
return Qnil;
|
||||||
args[0] = execarg_obj;
|
args[0] = execarg_obj;
|
||||||
args[1] = Qnil;
|
args[1] = Qnil;
|
||||||
st_foreach(RHASH_TBL(opthash), check_exec_options_i_extract, (st_data_t)args);
|
st_foreach(rb_hash_tbl_raw(opthash), check_exec_options_i_extract, (st_data_t)args);
|
||||||
return args[1];
|
return args[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1925,7 +1925,7 @@ rb_check_exec_env(VALUE hash)
|
||||||
VALUE env;
|
VALUE env;
|
||||||
|
|
||||||
env = hide_obj(rb_ary_new());
|
env = hide_obj(rb_ary_new());
|
||||||
st_foreach(RHASH_TBL(hash), check_exec_env_i, (st_data_t)env);
|
st_foreach(rb_hash_tbl_raw(hash), check_exec_env_i, (st_data_t)env);
|
||||||
|
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
2
thread.c
2
thread.c
|
@ -3881,7 +3881,7 @@ clear_coverage(void)
|
||||||
{
|
{
|
||||||
VALUE coverages = rb_get_coverages();
|
VALUE coverages = rb_get_coverages();
|
||||||
if (RTEST(coverages)) {
|
if (RTEST(coverages)) {
|
||||||
st_foreach(RHASH_TBL(coverages), clear_coverage_i, 0);
|
st_foreach(rb_hash_tbl_raw(coverages), clear_coverage_i, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1091,7 +1091,7 @@ extract_keywords(VALUE *orighash)
|
||||||
*orighash = 0;
|
*orighash = 0;
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
st_foreach(RHASH_TBL(hash), separate_symbol, (st_data_t)&parthash);
|
st_foreach(rb_hash_tbl_raw(hash), separate_symbol, (st_data_t)&parthash);
|
||||||
*orighash = parthash[1];
|
*orighash = parthash[1];
|
||||||
return parthash[0];
|
return parthash[0];
|
||||||
}
|
}
|
||||||
|
@ -1116,7 +1116,7 @@ vm_callee_setup_keyword_arg(const rb_iseq_t *iseq, int argc, VALUE *orig_argv, V
|
||||||
VALUE missing = Qnil;
|
VALUE missing = Qnil;
|
||||||
for (; i < iseq->arg_keyword_required; i++) {
|
for (; i < iseq->arg_keyword_required; i++) {
|
||||||
VALUE keyword = ID2SYM(iseq->arg_keyword_table[i]);
|
VALUE keyword = ID2SYM(iseq->arg_keyword_table[i]);
|
||||||
if (st_lookup(RHASH_TBL(keyword_hash), (st_data_t)keyword, 0))
|
if (st_lookup(rb_hash_tbl_raw(keyword_hash), (st_data_t)keyword, 0))
|
||||||
continue;
|
continue;
|
||||||
if (NIL_P(missing)) missing = rb_ary_tmp_new(1);
|
if (NIL_P(missing)) missing = rb_ary_tmp_new(1);
|
||||||
rb_ary_push(missing, keyword);
|
rb_ary_push(missing, keyword);
|
||||||
|
@ -1127,9 +1127,9 @@ vm_callee_setup_keyword_arg(const rb_iseq_t *iseq, int argc, VALUE *orig_argv, V
|
||||||
}
|
}
|
||||||
if (iseq->arg_keyword_check) {
|
if (iseq->arg_keyword_check) {
|
||||||
for (j = i; i < iseq->arg_keywords; i++) {
|
for (j = i; i < iseq->arg_keywords; i++) {
|
||||||
if (st_lookup(RHASH_TBL(keyword_hash), ID2SYM(iseq->arg_keyword_table[i]), 0)) j++;
|
if (st_lookup(rb_hash_tbl_raw(keyword_hash), ID2SYM(iseq->arg_keyword_table[i]), 0)) j++;
|
||||||
}
|
}
|
||||||
if (RHASH_TBL(keyword_hash)->num_entries > (unsigned int) j) {
|
if (RHASH_SIZE(keyword_hash) > j) {
|
||||||
unknown_keyword_error(iseq, keyword_hash);
|
unknown_keyword_error(iseq, keyword_hash);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче