Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macro Madness #69

Merged
merged 9 commits into from
Oct 17, 2024
Merged

Macro Madness #69

merged 9 commits into from
Oct 17, 2024

Conversation

tanneberger
Copy link
Member

No description provided.

@tanneberger tanneberger requested a review from erlingrj October 16, 2024 23:42
@erlingrj erlingrj changed the title [DRAFT] Macro Magic [DRAFT] Macro Madness Oct 17, 2024
@erlingrj
Copy link
Collaborator

I like this a lot! It makes the idea of using reactor-uc as a standalone library actually feasible!

A few comments:

  1. The macro arguments which represent values (e.g. sizes etc) should always be referred to with paranthesis in the macro-body because they might be expressions. You will see this with the other macros I defined.
  2. Can we find another name than CONSTRUCT_X since we aren't constructing it, but defining the constructor. I would argue that defining the constructor should be part of DEFINE_X
  3. Connections are still todo. Would be nice with a CONNECT(output, input) macro instead of CONN_REGISTER_UPSTREAM and CONN_REGISTER_DOWNSTREAM.
  4. Can we figure out something clever for the reactors? There are some boilerplate fields such as Trigger * _triggers[numTriggers], Reaction *_reactions[numReactions and Reactor *_children[numChildren]. It is also the initializing of those fields. Might be very hard, maybe impossible

Copy link
Contributor

Memory usage after merging this PR will be:

Memory Report

action_microstep_test_c

from to increase (%)
text 71894 72094 0.28
data 976 976 0.00
bss 480 480 0.00
total 73350 73550 0.27

action_test_c

from to increase (%)
text 71715 71926 0.29
data 976 976 0.00
bss 480 480 0.00
total 73171 73382 0.29

delayed_conn_test_c

from to increase (%)
text 76371 76357 -0.02
data 968 968 0.00
bss 480 480 0.00
total 77819 77805 -0.02

event_queue_test_c

from to increase (%)
text 23406 23406 0.00
data 648 648 0.00
bss 320 320 0.00
total 24374 24374 0.00

physical_action_test_c

from to increase (%)
text 72950 72950 0.00
data 977 977 0.00
bss 1952 1952 0.00
total 75879 75879 0.00

port_test_c

from to increase (%)
text 76337 76323 -0.02
data 968 968 0.00
bss 480 480 0.00
total 77785 77771 -0.02

reaction_queue_test_c

from to increase (%)
text 23083 23083 0.00
data 648 648 0.00
bss 320 320 0.00
total 24051 24051 0.00

shutdown_test_c

from to increase (%)
text 68208 68258 0.07
data 976 976 0.00
bss 480 480 0.00
total 69664 69714 0.07

startup_test_c

from to increase (%)
text 67325 67574 0.37
data 976 976 0.00
bss 480 480 0.00
total 68781 69030 0.36

timer_test_c

from to increase (%)
text 67325 67329 0.01
data 968 968 0.00
bss 480 480 0.00
total 68773 68777 0.01

trigger_data_queue_test_c

from to increase (%)
text 19344 19344 0.00
data 648 648 0.00
bss 320 320 0.00
total 20312 20312 0.00

@tanneberger
Copy link
Member Author

@erlingrj

2.) I guess the reason I left it two different things is that, the constructor needs to know the type of the parent reactor, which is defined after all the reactor components.

I am happy to merge it but then, we need to empty declaration of the reactor at the top.

Copy link
Contributor

Memory usage after merging this PR will be:

Memory Report

action_microstep_test_c

from to increase (%)
text 71894 72094 0.28
data 976 976 0.00
bss 480 480 0.00
total 73350 73550 0.27

action_test_c

from to increase (%)
text 71715 71926 0.29
data 976 976 0.00
bss 480 480 0.00
total 73171 73382 0.29

delayed_conn_test_c

from to increase (%)
text 76371 76357 -0.02
data 968 968 0.00
bss 480 480 0.00
total 77819 77805 -0.02

event_queue_test_c

from to increase (%)
text 23406 23406 0.00
data 648 648 0.00
bss 320 320 0.00
total 24374 24374 0.00

physical_action_test_c

from to increase (%)
text 72950 72950 0.00
data 977 977 0.00
bss 1952 1952 0.00
total 75879 75879 0.00

port_test_c

from to increase (%)
text 76337 76323 -0.02
data 968 968 0.00
bss 480 480 0.00
total 77785 77771 -0.02

