From: Ivan Maidanski Date: Sat, 30 Jun 2018 04:37:54 +0000 (+0300) Subject: Compute GC_CONS arguments just once X-Git-Tag: v8.0.0~93 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0553eb04299636f9fbaefb33e6c9ea4377ee6e03;p=gc Compute GC_CONS arguments just once (fix of commit 8eb6f8d) * include/gc_inline.h (GC_CONS): Declare l and r local variables; compute first and second expression even in case of GC_MALLOC_WORDS_KIND failure; pass l and r to GC_reachable_here (instead of first and second). --- diff --git a/include/gc_inline.h b/include/gc_inline.h index 0117dd38..6527c3eb 100644 --- a/include/gc_inline.h +++ b/include/gc_inline.h @@ -189,13 +189,15 @@ GC_API GC_ATTR_MALLOC GC_ATTR_ALLOC_SIZE(1) void * GC_CALL /* And once more for two word initialized objects: */ # define GC_CONS(result, first, second, tiny_fl) \ do { \ + void *l = (void *)(first); \ + void *r = (void *)(second); \ GC_MALLOC_WORDS_KIND(result, 2, tiny_fl, GC_I_NORMAL, (void)0); \ if ((result) != NULL) { \ - *(void **)(result) = (void *)(first); \ - ((void **)(result))[1] = (void *)(second); \ + *(void **)(result) = l; \ + ((void **)(result))[1] = r; \ GC_end_stubborn_change(result); \ - GC_reachable_here(first); \ - GC_reachable_here(second); \ + GC_reachable_here(l); \ + GC_reachable_here(r); \ } \ } while (0)