From 47fdf1ab459d1949e067816dee2257838a2e83d7 Mon Sep 17 00:00:00 2001 From: ram <ram> Date: Tue, 25 Oct 1994 17:20:37 +0000 Subject: [PATCH] Don't try to grow in-place in os_reallocate. This routine is only called by genesis anyway. --- lisp/os-common.c | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/lisp/os-common.c b/lisp/os-common.c index f6174f4f7..6070199ba 100644 --- a/lisp/os-common.c +++ b/lisp/os-common.c @@ -2,6 +2,10 @@ #include "os.h" +/* Except for os_zero, these routines are only called by Lisp code. These + routines may also be replaced by os-dependent versions instead. See + hpux-os.c for some useful restrictions on actual usage. */ + void os_zero(addr, length) os_vm_address_t addr; os_vm_size_t length; @@ -53,6 +57,9 @@ os_vm_size_t len; os_invalidate(addr,len); } +/* This function once tried to grow the chunk by asking os_validate if the + space was available, but this really only works under Mach. */ + os_vm_address_t os_reallocate(os_vm_address_t addr, os_vm_size_t old_len, os_vm_size_t len) { @@ -67,33 +74,18 @@ os_vm_address_t os_reallocate(os_vm_address_t addr, os_vm_size_t old_len, if(len_diff<0) os_invalidate(addr+len,-len_diff); - else if(len_diff!=0){ -#if 1 - os_vm_address_t new= NULL; -#else - os_vm_address_t new=os_validate(addr+old_len,len_diff); -#endif + else{ + if(len_diff!=0){ + new=os_allocate(len); - if(new==NULL || new!=addr+old_len){ - if(new!=NULL) - /* allocated alright, but in the wrong place */ - os_invalidate(new,len_diff); - - new=os_allocate(len); - - if(new!=NULL){ - bcopy(addr,new,old_len); - os_invalidate(addr,old_len); + if(new!=NULL){ + bcopy(addr,new,old_len); + os_invalidate(addr,old_len); } - addr=new; + addr=new; } -#if 0 - else - fprintf(stderr,"Map grow: [0x%08x] %x -> %x\n", addr, old_len,len); -#endif } - return addr; } } -- GitLab