reaction_queue_test_c

from to increase (%)
text 23083 23083 0.00
data 648 648 0.00
bss 320 320 0.00
total 24051 24051 0.00

shutdown_test_c

from to increase (%)
text 68208 68258 0.07
data 976 976 0.00
bss 480 480 0.00
total 69664 69714 0.07

startup_test_c

from to increase (%)
text 67325 67574 0.37
data 976 976 0.00
bss 480 480 0.00
total 68781 69030 0.36

timer_test_c

from to increase (%)
text 67325 67329 0.01
data 968 968 0.00
bss 480 480 0.00
total 68773 68777 0.01

trigger_data_queue_test_c

from to increase (%)
text 19344 19344 0.00
data 648 648 0.00
bss 320 320 0.00
total 20312 20312 0.00

Copy link
Contributor

Memory usage after merging this PR will be:

Memory Report

action_microstep_test_c

from to increase (%)
text 71894 72094 0.28
data 976 976 0.00
bss 480 480 0.00
total 73350 73550 0.27

action_test_c

from to increase (%)
text 71715 71926 0.29
data 976 976 0.00
bss 480 480 0.00
total 73171 73382 0.29

delayed_conn_test_c

from to increase (%)
text 76371 76356 -0.02
data 968 968 0.00
bss 480 480 0.00
total 77819 77804 -0.02

event_queue_test_c

from to increase (%)
text 23406 23406 0.00
data 648 648 0.00
bss 320 320 0.00
total 24374 24374 0.00

physical_action_test_c

from to increase (%)
text 72950 72950 0.00
data 977 977 0.00
bss 1952 1952 0.00
total 75879 75879 0.00

port_test_c

from to increase (%)
text 76337 76322 -0.02
data 968 968 0.00
bss 480 480 0.00
total 77785 77770 -0.02

reaction_queue_test_c

from to increase (%)
text 23083 23083 0.00
data 648 648 0.00
bss 320 320 0.00
total 24051 24051 0.00

shutdown_test_c

from to increase (%)
text 68208 68258 0.07
data 976 976 0.00
bss 480 480 0.00
total 69664 69714 0.07

startup_test_c

from to increase (%)
text 67325 67574 0.37
data 976 976 0.00
bss 480 480 0.00
total 68781 69030 0.36

timer_test_c

from to increase (%)
text 67325 67329 0.01
data 968 968 0.00
bss 480 480 0.00
total 68773 68777 0.01

trigger_data_queue_test_c

from to increase (%)
text 19344 19344 0.00
data 648 648 0.00
bss 320 320 0.00
total 20312 20312 0.00

Copy link
Contributor

Memory usage after merging this PR will be:

Memory Report

action_microstep_test_c

from to increase (%)
text 71894 72094 0.28
data 976 976 0.00
bss 480 480 0.00
total 73350 73550 0.27

action_test_c

from to increase (%)
text 71715 71926 0.29
data 976 976 0.00
bss 480 480 0.00
total 73171 73382 0.29

delayed_conn_test_c

from to increase (%)
text 76371 76437 0.09
data 968 968 0.00
bss 480 480 0.00
total 77819 77885 0.08

event_queue_test_c

from to increase (%)
text 23406 23406 0.00
data 648 648 0.00
bss 320 320 0.00
total 24374 24374 0.00

physical_action_test_c

from to increase (%)
text 72950 72950 0.00
data 977 977 0.00
bss 1952 1952 0.00
total 75879 75879 0.00

port_test_c

from to increase (%)
text 76337 76403 0.09
data 968 968 0.00
bss 480 480 0.00
total 77785 77851 0.08

reaction_queue_test_c

from to increase (%)
text 23083 23083 0.00
data 648 648 0.00
bss 320 320 0.00
total 24051 24051 0.00

shutdown_test_c

from to increase (%)
text 68208 68258 0.07
data 976 976 0.00
bss 480 480 0.00
total 69664 69714 0.07

startup_test_c

from to increase (%)
text 67325 67574 0.37
data 976 976 0.00
bss 480 480 0.00
total 68781 69030 0.36

timer_test_c

from to increase (%)
text 67325 67410 0.13
data 968 968 0.00
bss 480 480 0.00
total 68773 68858 0.12

trigger_data_queue_test_c

from to increase (%)
text 19344 19344 0.00
data 648 648 0.00
bss 320 320 0.00
total 20312 20312 0.00

Copy link
Contributor

Memory usage after merging this PR will be:

Memory Report

action_microstep_test_c

from to increase (%)
text 71894 72094 0.28
data 976 976 0.00
bss 480 480 0.00
total 73350 73550 0.27

action_test_c

from to increase (%)
text 71715 71926 0.29
data 976 976 0.00
bss 480 480 0.00
total 73171 73382 0.29

delayed_conn_test_c

from to increase (%)
text 76371 76437 0.09
data 968 968 0.00
bss 480 480 0.00
total 77819 77885 0.08

event_queue_test_c

from to increase (%)
text 23406 23406 0.00
data 648 648 0.00
bss 320 320 0.00
total 24374 24374 0.00

physical_action_test_c

from to increase (%)
text 72950 72950 0.00
data 977 977 0.00
bss 1952 1952 0.00
total 75879 75879 0.00

port_test_c

from to increase (%)
text 76337 76403 0.09
data 968 968 0.00
bss 480 480 0.00
total 77785 77851 0.08

reaction_queue_test_c

from to increase (%)
text 23083 23083 0.00
data 648 648 0.00
bss 320 320 0.00
total 24051 24051 0.00

shutdown_test_c

from to increase (%)
text 68208 68257 0.07
data 976 976 0.00
bss 480 480 0.00
total 69664 69713 0.07

startup_test_c

from to increase (%)
text 67325 67573 0.37
data 976 976 0.00
bss 480 480 0.00
total 68781 69029 0.36

timer_test_c

from to increase (%)
text 67325 67410 0.13
data 968 968 0.00
bss 480 480 0.00
total 68773 68858 0.12

trigger_data_queue_test_c

from to increase (%)
text 19344 19344 0.00
data 648 648 0.00
bss 320 320 0.00
total 20312 20312 0.00

@tanneberger tanneberger self-assigned this Oct 17, 2024
@tanneberger tanneberger added the enhancement New feature or request label Oct 17, 2024
@tanneberger tanneberger changed the title [DRAFT] Macro Madness Macro Madness Oct 17, 2024
Copy link
Contributor

Memory usage after merging this PR will be:

Memory Report

action_microstep_test_c

from to increase (%)
text 71894 72094 0.28
data 976 976 0.00
bss 480 480 0.00
total 73350 73550 0.27

action_test_c

from to increase (%)
text 71715 71926 0.29
data 976 976 0.00
bss 480 480 0.00
total 73171 73382 0.29

delayed_conn_test_c

from to increase (%)
text 76371 76437 0.09
data 968 968 0.00
bss 480 480 0.00
total 77819 77885 0.08

event_queue_test_c

from to increase (%)
text 23406 23406 0.00
data 648 648 0.00
bss 320 320 0.00
total 24374 24374 0.00

physical_action_test_c

from to increase (%)
text 72950 72950 0.00
data 977 977 0.00
bss 1952 1952 0.00
total 75879 75879 0.00

port_test_c

from to increase (%)
text 76337 76403 0.09
data 968 968 0.00
bss 480 480 0.00
total 77785 77851 0.08

reaction_queue_test_c

from to increase (%)
text 23083 23083 0.00
data 648 648 0.00
bss 320 320 0.00
total 24051 24051 0.00

shutdown_test_c

from to increase (%)
text 68208 68257 0.07
data 976 976 0.00
bss 480 480 0.00
total 69664 69713 0.07

startup_test_c

from to increase (%)
text 67325 67573 0.37
data 976 976 0.00
bss 480 480 0.00
total 68781 69029 0.36

timer_test_c

from to increase (%)
text 67325 67410 0.13
data 968 968 0.00
bss 480 480 0.00
total 68773 68858 0.12

trigger_data_queue_test_c

from to increase (%)
text 19344 19344 0.00
data 648 648 0.00
bss 320 320 0.00
total 20312 20312 0.00

Copy link
Contributor

Coverage after merging macro-magic into main will be

