From 7cde509b68ea510b322ec29d45726cb1a2bbf567 Mon Sep 17 00:00:00 2001 From: Daan Date: Sun, 16 Jan 2022 12:07:07 -0800 Subject: [PATCH 1/5] fix warning on clang on macos --- src/alloc-override-osx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/alloc-override-osx.c b/src/alloc-override-osx.c index edd93b37..34cde0b4 100644 --- a/src/alloc-override-osx.c +++ b/src/alloc-override-osx.c @@ -183,6 +183,10 @@ static boolean_t intro_zone_locked(malloc_zone_t* zone) { #pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wc99-extensions" +#endif + static malloc_introspection_t mi_introspect = { .enumerator = &intro_enumerator, .good_size = &intro_good_size, From 9c583eb910963bbc9ded2daa9ed93ff31beab11f Mon Sep 17 00:00:00 2001 From: Daan Date: Sun, 16 Jan 2022 12:10:33 -0800 Subject: [PATCH 2/5] fix return code check on syscall (issue #524) --- src/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/random.c b/src/random.c index e47946a6..0b44c8b9 100644 --- a/src/random.c +++ b/src/random.c @@ -239,7 +239,7 @@ static bool os_random_buf(void* buf, size_t buf_len) { if (mi_atomic_load_acquire(&no_getrandom)==0) { ssize_t ret = syscall(SYS_getrandom, buf, buf_len, GRND_NONBLOCK); if (ret >= 0) return (buf_len == (size_t)ret); - if (ret != ENOSYS) return false; + if (errno != ENOSYS) return false; mi_atomic_store_release(&no_getrandom, 1UL); // don't call again, and fall back to /dev/urandom } #endif From 2cb2c7fd80110e51e4499e40950ceee1ba4310a3 Mon Sep 17 00:00:00 2001 From: Daan Date: Sun, 16 Jan 2022 12:12:45 -0800 Subject: [PATCH 3/5] fix uint8_t to size_t comparison (issue #525) --- src/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/segment.c b/src/segment.c index 424495ca..3af491d6 100644 --- a/src/segment.c +++ b/src/segment.c @@ -658,7 +658,7 @@ static mi_segment_t* mi_segment_init(mi_segment_t* segment, size_t required, mi_ memset((uint8_t*)segment + ofs, 0, info_size - ofs); // initialize pages info - for (uint8_t i = 0; i < capacity; i++) { + for (size_t i = 0; i < capacity; i++) { segment->pages[i].segment_idx = i; segment->pages[i].is_reset = false; segment->pages[i].is_committed = commit; From de113498203b63b96558d83d311862f55ef678cc Mon Sep 17 00:00:00 2001 From: Daan Date: Sun, 16 Jan 2022 12:20:32 -0800 Subject: [PATCH 4/5] remove spurious check and add further assertions (issue #526) --- src/page.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/page.c b/src/page.c index 3368bad1..f947b2aa 100644 --- a/src/page.c +++ b/src/page.c @@ -574,13 +574,16 @@ static void mi_page_extend_free(mi_heap_t* heap, mi_page_t* page, mi_tld_t* tld) // calculate the extend count const size_t bsize = (page->xblock_size < MI_HUGE_BLOCK_SIZE ? page->xblock_size : page_size); size_t extend = page->reserved - page->capacity; - size_t max_extend = (bsize >= MI_MAX_EXTEND_SIZE ? MI_MIN_EXTEND : MI_MAX_EXTEND_SIZE/(uint32_t)bsize); - if (max_extend < MI_MIN_EXTEND) max_extend = MI_MIN_EXTEND; + mi_assert_internal(extend > 0); + size_t max_extend = (bsize >= MI_MAX_EXTEND_SIZE ? MI_MIN_EXTEND : MI_MAX_EXTEND_SIZE/(uint32_t)bsize); + if (max_extend < MI_MIN_EXTEND) { max_extend = MI_MIN_EXTEND; } + mi_assert_internal(max_extend > 0); + if (extend > max_extend) { // ensure we don't touch memory beyond the page to reduce page commit. // the `lean` benchmark tests this. Going from 1 to 8 increases rss by 50%. - extend = (max_extend==0 ? 1 : max_extend); + extend = max_extend; } mi_assert_internal(extend > 0 && extend + page->capacity <= page->reserved); From 6401c6325ac5f014e1c8c96054ebbea0b63d0ad9 Mon Sep 17 00:00:00 2001 From: Daan Leijen Date: Sun, 16 Jan 2022 12:39:37 -0800 Subject: [PATCH 5/5] update minject for issue #521 --- bin/minject.exe | Bin 20992 -> 20992 bytes bin/minject32.exe | Bin 17920 -> 17920 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/bin/minject.exe b/bin/minject.exe index e576c71f3021a7f313b06a1f9925dcdba982a522..e5f87800d34eb1e04614a9e642eece2018b6cdf5 100644 GIT binary patch delta 308 zcmZoz!q~8caRUb<^Q*=ulern!vfB7DFceHwlxEzp`6lCOF~)|;OC{79Jtm)(Xk)xN zIYiQ#aqi?9l2(j)lP^o^DY`2$FnDyI{x7N|!@$sbpp?y{H=F5opyLj92B1W*sP<$f zsc6Rf$#qgidO3;=3@^lA{r`W)qx-T)FYgr)pB=%U1LA*w36k&SJ-=B_`nHH%QEEzN zQEGCDUP?}mb#7*EVopwevTlA^YEe;UO6q2I15Gx0pvx11wlOdPaWD`|1OTxGNQ8j_ ztI04YRX$b%T diff --git a/bin/minject32.exe b/bin/minject32.exe index 1eb8a75daef6328e611bb431118eb6f9a701c322..d0181028259e768db2eb6a706c2ed6d4ecba34ee 100644 GIT binary patch delta 322 zcmZqZVQlDOobZGBYvYrNzvr^H*f1~@OjML+{IPi_<8DF5kjbUOmW&aT*9#jnrT|Gj zHa{i?hMgIc#YM~+3nu%E7&DfDg_kk{g)1g+2MRY#eh(CG0So_O018i-94>0kIAwCb zs4?S=$%jP^luI!W(Wu3JGMY<2ohmn0Lo47H;@E*d-7@nNlutrzKM#$lOGtIn0&xcL9nb? o;9%&g*KTvn92}yum;Phi{LwI8h||Q@!q&ldhV6#UkuJ*_0caR?Pyhe` delta 321 zcmZqZVQlDOobZF$=j5GZ<8DDlo5`iZmW&RQ*9#jn`T$8i zHa{i?hMfVE#YM~+BPRQc7&FFzg_kk{g%c)k2MT9Qeh(DR0So_O018)34i`0NteM;| zYRuR$`LL*=T!)zhL)d>&6+;Jx<|90<2TD15-IzLEf4ol3V$bNAEF@OUXfU}=EKP9+ zP~nT+Z~y-f%iu5vGB<#kPe7tefy@kr&Aj3&!kay{?AbtGnA~k3X$_)V zo7e%d5lDoA0Vc-_Waj{V;sKQNK*&wLZ}4#PJ|>CD2MiSit>?=+r3F55?>U_3v^?y{ bYtGFd4daD4Wo#8}HEbJfXKapiS