From ad3ce6afab30fb68cfcda40a1910b87279795c5a Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 21 Apr 2021 08:01:30 +0200 Subject: pkg/compiler: optimize array[const] representation Represent array[const[X, int8], N] as string["XX...X"]. This replaces potentially huge number of: NONFAILING(*(uint8_t*)0x2000126c = 0); NONFAILING(*(uint8_t*)0x2000126d = 0); NONFAILING(*(uint8_t*)0x2000126e = 0); with a single memcpy. In one reproducer we had 3991 such lines. Also replace memcpy's with memset's when possible. Update #1070 --- sys/test/csource.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sys/test') diff --git a/sys/test/csource.txt b/sys/test/csource.txt index 0d1c847eb..e4c447b54 100644 --- a/sys/test/csource.txt +++ b/sys/test/csource.txt @@ -9,5 +9,6 @@ csource0(a int32) fd0 csource1(a fd0) csource2(a ptr[in, array[int8]]) csource3(a ptr[in, array[const[0, int8], 10]]) -csource4(a ptr[in, array[const[0xab, int8], 10]]) -csource5(a ptr[in, array[const[0x12345678, int32], 4]]) +csource4(a ptr[in, array[const[0x30, int8], 10]]) +csource5(a ptr[in, array[const[0x3130, int16], 5]]) +csource6(a ptr[in, array[const[0x3130, int16be], 6]]) -- cgit mrf-deployment