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 --- prog/encoding_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'prog/encoding_test.go') diff --git a/prog/encoding_test.go b/prog/encoding_test.go index a38e9deab..4ba9edd50 100644 --- a/prog/encoding_test.go +++ b/prog/encoding_test.go @@ -278,11 +278,12 @@ func TestDeserialize(t *testing.T) { StrictErr: `out arg const[1, const] has non-default value: 2`, }, { - In: `test$str1(&(0x7f0000000000)='foo\x00')`, + In: `test$str1(&(0x7f0000000000)='foo\x00')`, + Out: `test$str1(&(0x7f0000000000))`, }, { In: `test$str1(&(0x7f0000000000)='bar\x00')`, - Out: `test$str1(&(0x7f0000000000)='foo\x00')`, + Out: `test$str1(&(0x7f0000000000))`, StrictErr: `bad string value "bar\x00", expect ["foo\x00"]`, }, { -- cgit mrf-deployment