Skip to content

Commit 7d07c5a

Browse files
committed
TASK-214337 improvements
1 parent 165dba1 commit 7d07c5a

1 file changed

Lines changed: 10 additions & 25 deletions

File tree

src/lgc.c

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,22 +1974,19 @@ static void validate_heap_objects(lua_State *L, const char *where)
19741974
if (is_bad_gc_ptr((uintptr_t)o) ||
19751975
o->tt < LUA_TSTRING || o->tt > LUA_TGLOBAL ||
19761976
(o->marked & FREEDBIT)) {
1977-
fprintf(stderr,
1978-
"thrlua HEAP CORRUPT [%s] L=%p heap=%p count=%d bad_node=%p\n",
1979-
where, (void*)L, (void*)L->heap, count, (void*)o);
19801977
if (!is_bad_gc_ptr((uintptr_t)o))
1981-
fprintf(stderr, " tt=%d marked=0x%x\n", o->tt, o->marked);
1982-
thrlua_log(L, DCRITICAL,
1983-
"thrlua HEAP CORRUPT [%s] L=%p heap=%p count=%d bad_node=%p\n",
1984-
where, (void*)L, (void*)L->heap, count, (void*)o);
1978+
thrlua_log(L, DCRITICAL,
1979+
"thrlua HEAP CORRUPT [%s] L=%p heap=%p count=%d bad_node=%p"
1980+
" tt=%d marked=0x%x\n",
1981+
where, (void*)L, (void*)L->heap, count, (void*)o,
1982+
o->tt, o->marked);
1983+
else
1984+
thrlua_log(L, DCRITICAL,
1985+
"thrlua HEAP CORRUPT [%s] L=%p heap=%p count=%d bad_node=%p\n",
1986+
where, (void*)L, (void*)L->heap, count, (void*)o);
19851987
abort();
19861988
}
19871989
if (o->owner != L->heap) {
1988-
fprintf(stderr,
1989-
"thrlua HEAP CORRUPT [%s] L=%p heap=%p count=%d node=%p"
1990-
" owner=%p (expected %p) tt=%d\n",
1991-
where, (void*)L, (void*)L->heap, count, (void*)o,
1992-
(void*)o->owner, (void*)L->heap, o->tt);
19931990
thrlua_log(L, DCRITICAL,
19941991
"thrlua HEAP CORRUPT [%s] L=%p heap=%p count=%d node=%p"
19951992
" owner=%p (expected %p) tt=%d\n",
@@ -2178,20 +2175,8 @@ static void trace_heap(GCheap *h)
21782175
GCheader *o;
21792176

21802177
ck_pr_store_32(&h->owner->xref_count, 0);
2178+
validate_heap_objects(h->owner, "trace_heap");
21812179
TAILQ_FOREACH(o, &h->objects, allocd) {
2182-
if (is_bad_gc_ptr((uintptr_t)o) ||
2183-
o->tt < LUA_TSTRING || o->tt > LUA_TGLOBAL ||
2184-
(o->marked & FREEDBIT)) {
2185-
fprintf(stderr,
2186-
"thrlua HEAP CORRUPT [trace_heap] heap=%p owner=%p bad_node=%p\n",
2187-
(void*)h, (void*)h->owner, (void*)o);
2188-
if (!is_bad_gc_ptr((uintptr_t)o))
2189-
fprintf(stderr, " tt=%d marked=0x%x\n", o->tt, o->marked);
2190-
thrlua_log(h->owner, DCRITICAL,
2191-
"thrlua HEAP CORRUPT [trace_heap] heap=%p owner=%p bad_node=%p\n",
2192-
(void*)h, (void*)h->owner, (void*)o);
2193-
abort();
2194-
}
21952180
global_trace_obj(h->owner, &h->owner->gch, o);
21962181
}
21972182

0 commit comments

Comments
 (0)