promotional, or sales literature without prior written consent from
MIT in each case. */
-/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/bchmmg.c,v 9.34 1987/08/06 06:05:47 cph Exp $ */
+/* $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/bchmmg.c,v 9.35 1987/08/10 21:25:07 jinx Exp $ */
/* Memory management top level. Garbage collection to disk.
extern char *mktemp();
int gc_file;
+static long current_disk_position;
static char *gc_file_name;
static char gc_default_file_name[FILE_NAME_LENGTH] = GC_DEFAULT_FILE_NAME;
void
-open_gc_file()
+open_gc_file(size)
+ int size;
{
int position;
int flags;
fprintf(stderr, "Aborting.\n");
exit(1);
}
+#ifdef hpux
+ if (gc_file_name == gc_default_file_name)
+ {
+ extern prealloc();
+ prealloc(gc_file, size);
+ }
+#endif
+ current_disk_position = 0;
return;
}
Heap_Bottom = Heap;
Clear_Memory(Our_Heap_Size, Our_Stack_Size, Our_Constant_Size);
- open_gc_file();
+ open_gc_file(Our_Heap_Size * sizeof(Pointer));
return;
}
{
long bytes_written;
- if (lseek(gc_file, *position, 0) == -1)
+ if ((current_disk_position != *position) &&
+ (lseek(gc_file, *position, 0) == -1))
{
if (success == NULL)
{
}
*position += bytes_written;
+ current_disk_position = *position;
return;
}
\f
{
long bytes_read;
- if (lseek(gc_file, position, 0) == -1)
+ if ((current_disk_position != position) &&
+ (lseek(gc_file, position, 0) == -1))
{
fprintf(stderr, "\nCould not position GC file to read %s.\n", name);
Microcode_Termination(TERM_EXIT);
Microcode_Termination(TERM_EXIT);
/*NOTREACHED*/
}
+ current_disk_position += bytes_read;
return;
}