Skip to content

Commit 6e514de

Browse files
committed
Field-sensitive level-2 SSA renaming
Struct member and array index expressions are replaced by new SSA symbols such that updates to individual fields of structs or arrays do not affect the SSA index of the remaining object. This enables more fine-grained constant propagation, which should be particularly beneficial to Java (where structs/classes prevail).
1 parent 3fb0408 commit 6e514de

File tree

21 files changed

+650
-30
lines changed

21 files changed

+650
-30
lines changed

jbmc/regression/jbmc-generics/constant_propagation/test.desc

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ Test.class
33
--function Test.main --show-vcc
44
^EXIT=0$
55
^SIGNAL=0$
6-
^\{-\d+\} symex_dynamic::dynamic_object1#3 = \{ \{ \{ "java::GenericSub" \}, NULL, 0 \} \}$
7-
^\{-\d+\} symex_dynamic::dynamic_object1#4 = \{ \{ \{ "java::GenericSub" \}, NULL, 5 \} \}$
6+
^\{-\d+\} symex_dynamic::dynamic_object1#2 = \{ \{ \{ "java::GenericSub" \}, NULL, 0 \} \}$
7+
^\{-\d+\} symex_dynamic::dynamic_object1#2\.@Generic\[email protected]\.@class_identifier = "java::GenericSub"$
8+
^\{-\d+\} symex_dynamic::dynamic_object1#2\.@Generic\.key = NULL$
9+
^\{-\d+\} symex_dynamic::dynamic_object1#3\.@Generic\.x = 5$
810
--
911
byte_extract_(big|little)_endian
1012
--

jbmc/regression/jbmc-strings/ClassName/test.desc

-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@ test.class
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$
7-
\[java::test\.main:\(\)V\.assertion\.1\] line 5 assertion at file test\.java line 5 function java::test\.main:\(\)V bytecode-index 8: SUCCESS$
8-
\[java::test\.main:\(\)V\.assertion\.2\] line 6 assertion at file test\.java line 6 function java::test\.main:\(\)V bytecode-index 19: SUCCESS$

regression/cbmc-concurrency/norace_struct1/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG pthread
1+
CORE pthread
22
main.c
33

44
^EXIT=0$

regression/cbmc-concurrency/struct_and_array1/test.desc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG
1+
CORE
22
main.c
33

44
^EXIT=0$
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <assert.h>
2+
3+
struct S
4+
{
5+
int a;
6+
};
7+
8+
int main()
9+
{
10+
struct S s;
11+
s.a = 1;
12+
13+
assert(s.a == 1);
14+
15+
int A[1];
16+
A[0] = 1;
17+
18+
assert(A[0] == 1);
19+
20+
return 0;
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
(Starting CEGAR Loop|VCC\(s\), 0 remaining after simplification$)
8+
--
9+
^warning: ignoring
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
struct S
2+
{
3+
int v;
4+
struct Inner
5+
{
6+
int x;
7+
} inner;
8+
};
9+
10+
struct S works;
11+
12+
int main()
13+
{
14+
struct S fails;
15+
16+
works.v = 2;
17+
fails.v = 2;
18+
19+
while(works.v > 0)
20+
--(works.v);
21+
22+
while(fails.v > 0)
23+
--(fails.v);
24+
25+
__CPROVER_assert(works.inner.x == 0, "");
26+
27+
_Bool b;
28+
if(b)
29+
{
30+
struct S s = {42, {42}};
31+
}
32+
33+
return 0;
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
--unwind 5
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
(Starting CEGAR Loop|VCC\(s\), 0 remaining after simplification$)
8+
--
9+
^warning: ignoring
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
CORE broken-smt-backend
1+
THOROUGH broken-smt-backend
22
main.c
33

44
^EXIT=10$
55
^SIGNAL=0$
66
^VERIFICATION FAILED$
77
--
88
^warning: ignoring
9+
--
910
This test actually passes when using the SMT2 back-end, but takes 68 seconds to
1011
do so.
12+
13+
Field-sensitive encoding of array accesses for an array of 2^16 elements is very
14+
expensive. We might consider some bounds up to which we actually do field
15+
expansion.

regression/goto-harness/nondet_elements_longer_lists/test.desc

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
CORE
22
main.c
33
--harness-type call-function --max-nondet-tree-depth 4 --min-null-tree-depth 1 --function test_function
4-
\[test_function.unwind.\d+\] line \d+ unwinding assertion loop 0: SUCCESS
5-
\[test_function.unwind.\d+\] line \d+ unwinding assertion loop 1: SUCCESS
64
\[test_function.assertion.\d+\] line \d+ assertion list_walker->datum == \+\+i: SUCCESS
75
^EXIT=0$
86
^SIGNAL=0$

regression/goto-harness/nondet_elements_longer_lists_global/test.desc

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
CORE
22
main.c
33
--harness-type call-function --max-nondet-tree-depth 4 --min-null-tree-depth 1 --function test_function --nondet-globals
4-
\[test_function.unwind.\d+\] line \d+ unwinding assertion loop 0: SUCCESS
5-
\[test_function.unwind.\d+\] line \d+ unwinding assertion loop 1: SUCCESS
64
\[test_function.assertion.\d+\] line \d+ assertion list_walker->datum == \+\+i: SUCCESS
75
^EXIT=0$
86
^SIGNAL=0$

src/goto-symex/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
SRC = auto_objects.cpp \
22
build_goto_trace.cpp \
3+
field_sensitivity.cpp \
34
goto_state.cpp \
45
goto_symex.cpp \
56
goto_symex_state.cpp \

0 commit comments

Comments
 (0)