31.96%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
external/nanopb
   pb_common.c0%0%0%0%100, 100, 100, 100, 100, 102, 106, 110, 110, 110, 110, 110, 112, 116, 119, 122, 124, 126, 126, 126, 129–132, 14, 14, 14, 142–144, 15, 150–152, 152, 152, 152, 152, 154, 156, 158, 160–161, 163, 166, 168, 17, 171–172, 172, 172, 177, 18, 181, 184–185, 188, 190–192, 195, 197, 197, 197, 199, 20, 20, 20, 20, 20, 201, 201, 201, 203, 207, 210, 210, 210, 215, 22, 221, 224, 226, 226, 226, 229, 231, 231, 231–232, 232, 232, 235, 238, 238, 238, 24, 241–242, 246, 248, 248, 248, 25, 250, 254, 26, 260, 263, 265, 265, 265, 267, 269, 269, 269, 27, 272–273, 277, 28, 286–287, 29, 290, 292, 295, 297, 300, 302, 302, 302, 304, 306, 306, 306, 308, 308, 308, 308, 308, 310, 313, 313, 313, 313, 313, 315, 32, 320, 34, 36–41, 44, 46–48, 50–55, 58, 60–63, 65–70, 74, 74, 74, 77–78, 8, 82, 84, 84, 84, 86, 88, 88, 88–89, 89, 89–90, 90, 90, 93, 97
   pb_decode.c0%0%0%0%100, 1000–1001, 1003–1004, 1007, 1007, 1007, 1009, 1009, 1009, 1011, 1011, 1011–1012, 1012, 1012, 1016, 1016, 1016, 1022, 1022, 1022, 1024, 1024, 1024–1025, 1027, 1030, 1030, 1030, 1032, 1032, 1032, 1034, 1038, 1038, 1038, 104, 104, 104, 1042, 1042, 1042, 1042, 1042, 1045, 1045, 1045, 1047, 1047, 1047, 1049, 105, 105, 105, 1050, 1053, 1053, 1053, 1055, 1059, 1059, 1059, 1061, 1063, 1063, 1063–1064, 1066, 1066, 1066, 1069, 1074, 1074, 1074–1076, 108, 108, 108, 1082, 1082, 1082, 1082, 1082, 1084, 1084, 1084, 1089, 1089, 1089, 109, 109, 109, 1090, 1090, 1090, 1092, 1092, 1092, 1095–1097, 1100, 1103, 1103, 1103–1104, 1104, 1104, 1106–1107, 1110, 1110, 1110–1111, 1115, 1115, 1115–1116, 1116, 1116, 1118, 1118, 1118, 1123, 1125, 1125, 1125, 1129, 1129, 1129–1130, 1133, 1133, 1133, 1135, 1135, 1135–1136, 1136, 1136, 1140, 1140, 1140, 1142–1143, 1143, 1143, 1145, 1145, 1145, 115, 115, 115, 1151, 1154, 1158, 1158, 1158, 116, 1160, 1165, 1165, 1165–1166, 1168, 1170, 1170, 1170–1171, 1179, 118, 1182, 1186, 1193, 120, 125, 127, 127, 127–128, 128, 128, 131, 131, 131–132, 132, 132, 1336, 1341, 1346, 1349, 1349, 1349–1350, 1352–1353, 1356, 1359, 1359, 1359–1360, 1362, 1362, 1362–1363, 1365, 1367, 1370, 1377, 1377, 1377–1378, 138, 1382, 1389, 1393, 140, 1400, 1400, 1400–1401, 1405, 1416, 1420, 1422, 1425, 1427, 1427, 1427, 143, 1430, 1430, 1430–1431, 1434, 1434, 1434–1436, 1436, 1436–1438, 1438, 1438–1440, 1440, 1440–1441, 1443, 1443, 1443, 1445, 1445, 1445–1446, 1446, 1446, 1448, 1456, 1456, 1456, 1458, 1458, 1458–1459, 1463, 1463, 1463–1464, 1472, 1472, 1472–1473, 1475, 1479, 1479, 1479–1481, 1481, 1481–1483, 1483, 1483–1485, 1485, 1485–1486, 1488, 1488, 1488, 1490, 1490, 1490–1491, 1491, 1491, 1493, 1497, 1503, 1503, 1503–1504, 1506, 1506, 1506–1507, 1507, 1507, 1509–1510, 1510, 1510–1511, 1511, 1511, 1513, 1513, 1513, 1516, 1516, 1516, 1528, 1528, 1528–1529, 1529, 1529–1530, 1533–1534, 1537, 1541, 1543, 1543, 1543–1544, 1546, 1546, 1546–1547, 1547, 1547, 1550, 1552, 1552, 1552–1553, 1553, 1553, 1555,

@tanneberger tanneberger merged commit bba5cd0 into main Oct 17, 2024
2 checks passed
@erlingrj erlingrj deleted the macro-magic branch October 25, 2024 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants