Skip to content

Commit

Permalink
Improvement: handle drop and assert of the form `[return: bbX, unwind…
Browse files Browse the repository at this point in the history
… terminate]`

This is important since a lot of example programs exhibit this structure since the `UnwindAction` enum was introduced to rustc in rust-lang/rust#102906

In a previous commit, the change in rustc was incorporated but without handling all the cases.
This improvement now handles all the variants that
enum `UnwindAction` has instead of ignoring some of them.
8cf95cd
  • Loading branch information
hlisdero committed May 7, 2023
1 parent 56a2b28 commit e255731
Show file tree
Hide file tree
Showing 27 changed files with 553 additions and 20 deletions.
3 changes: 3 additions & 0 deletions examples/results/condvar/self_notify_lost_signal/net.dot
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ digraph petrinet {
main_SWITCH_INT_8 [shape="box" xlabel="" label="main_SWITCH_INT_8"];
main_SWITCH_INT_9 [shape="box" xlabel="" label="main_SWITCH_INT_9"];
main_UNWIND_8 [shape="box" xlabel="" label="main_UNWIND_8"];
main_UNWIND_9 [shape="box" xlabel="" label="main_UNWIND_9"];
std_result_Result_unwrap_0_CALL [shape="box" xlabel="" label="std_result_Result_unwrap_0_CALL"];
std_sync_Condvar_new_0_CALL [shape="box" xlabel="" label="std_sync_Condvar_new_0_CALL"];
std_sync_Condvar_notify_one_0_CALL [shape="box" xlabel="" label="std_sync_Condvar_notify_one_0_CALL"];
Expand Down Expand Up @@ -82,6 +83,7 @@ digraph petrinet {
main_BB7_END_PLACE -> main_RETURN;
main_BB8 -> main_UNWIND_8;
main_BB9 -> main_DROP_9;
main_BB9 -> main_UNWIND_9;
CONDVAR_0_T1 -> CONDVAR_0_P1;
CONDVAR_0_T2 -> CONDVAR_0_P1;
CONDVAR_0_T2 -> CONDVAR_0_P4;
Expand All @@ -102,6 +104,7 @@ digraph petrinet {
main_SWITCH_INT_8 -> main_BB8;
main_SWITCH_INT_9 -> main_BB9;
main_UNWIND_8 -> PROGRAM_PANIC;
main_UNWIND_9 -> PROGRAM_PANIC;
std_result_Result_unwrap_0_CALL -> main_BB4;
std_sync_Condvar_new_0_CALL -> main_BB2;
std_sync_Condvar_notify_one_0_CALL -> CONDVAR_0_P2;
Expand Down
5 changes: 5 additions & 0 deletions examples/results/condvar/self_notify_lost_signal/net.lola
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ TRANSITION main_UNWIND_8
main_BB8 : 1;
PRODUCE
PROGRAM_PANIC : 1;
TRANSITION main_UNWIND_9
CONSUME
main_BB9 : 1;
PRODUCE
PROGRAM_PANIC : 1;
TRANSITION std_result_Result_unwrap_0_CALL
CONSUME
main_BB3 : 1;
Expand Down
21 changes: 21 additions & 0 deletions examples/results/condvar/self_notify_lost_signal/net.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@
<text>main_UNWIND_8</text>
</name>
</transition>
<transition id="main_UNWIND_9">
<name>
<text>main_UNWIND_9</text>
</name>
</transition>
<transition id="std_result_Result_unwrap_0_CALL">
<name>
<text>std_result_Result_unwrap_0_CALL</text>
Expand Down Expand Up @@ -519,6 +524,14 @@
<text>1</text>
</inscription>
</arc>
<arc source="main_BB9" target="main_UNWIND_9" id="(main_BB9, main_UNWIND_9)">
<name>
<text>(main_BB9, main_UNWIND_9)</text>
</name>
<inscription>
<text>1</text>
</inscription>
</arc>
<arc source="CONDVAR_0_T1" target="CONDVAR_0_P1" id="(CONDVAR_0_T1, CONDVAR_0_P1)">
<name>
<text>(CONDVAR_0_T1, CONDVAR_0_P1)</text>
Expand Down Expand Up @@ -679,6 +692,14 @@
<text>1</text>
</inscription>
</arc>
<arc source="main_UNWIND_9" target="PROGRAM_PANIC" id="(main_UNWIND_9, PROGRAM_PANIC)">
<name>
<text>(main_UNWIND_9, PROGRAM_PANIC)</text>
</name>
<inscription>
<text>1</text>
</inscription>
</arc>
<arc source="std_result_Result_unwrap_0_CALL" target="main_BB4" id="(std_result_Result_unwrap_0_CALL, main_BB4)">
<name>
<text>(std_result_Result_unwrap_0_CALL, main_BB4)</text>
Expand Down
12 changes: 12 additions & 0 deletions examples/results/condvar/two_threads_sharing_condvar/net.dot
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ digraph petrinet {
main_SWITCH_INT_15 [shape="box" xlabel="" label="main_SWITCH_INT_15"];
main_SWITCH_INT_18 [shape="box" xlabel="" label="main_SWITCH_INT_18"];
main_SWITCH_INT_20 [shape="box" xlabel="" label="main_SWITCH_INT_20"];
main_UNWIND_18 [shape="box" xlabel="" label="main_UNWIND_18"];
main_UNWIND_19 [shape="box" xlabel="" label="main_UNWIND_19"];
main_UNWIND_20 [shape="box" xlabel="" label="main_UNWIND_20"];
main__closure_0__BB0_STMT0 [shape="box" xlabel="" label="main__closure_0__BB0_STMT0"];
main__closure_0__BB1_STMT0 [shape="box" xlabel="" label="main__closure_0__BB1_STMT0"];
main__closure_0__BB1_STMT1 [shape="box" xlabel="" label="main__closure_0__BB1_STMT1"];
Expand All @@ -110,6 +112,8 @@ digraph petrinet {
main__closure_0__DROP_UNWIND_5 [shape="box" xlabel="" label="main__closure_0__DROP_UNWIND_5"];
main__closure_0__RETURN [shape="box" xlabel="" label="main__closure_0__RETURN"];
main__closure_0__UNWIND_10 [shape="box" xlabel="" label="main__closure_0__UNWIND_10"];
main__closure_0__UNWIND_8 [shape="box" xlabel="" label="main__closure_0__UNWIND_8"];
main__closure_0__UNWIND_9 [shape="box" xlabel="" label="main__closure_0__UNWIND_9"];
std_clone_Clone_clone_0_CALL [shape="box" xlabel="" label="std_clone_Clone_clone_0_CALL"];
std_clone_Clone_clone_0_CALL_UNWIND [shape="box" xlabel="" label="std_clone_Clone_clone_0_CALL_UNWIND"];
std_ops_DerefMut_deref_mut_0_CALL [shape="box" xlabel="" label="std_ops_DerefMut_deref_mut_0_CALL"];
Expand Down Expand Up @@ -175,9 +179,11 @@ digraph petrinet {
main_BB16_END_PLACE -> main_DROP_16;
main_BB17 -> main_RETURN;
main_BB18 -> main_DROP_18;
main_BB18 -> main_UNWIND_18;
main_BB19 -> main_UNWIND_19;
main_BB2 -> main_BB2_STMT0;
main_BB20 -> main_DROP_20;
main_BB20 -> main_UNWIND_20;
main_BB21 -> main_SWITCH_INT_18;
main_BB21 -> main_SWITCH_INT_20;
main_BB2_END_PLACE -> std_sync_Arc_T_new_0_CALL;
Expand Down Expand Up @@ -222,7 +228,9 @@ digraph petrinet {
main__closure_0__BB6 -> main__closure_0__DROP_6;
main__closure_0__BB7 -> main__closure_0__RETURN;
main__closure_0__BB8 -> main__closure_0__DROP_8;
main__closure_0__BB8 -> main__closure_0__UNWIND_8;
main__closure_0__BB9 -> main__closure_0__DROP_9;
main__closure_0__BB9 -> main__closure_0__UNWIND_9;
CONDVAR_0_T1 -> CONDVAR_0_P1;
CONDVAR_0_T2 -> CONDVAR_0_P1;
CONDVAR_0_T2 -> CONDVAR_0_P4;
Expand Down Expand Up @@ -259,7 +267,9 @@ digraph petrinet {
main_SWITCH_INT_15 -> main_BB15;
main_SWITCH_INT_18 -> main_BB18;
main_SWITCH_INT_20 -> main_BB20;
main_UNWIND_18 -> PROGRAM_PANIC;
main_UNWIND_19 -> PROGRAM_PANIC;
main_UNWIND_20 -> PROGRAM_PANIC;
main__closure_0__BB0_STMT0 -> main__closure_0__BB0_END_PLACE;
main__closure_0__BB1_STMT0 -> main__closure_0__BB1_STMT0_END;
main__closure_0__BB1_STMT1 -> main__closure_0__BB1_STMT1_END;
Expand All @@ -275,6 +285,8 @@ digraph petrinet {
main__closure_0__DROP_UNWIND_5 -> main__closure_0__BB9;
main__closure_0__RETURN -> THREAD_0_END;
main__closure_0__UNWIND_10 -> THREAD_0_END;
main__closure_0__UNWIND_8 -> THREAD_0_END;
main__closure_0__UNWIND_9 -> THREAD_0_END;
std_clone_Clone_clone_0_CALL -> main_BB4;
std_clone_Clone_clone_0_CALL_UNWIND -> main_BB18;
std_ops_DerefMut_deref_mut_0_CALL -> main__closure_0__BB4;
Expand Down
20 changes: 20 additions & 0 deletions examples/results/condvar/two_threads_sharing_condvar/net.lola
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,21 @@ TRANSITION main_SWITCH_INT_20
main_BB21 : 1;
PRODUCE
main_BB20 : 1;
TRANSITION main_UNWIND_18
CONSUME
main_BB18 : 1;
PRODUCE
PROGRAM_PANIC : 1;
TRANSITION main_UNWIND_19
CONSUME
main_BB19 : 1;
PRODUCE
PROGRAM_PANIC : 1;
TRANSITION main_UNWIND_20
CONSUME
main_BB20 : 1;
PRODUCE
PROGRAM_PANIC : 1;
TRANSITION main__closure_0__BB0_STMT0
CONSUME
THREAD_0_START : 1;
Expand Down Expand Up @@ -310,6 +320,16 @@ TRANSITION main__closure_0__UNWIND_10
main__closure_0__BB10 : 1;
PRODUCE
THREAD_0_END : 1;
TRANSITION main__closure_0__UNWIND_8
CONSUME
main__closure_0__BB8 : 1;
PRODUCE
THREAD_0_END : 1;
TRANSITION main__closure_0__UNWIND_9
CONSUME
main__closure_0__BB9 : 1;
PRODUCE
THREAD_0_END : 1;
TRANSITION std_clone_Clone_clone_0_CALL
CONSUME
main_BB3_END_PLACE : 1;
Expand Down
84 changes: 84 additions & 0 deletions examples/results/condvar/two_threads_sharing_condvar/net.pnml
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,21 @@
<text>main_SWITCH_INT_20</text>
</name>
</transition>
<transition id="main_UNWIND_18">
<name>
<text>main_UNWIND_18</text>
</name>
</transition>
<transition id="main_UNWIND_19">
<name>
<text>main_UNWIND_19</text>
</name>
</transition>
<transition id="main_UNWIND_20">
<name>
<text>main_UNWIND_20</text>
</name>
</transition>
<transition id="main__closure_0__BB0_STMT0">
<name>
<text>main__closure_0__BB0_STMT0</text>
Expand Down Expand Up @@ -566,6 +576,16 @@
<text>main__closure_0__UNWIND_10</text>
</name>
</transition>
<transition id="main__closure_0__UNWIND_8">
<name>
<text>main__closure_0__UNWIND_8</text>
</name>
</transition>
<transition id="main__closure_0__UNWIND_9">
<name>
<text>main__closure_0__UNWIND_9</text>
</name>
</transition>
<transition id="std_clone_Clone_clone_0_CALL">
<name>
<text>std_clone_Clone_clone_0_CALL</text>
Expand Down Expand Up @@ -996,6 +1016,14 @@
<text>1</text>
</inscription>
</arc>
<arc source="main_BB18" target="main_UNWIND_18" id="(main_BB18, main_UNWIND_18)">
<name>
<text>(main_BB18, main_UNWIND_18)</text>
</name>
<inscription>
<text>1</text>
</inscription>
</arc>
<arc source="main_BB19" target="main_UNWIND_19" id="(main_BB19, main_UNWIND_19)">
<name>
<text>(main_BB19, main_UNWIND_19)</text>
Expand All @@ -1020,6 +1048,14 @@
<text>1</text>
</inscription>
</arc>
<arc source="main_BB20" target="main_UNWIND_20" id="(main_BB20, main_UNWIND_20)">
<name>
<text>(main_BB20, main_UNWIND_20)</text>
</name>
<inscription>
<text>1</text>
</inscription>
</arc>
<arc source="main_BB21" target="main_SWITCH_INT_18" id="(main_BB21, main_SWITCH_INT_18)">
<name>
<text>(main_BB21, main_SWITCH_INT_18)</text>
Expand Down Expand Up @@ -1372,6 +1408,14 @@
<text>1</text>
</inscription>
</arc>
<arc source="main__closure_0__BB8" target="main__closure_0__UNWIND_8" id="(main__closure_0__BB8, main__closure_0__UNWIND_8)">
<name>
<text>(main__closure_0__BB8, main__closure_0__UNWIND_8)</text>
</name>
<inscription>
<text>1</text>
</inscription>
</arc>
<arc source="main__closure_0__BB9" target="main__closure_0__DROP_9" id="(main__closure_0__BB9, main__closure_0__DROP_9)">
<name>
<text>(main__closure_0__BB9, main__closure_0__DROP_9)</text>
Expand All @@ -1380,6 +1424,14 @@
<text>1</text>
</inscription>
</arc>
<arc source="main__closure_0__BB9" target="main__closure_0__UNWIND_9" id="(main__closure_0__BB9, main__closure_0__UNWIND_9)">
<name>
<text>(main__closure_0__BB9, main__closure_0__UNWIND_9)</text>
</name>
<inscription>
<text>1</text>
</inscription>
</arc>
<arc source="CONDVAR_0_T1" target="CONDVAR_0_P1" id="(CONDVAR_0_T1, CONDVAR_0_P1)">
<name>
<text>(CONDVAR_0_T1, CONDVAR_0_P1)</text>
Expand Down Expand Up @@ -1668,6 +1720,14 @@
<text>1</text>
</inscription>
</arc>
<arc source="main_UNWIND_18" target="PROGRAM_PANIC" id="(main_UNWIND_18, PROGRAM_PANIC)">
<name>
<text>(main_UNWIND_18, PROGRAM_PANIC)</text>
</name>
<inscription>
<text>1</text>
</inscription>
</arc>
<arc source="main_UNWIND_19" target="PROGRAM_PANIC" id="(main_UNWIND_19, PROGRAM_PANIC)">
<name>
<text>(main_UNWIND_19, PROGRAM_PANIC)</text>
Expand All @@ -1676,6 +1736,14 @@
<text>1</text>
</inscription>
</arc>
<arc source="main_UNWIND_20" target="PROGRAM_PANIC" id="(main_UNWIND_20, PROGRAM_PANIC)">
<name>
<text>(main_UNWIND_20, PROGRAM_PANIC)</text>
</name>
<inscription>
<text>1</text>
</inscription>
</arc>
<arc source="main__closure_0__BB0_STMT0" target="main__closure_0__BB0_END_PLACE" id="(main__closure_0__BB0_STMT0, main__closure_0__BB0_END_PLACE)">
<name>
<text>(main__closure_0__BB0_STMT0, main__closure_0__BB0_END_PLACE)</text>
Expand Down Expand Up @@ -1796,6 +1864,22 @@
<text>1</text>
</inscription>
</arc>
<arc source="main__closure_0__UNWIND_8" target="THREAD_0_END" id="(main__closure_0__UNWIND_8, THREAD_0_END)">
<name>
<text>(main__closure_0__UNWIND_8, THREAD_0_END)</text>
</name>
<inscription>
<text>1</text>
</inscription>
</arc>
<arc source="main__closure_0__UNWIND_9" target="THREAD_0_END" id="(main__closure_0__UNWIND_9, THREAD_0_END)">
<name>
<text>(main__closure_0__UNWIND_9, THREAD_0_END)</text>
</name>
<inscription>
<text>1</text>
</inscription>
</arc>
<arc source="std_clone_Clone_clone_0_CALL" target="main_BB4" id="(std_clone_Clone_clone_0_CALL, main_BB4)">
<name>
<text>(std_clone_Clone_clone_0_CALL, main_BB4)</text>
Expand Down
3 changes: 3 additions & 0 deletions examples/results/function_call/greet/net.dot
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ digraph petrinet {
main_RETURN [shape="box" xlabel="" label="main_RETURN"];
main_SWITCH_INT_4 [shape="box" xlabel="" label="main_SWITCH_INT_4"];
main_SWITCH_INT_9 [shape="box" xlabel="" label="main_SWITCH_INT_9"];
main_UNWIND_15 [shape="box" xlabel="" label="main_UNWIND_15"];
main_UNWIND_16 [shape="box" xlabel="" label="main_UNWIND_16"];
std_env_args_0_CALL [shape="box" xlabel="" label="std_env_args_0_CALL"];
std_fmt_Arguments_a_new_v1_0_CALL [shape="box" xlabel="" label="std_fmt_Arguments_a_new_v1_0_CALL"];
Expand Down Expand Up @@ -95,6 +96,7 @@ digraph petrinet {
main_BB13 -> main_DROP_13;
main_BB14 -> main_RETURN;
main_BB15 -> main_DROP_15;
main_BB15 -> main_UNWIND_15;
main_BB16 -> main_UNWIND_16;
main_BB2 -> main_BB2_STMT0;
main_BB2_END_PLACE -> std_vec_Vec_T_A_len_0_CALL;
Expand Down Expand Up @@ -145,6 +147,7 @@ digraph petrinet {
main_RETURN -> PROGRAM_END;
main_SWITCH_INT_4 -> main_BB4;
main_SWITCH_INT_9 -> main_BB9;
main_UNWIND_15 -> PROGRAM_PANIC;
main_UNWIND_16 -> PROGRAM_PANIC;
std_env_args_0_CALL -> main_BB1;
std_fmt_Arguments_a_new_v1_0_CALL -> main_BB7;
Expand Down
5 changes: 5 additions & 0 deletions examples/results/function_call/greet/net.lola
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ TRANSITION main_SWITCH_INT_9
main_BB3 : 1;
PRODUCE
main_BB9 : 1;
TRANSITION main_UNWIND_15
CONSUME
main_BB15 : 1;
PRODUCE
PROGRAM_PANIC : 1;
TRANSITION main_UNWIND_16
CONSUME
main_BB16 : 1;
Expand Down
Loading

0 comments on commit e255731

Please sign in to comment.