From 00af71f77d12c352bc554f0ee51b06d9a186d590 Mon Sep 17 00:00:00 2001 From: shivers Date: Sun, 29 Oct 1995 15:45:22 +0000 Subject: [PATCH] There was a weird bug in the GC system. The image-writing code causes a GC to assemble a compacted heap image in newspace which it then writes out to disk. Then the VM calls ABORT-GC to cancel the GC operation, which scans the current space, fixing up the "broken hearts" -- restoring word 1 of each structure that got clobbered with a forwarding pointer. Unfortunately, someone (possibly myself) had inserted a post_gc_fdports() call into the VM between the gc and the abort. This procedure updates a C vector of Scheme values (fdports[]) by following forwarding pointers -- BUT -- in this instance we didn't really want to break hearts, and the abort-gc code didn't know about the fdports[] vector, so it couldn't undo the effects. This caused the fdports[] vec to point into hyperspace after the image dump, and *that* meant on the next GC, all the live ports were considered dead. Oops. The fix was to remove this bogus call. The post_gc_fdports() proc is now called only after a *real* GC. -Olin --- scheme48vm.c | 9 ++++++++- scsh/fdports1.c | 9 ++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/scheme48vm.c b/scheme48vm.c index 5332b97..8dfac72 100644 --- a/scheme48vm.c +++ b/scheme48vm.c @@ -3480,7 +3480,14 @@ long Tinterpret() RSstackS = SstackS; RScode_pointerS = Scode_pointerS; RSenvS = SenvS; - post_gc_fdports(); /* Hack for scsh's i/o system. Olin. */ + /* Do NOT put a call to the scsh I/O gc hook post_gc_fdports() here. + ** This GC is not for real -- it's for writing images, and will be + ** aborted. But the part of post_gc_fdports that updates the fdports[] + ** elements to point into new-space *won't* be aborted, and oops, we're + ** pointing into hyperspace. This whole thing is a mess; we need to port + ** to a newer Scheme 48 release that gives us structured GC hooks. + ** -Olin + */ close_untraced_portsB_return_tag = 0; goto close_untraced_portsB; close_untraced_portsB_return_0: diff --git a/scsh/fdports1.c b/scsh/fdports1.c index 3a44cd5..95e4a28 100644 --- a/scsh/fdports1.c +++ b/scsh/fdports1.c @@ -301,17 +301,16 @@ void post_gc_fdports(void) { int fd; -#if 0 +#ifdef NOISY_FDGC fputs("{GC", stderr); fflush(stderr); #endif for(fd=0; fd