mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
remove branches in dmark and dfree GC callbacks
dmark and dfree callbacks are never called in gc.c for NULL DATA_PTR values, not even for zombie objects. * compile.c (ibf_loader_mark): remove branch for pointer validity * compile.c (ibf_loader_free): ditto * cont.c (cont_free): ditto * cont.c (fiber_free): ditto * dir.c (dir_free): ditto * ext/stringio/stringio.c (strio_mark): ditto * proc.c (binding_free): ditto * thread_sync.c (mutex_free): ditto * vm.c (thread_free): ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3a55e8a436
commit
cad4591086
7 changed files with 96 additions and 112 deletions
|
@ -8631,23 +8631,19 @@ ibf_load_setup(struct ibf_load *load, VALUE loader_obj, VALUE str)
|
|||
static void
|
||||
ibf_loader_mark(void *ptr)
|
||||
{
|
||||
if (ptr) {
|
||||
struct ibf_load *load = (struct ibf_load *)ptr;
|
||||
rb_gc_mark(load->str);
|
||||
rb_gc_mark(load->iseq_list);
|
||||
rb_gc_mark(load->obj_list);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ibf_loader_free(void *ptr)
|
||||
{
|
||||
if (ptr) {
|
||||
struct ibf_load *load = (struct ibf_load *)ptr;
|
||||
ruby_xfree(load->id_list);
|
||||
ruby_xfree(load);
|
||||
}
|
||||
}
|
||||
|
||||
static size_t
|
||||
ibf_loader_memsize(const void *ptr)
|
||||
|
|
9
cont.c
9
cont.c
|
@ -218,9 +218,9 @@ cont_mark(void *ptr)
|
|||
static void
|
||||
cont_free(void *ptr)
|
||||
{
|
||||
RUBY_FREE_ENTER("cont");
|
||||
if (ptr) {
|
||||
rb_context_t *cont = ptr;
|
||||
|
||||
RUBY_FREE_ENTER("cont");
|
||||
RUBY_FREE_UNLESS_NULL(cont->saved_thread.stack);
|
||||
#if FIBER_USE_NATIVE
|
||||
if (cont->type == CONTINUATION_CONTEXT) {
|
||||
|
@ -266,7 +266,6 @@ cont_free(void *ptr)
|
|||
|
||||
/* free rb_cont_t or rb_fiber_t */
|
||||
ruby_xfree(ptr);
|
||||
}
|
||||
RUBY_FREE_LEAVE("cont");
|
||||
}
|
||||
|
||||
|
@ -317,16 +316,14 @@ fiber_mark(void *ptr)
|
|||
static void
|
||||
fiber_free(void *ptr)
|
||||
{
|
||||
RUBY_FREE_ENTER("fiber");
|
||||
if (ptr) {
|
||||
rb_fiber_t *fib = ptr;
|
||||
RUBY_FREE_ENTER("fiber");
|
||||
if (fib->cont.type != ROOT_FIBER_CONTEXT &&
|
||||
fib->cont.saved_thread.local_storage) {
|
||||
st_free_table(fib->cont.saved_thread.local_storage);
|
||||
}
|
||||
|
||||
cont_free(&fib->cont);
|
||||
}
|
||||
RUBY_FREE_LEAVE("fiber");
|
||||
}
|
||||
|
||||
|
|
3
dir.c
3
dir.c
|
@ -436,9 +436,8 @@ static void
|
|||
dir_free(void *ptr)
|
||||
{
|
||||
struct dir_data *dir = ptr;
|
||||
if (dir) {
|
||||
|
||||
if (dir->dir) closedir(dir->dir);
|
||||
}
|
||||
xfree(dir);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,10 +52,9 @@ static void
|
|||
strio_mark(void *p)
|
||||
{
|
||||
struct StringIO *ptr = p;
|
||||
if (ptr) {
|
||||
|
||||
rb_gc_mark(ptr->string);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
strio_free(void *p)
|
||||
|
|
8
proc.c
8
proc.c
|
@ -265,12 +265,10 @@ rb_proc_lambda_p(VALUE procval)
|
|||
static void
|
||||
binding_free(void *ptr)
|
||||
{
|
||||
rb_binding_t *bind;
|
||||
RUBY_FREE_ENTER("binding");
|
||||
if (ptr) {
|
||||
bind = ptr;
|
||||
ruby_xfree(bind);
|
||||
}
|
||||
|
||||
ruby_xfree(ptr);
|
||||
|
||||
RUBY_FREE_LEAVE("binding");
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ static const char* rb_mutex_unlock_th(rb_mutex_t *mutex, rb_thread_t volatile *t
|
|||
static void
|
||||
mutex_free(void *ptr)
|
||||
{
|
||||
if (ptr) {
|
||||
rb_mutex_t *mutex = ptr;
|
||||
if (mutex->th) {
|
||||
/* rb_warn("free locked mutex"); */
|
||||
|
@ -63,7 +62,6 @@ mutex_free(void *ptr)
|
|||
}
|
||||
native_mutex_destroy(&mutex->lock);
|
||||
native_cond_destroy(&mutex->cond);
|
||||
}
|
||||
ruby_xfree(ptr);
|
||||
}
|
||||
|
||||
|
|
7
vm.c
7
vm.c
|
@ -2346,12 +2346,9 @@ rb_thread_mark(void *ptr)
|
|||
static void
|
||||
thread_free(void *ptr)
|
||||
{
|
||||
rb_thread_t *th;
|
||||
rb_thread_t *th = ptr;
|
||||
RUBY_FREE_ENTER("thread");
|
||||
|
||||
if (ptr) {
|
||||
th = ptr;
|
||||
|
||||
if (!th->root_fiber) {
|
||||
RUBY_FREE_UNLESS_NULL(th->stack);
|
||||
}
|
||||
|
@ -2380,7 +2377,7 @@ thread_free(void *ptr)
|
|||
}
|
||||
if (ruby_current_thread == th)
|
||||
ruby_current_thread = NULL;
|
||||
}
|
||||
|
||||
RUBY_FREE_LEAVE("thread");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue