mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix more ASAN errors
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67421 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
be0f09a998
commit
dd2479bcea
1 changed files with 9 additions and 3 deletions
12
gc.c
12
gc.c
|
@ -3065,7 +3065,7 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
|
||||||
for (i = 0; i < heap_allocated_pages; i++) {
|
for (i = 0; i < heap_allocated_pages; i++) {
|
||||||
p = heap_pages_sorted[i]->start; pend = p + heap_pages_sorted[i]->total_slots;
|
p = heap_pages_sorted[i]->start; pend = p + heap_pages_sorted[i]->total_slots;
|
||||||
while (p < pend) {
|
while (p < pend) {
|
||||||
void *poisoned = poisoned_object_p(p);
|
void *poisoned = poisoned_object_p((VALUE)p);
|
||||||
unpoison_object((VALUE)p, false);
|
unpoison_object((VALUE)p, false);
|
||||||
switch (BUILTIN_TYPE(p)) {
|
switch (BUILTIN_TYPE(p)) {
|
||||||
case T_DATA:
|
case T_DATA:
|
||||||
|
@ -3558,12 +3558,18 @@ count_objects(int argc, VALUE *argv, VALUE os)
|
||||||
|
|
||||||
p = page->start; pend = p + page->total_slots;
|
p = page->start; pend = p + page->total_slots;
|
||||||
for (;p < pend; p++) {
|
for (;p < pend; p++) {
|
||||||
|
void *poisoned = poisoned_object_p((VALUE)p);
|
||||||
|
unpoison_object((VALUE)p, false);
|
||||||
if (p->as.basic.flags) {
|
if (p->as.basic.flags) {
|
||||||
counts[BUILTIN_TYPE(p)]++;
|
counts[BUILTIN_TYPE(p)]++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
freed++;
|
freed++;
|
||||||
}
|
}
|
||||||
|
if (poisoned) {
|
||||||
|
GC_ASSERT(BUILTIN_TYPE((VALUE)p) == T_NONE);
|
||||||
|
poison_object((VALUE)p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
total += page->total_slots;
|
total += page->total_slots;
|
||||||
}
|
}
|
||||||
|
@ -5474,12 +5480,12 @@ gc_verify_heap_pages_(rb_objspace_t *objspace, struct list_head *head)
|
||||||
RVALUE *p = page->freelist;
|
RVALUE *p = page->freelist;
|
||||||
while(p) {
|
while(p) {
|
||||||
RVALUE *prev = p;
|
RVALUE *prev = p;
|
||||||
unpoison_object(p, false);
|
unpoison_object((VALUE)p, false);
|
||||||
if (BUILTIN_TYPE(p) != T_NONE) {
|
if (BUILTIN_TYPE(p) != T_NONE) {
|
||||||
fprintf(stderr, "freelist slot expected to be T_NONE but was: %s\n", obj_info((VALUE)p));
|
fprintf(stderr, "freelist slot expected to be T_NONE but was: %s\n", obj_info((VALUE)p));
|
||||||
}
|
}
|
||||||
p = p->as.free.next;
|
p = p->as.free.next;
|
||||||
poison_object(prev);
|
poison_object((VALUE)prev);
|
||||||
}
|
}
|
||||||
poison_memory_region(&page->freelist, sizeof(RVALUE*));
|
poison_memory_region(&page->freelist, sizeof(RVALUE*));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue