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

* eval.c (struct thread): add bstr_max.

(rb_thread_save_context): use realloc instead of REALLOC_N
  to avoid GC.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2005-12-27 16:35:57 +00:00
parent a17dc68aa0
commit ebd3d34ff0
2 changed files with 19 additions and 4 deletions

View file

@ -1,3 +1,9 @@
Wed Dec 28 01:32:39 2005 Tanaka Akira <akr@m17n.org>
* eval.c (struct thread): add bstr_max.
(rb_thread_save_context): use realloc instead of REALLOC_N
to avoid GC.
Tue Dec 27 23:59:53 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/optparse.rb (CompletingHash#match): fix for 1.9.

17
eval.c
View file

@ -9697,9 +9697,10 @@ struct thread {
VALUE *stk_ptr;
VALUE *stk_pos;
#ifdef IA64
VALUE *bstr_pos;
VALUE *bstr_ptr;
long bstr_len;
long bstr_max;
VALUE *bstr_ptr;
VALUE *bstr_pos;
#endif
struct FRAME *frame;
@ -10074,8 +10075,15 @@ rb_thread_save_context(rb_thread_t th)
MEMCPY(th->stk_ptr, th->stk_pos, VALUE, th->stk_len);
#ifdef IA64
th->bstr_pos = rb_gc_register_stack_start;
th->bstr_len = (VALUE*)rb_ia64_bsp() - th->bstr_pos;
REALLOC_N(th->bstr_ptr, VALUE, th->bstr_len);
len = (VALUE*)rb_ia64_bsp() - th->bstr_pos;
th->bstr_len = 0;
if (len > th->bstr_max) {
VALUE *ptr = realloc(th->bstr_ptr, sizeof(VALUE) * len);
if (!ptr) rb_memerror();
th->bstr_ptr = ptr;
th->bstr_max = len;
}
th->bstr_len = len;
MEMCPY(th->bstr_ptr, th->bstr_pos, VALUE, th->bstr_len);
#endif
#ifdef SAVE_WIN32_EXCEPTION_LIST
@ -11476,6 +11484,7 @@ rb_thread_group(VALUE thread)
th->wait_for = 0;\
IA64_INIT(th->bstr_ptr = 0);\
IA64_INIT(th->bstr_len = 0);\
IA64_INIT(th->bstr_max = 0);\
rb_fd_init(&th->readfds);\
rb_fd_init(&th->writefds);\
rb_fd_init(&th->exceptfds);\