diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2021-04-21 08:01:30 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2021-04-21 14:05:20 +0200 |
| commit | ad3ce6afab30fb68cfcda40a1910b87279795c5a (patch) | |
| tree | 6a6febdaae83e071a85576bb6fa1fd5b8abb2936 /prog/encoding_test.go | |
| parent | 7ffd6ad61b0d0c6290f73b3652f79c63b305351e (diff) | |
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
Diffstat (limited to 'prog/encoding_test.go')
| -rw-r--r-- | prog/encoding_test.go | 5 |
1 files changed, 3 insertions, 2 deletions
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"]`, }, { |
