merge revision(s) 40336: [Backport #8142]

* compile.c (iseq_add_mark_object): Use new rb_iseq_add_mark_object().

	* insns.def (setinlinecache): Ditto.

	* iseq.c (rb_iseq_add_mark_object): New function to allocate
	  iseq->mark_ary on demand. [Bug #8142]

	* iseq.h (rb_iseq_add_mark_object): Ditto.

	* iseq.c (prepare_iseq_build): Avoid allocating mark_ary until needed.

	* iseq.c (rb_iseq_build_for_ruby2cext): Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@41682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2013-06-27 17:32:35 +00:00
parent 8bbcbef83e
commit 4050436e57
6 changed files with 34 additions and 10 deletions

View file

@ -1,3 +1,18 @@
Fri Jun 28 02:20:13 2013 Aman Gupta <ruby@tmm1.net>
* compile.c (iseq_add_mark_object): Use new rb_iseq_add_mark_object().
* insns.def (setinlinecache): Ditto.
* iseq.c (rb_iseq_add_mark_object): New function to allocate
iseq->mark_ary on demand. [Bug #8142]
* iseq.h (rb_iseq_add_mark_object): Ditto.
* iseq.c (prepare_iseq_build): Avoid allocating mark_ary until needed.
* iseq.c (rb_iseq_build_for_ruby2cext): Ditto.
Thu Jun 27 20:10:56 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org> Thu Jun 27 20:10:56 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
* ext/openssl/lib/openssl/ssl.rb (verify_certificate_identity): fix * ext/openssl/lib/openssl/ssl.rb (verify_certificate_identity): fix

View file

@ -416,7 +416,7 @@ static int
iseq_add_mark_object(rb_iseq_t *iseq, VALUE v) iseq_add_mark_object(rb_iseq_t *iseq, VALUE v)
{ {
if (!SPECIAL_CONST_P(v)) { if (!SPECIAL_CONST_P(v)) {
rb_ary_push(iseq->mark_ary, v); rb_iseq_add_mark_object(iseq, v);
} }
return COMPILE_OK; return COMPILE_OK;
} }

View file

@ -1237,7 +1237,7 @@ setinlinecache
(VALUE val) (VALUE val)
{ {
if (ic->ic_value.value == Qundef) { if (ic->ic_value.value == Qundef) {
rb_ary_push(GET_ISEQ()->mark_ary, val); rb_iseq_add_mark_object(GET_ISEQ(), val);
} }
ic->ic_value.value = val; ic->ic_value.value = val;
ic->ic_vmstat = GET_VM_STATE_VERSION() - ruby_vm_const_missing_count; ic->ic_vmstat = GET_VM_STATE_VERSION() - ruby_vm_const_missing_count;

18
iseq.c
View file

@ -237,6 +237,17 @@ set_relation(rb_iseq_t *iseq, const VALUE parent)
} }
} }
void
rb_iseq_add_mark_object(rb_iseq_t *iseq, VALUE obj)
{
if (!RTEST(iseq->mark_ary)) {
iseq->mark_ary = rb_ary_tmp_new(3);
OBJ_UNTRUST(iseq->mark_ary);
RBASIC(iseq->mark_ary)->klass = 0;
}
rb_ary_push(iseq->mark_ary, obj);
}
static VALUE static VALUE
prepare_iseq_build(rb_iseq_t *iseq, prepare_iseq_build(rb_iseq_t *iseq,
VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno, VALUE name, VALUE path, VALUE absolute_path, VALUE first_lineno,
@ -259,9 +270,7 @@ prepare_iseq_build(rb_iseq_t *iseq,
} }
iseq->defined_method_id = 0; iseq->defined_method_id = 0;
iseq->mark_ary = rb_ary_tmp_new(3); iseq->mark_ary = 0;
OBJ_UNTRUST(iseq->mark_ary);
RBASIC(iseq->mark_ary)->klass = 0;
/* /*
@ -2047,8 +2056,7 @@ rb_iseq_build_for_ruby2cext(
iseq->location.label = rb_str_new2(name); iseq->location.label = rb_str_new2(name);
iseq->location.path = rb_str_new2(path); iseq->location.path = rb_str_new2(path);
iseq->location.first_lineno = first_lineno; iseq->location.first_lineno = first_lineno;
iseq->mark_ary = rb_ary_tmp_new(3); iseq->mark_ary = 0;
OBJ_UNTRUST(iseq->mark_ary);
iseq->self = iseqval; iseq->self = iseqval;
iseq->iseq = ALLOC_N(VALUE, iseq->iseq_size); iseq->iseq = ALLOC_N(VALUE, iseq->iseq_size);

1
iseq.h
View file

@ -23,6 +23,7 @@ VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
VALUE exception, VALUE body); VALUE exception, VALUE body);
/* iseq.c */ /* iseq.c */
void rb_iseq_add_mark_object(rb_iseq_t *iseq, VALUE obj);
VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt); VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt);
VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc); VALUE rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc);
struct st_table *ruby_insn_make_insn_table(void); struct st_table *ruby_insn_make_insn_table(void);

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "2.0.0" #define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2013-06-27" #define RUBY_RELEASE_DATE "2013-06-28"
#define RUBY_PATCHLEVEL 247 #define RUBY_PATCHLEVEL 248
#define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_YEAR 2013
#define RUBY_RELEASE_MONTH 6 #define RUBY_RELEASE_MONTH 6
#define RUBY_RELEASE_DAY 27 #define RUBY_RELEASE_DAY 28
#include "ruby/version.h" #include "ruby/version.h"