From fc3b34358879d35e5052b0c137750bf9d9c3fe35 Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Tue, 11 Jul 2017 12:41:38 -0400 Subject: [PATCH] Use os_allocate(), not os_validate(), for "anywhere" allocation --- src/runtime/hopscotch.c | 6 +++--- src/runtime/interrupt.c | 2 +- src/runtime/thread.c | 2 +- src/runtime/traceroot.c | 2 +- src/runtime/validate.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/runtime/hopscotch.c b/src/runtime/hopscotch.c index fcb42ce28..b8b07694b 100644 --- a/src/runtime/hopscotch.c +++ b/src/runtime/hopscotch.c @@ -17,7 +17,7 @@ */ #include "os.h" -#include "gc-internal.h" // for os_validate() +#include "gc-internal.h" // for os_allocate() #include "hopscotch.h" #include #include @@ -123,7 +123,7 @@ void hopscotch_init() // Called once on runtime startup, from gc_init(). // Prefill the cache with 2 entries, each the size of a kernel page. int n_bytes_per_slice = getpagesize(); int n_bytes_total = N_CACHED_ALLOCS * n_bytes_per_slice; - char* mem = (char*)os_validate(0, n_bytes_total); + char* mem = os_allocate(n_bytes_total); gc_assert(mem); cached_alloc[0] = mem + ALLOCATION_OVERHEAD; cached_alloc[1] = cached_alloc[0] + n_bytes_per_slice; @@ -158,7 +158,7 @@ static char* cached_allocate(os_vm_size_t nbytes) // not a multiple of the mmap granularity, which we'll assume is 4K. // (It doesn't actually matter.) nbytes = CEILING(nbytes, hh_allocation_granularity); - char* result = os_validate(0, nbytes); + char* result = os_allocate(nbytes); gc_assert(result); result += ALLOCATION_OVERHEAD; usable_size(result) = nbytes - ALLOCATION_OVERHEAD; diff --git a/src/runtime/interrupt.c b/src/runtime/interrupt.c index 45a5a690c..de3e4c076 100644 --- a/src/runtime/interrupt.c +++ b/src/runtime/interrupt.c @@ -1476,7 +1476,7 @@ arrange_return_to_c_function(os_context_t *context, #endif #if defined(LISP_FEATURE_DARWIN) - u32 *register_save_area = (u32 *)os_validate(0, 0x40); + u32 *register_save_area = (u32 *)os_allocate(0x40); FSHOW_SIGNAL((stderr, "/arrange_return_to_lisp_function: preparing to go to function %x, sp: %x\n", function, *os_context_register_addr(context,reg_ESP))); diff --git a/src/runtime/thread.c b/src/runtime/thread.c index c2694f580..b4bea1c39 100644 --- a/src/runtime/thread.c +++ b/src/runtime/thread.c @@ -639,7 +639,7 @@ create_thread_struct(lispobj initial_function) { * on the alignment passed from os_validate, since that might * assume the current (e.g. 4k) pagesize, while we calculate with * the biggest (e.g. 64k) pagesize allowed by the ABI. */ - spaces=os_validate(0, THREAD_STRUCT_SIZE); + spaces = os_allocate(THREAD_STRUCT_SIZE); if(!spaces) return NULL; /* Aligning up is safe as THREAD_STRUCT_SIZE has diff --git a/src/runtime/traceroot.c b/src/runtime/traceroot.c index 33a96222e..407a62198 100644 --- a/src/runtime/traceroot.c +++ b/src/runtime/traceroot.c @@ -787,7 +787,7 @@ static void compute_heap_inverse(struct hopscotch_table* inverted_heap, uword_t scratchpad_min_size = (1 + ss.n_pointers) * 2 * sizeof (uint32_t); int pagesize = getpagesize(); uword_t scratchpad_size = CEILING(scratchpad_min_size, pagesize); - ss.scratchpad.base = os_validate(0, scratchpad_size); + ss.scratchpad.base = os_allocate(scratchpad_size); gc_assert(ss.scratchpad.base); ss.scratchpad.free = ss.scratchpad.base + 2 * sizeof(uint32_t); ss.scratchpad.end = ss.scratchpad.base + scratchpad_size; diff --git a/src/runtime/validate.c b/src/runtime/validate.c index 505b24724..ec0230952 100644 --- a/src/runtime/validate.c +++ b/src/runtime/validate.c @@ -42,7 +42,7 @@ os_vm_address_t undefined_alien_address = 0; static void ensure_undefined_alien(void) { - os_vm_address_t start = os_validate(NULL, os_vm_page_size); + os_vm_address_t start = os_allocate(os_vm_page_size); if (start) { os_protect(start, os_vm_page_size, OS_VM_PROT_NONE); undefined_alien_address = start; -- 2.11.4.GIT