diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-12-27 16:35:57 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-12-27 16:35:57 +0000 |
commit | ebd3d34ff0e05cce8d5a815a88ccceac490b5679 (patch) | |
tree | 2e698e5b7275092e26b7af62f290a032fc5ef10f /eval.c | |
parent | a17dc68aa0e418a9129ea9a5d4f7c2185227b4b7 (diff) | |
download | ruby-ebd3d34ff0e05cce8d5a815a88ccceac490b5679.tar.gz |
* 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
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -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);\ |