summaryrefslogtreecommitdiff
path: root/headers.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2021-09-11 11:47:13 +0300
committerIvan Maidanski <ivmai@mail.ru>2021-09-11 11:47:13 +0300
commit3e30dd469a6da0962b359390bb426b20af422d6a (patch)
treea31c5157796111a4c2e5cc600e8a55e04fea084a /headers.c
parent7aadbb5292977562cd63afadcb08e2b436b05e00 (diff)
downloadbdwgc-3e30dd469a6da0962b359390bb426b20af422d6a.tar.gz
Do not update scratch_last_end_ptr unless used by reg dynamic libraries
(refactoring) * headers.c (GC_scratch_alloc): Do not update GC_scratch_last_end_ptr unless USE_SCRATCH_LAST_END_PTR; add TODO item. * include/private/gc_priv.h [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX] (USE_SCRATCH_LAST_END_PTR): Define macro. * include/private/gc_priv.h (_GC_arrays._scratch_last_end_ptr, GC_scratch_last_end_ptr): Do define unless USE_SCRATCH_LAST_END_PTR; refine comment.
Diffstat (limited to 'headers.c')
-rw-r--r--headers.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/headers.c b/headers.c
index 375194c9..6247c438 100644
--- a/headers.c
+++ b/headers.c
@@ -122,11 +122,13 @@ GC_INNER ptr_t GC_scratch_alloc(size_t bytes)
GC_add_to_our_memory(result, bytes_to_get);
/* Undo scratch free area pointer update; get memory directly. */
GC_scratch_free_ptr -= bytes;
- if (result != NULL) {
+# ifdef USE_SCRATCH_LAST_END_PTR
+ if (result != NULL) {
/* Update end point of last obtained area (needed only */
/* by GC_register_dynamic_libraries for some targets). */
GC_scratch_last_end_ptr = result + bytes;
- }
+ }
+# endif
return result;
}
@@ -141,14 +143,19 @@ GC_INNER ptr_t GC_scratch_alloc(size_t bytes)
bytes_to_get = ROUNDUP_PAGESIZE_IF_MMAP(bytes);
result = (ptr_t)GET_MEM(bytes_to_get);
GC_add_to_our_memory(result, bytes_to_get);
- if (result != NULL)
+# ifdef USE_SCRATCH_LAST_END_PTR
+ if (result != NULL)
GC_scratch_last_end_ptr = result + bytes;
+# endif
return result;
}
+ /* TODO: some amount of unallocated space may remain unused forever */
/* Update scratch area pointers and retry. */
GC_scratch_free_ptr = result;
GC_scratch_end_ptr = GC_scratch_free_ptr + bytes_to_get;
- GC_scratch_last_end_ptr = GC_scratch_end_ptr;
+# ifdef USE_SCRATCH_LAST_END_PTR
+ GC_scratch_last_end_ptr = GC_scratch_end_ptr;
+# endif
}
}