Skip to content

Commit c29d4b8

Browse files
committed
Merge branch 'main' into transient-fed
2 parents b8404d6 + 3a4e44f commit c29d4b8

File tree

11 files changed

+71
-91
lines changed

11 files changed

+71
-91
lines changed

.github/workflows/check-diff.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
pull_request:
88
# Also allow running this workflow manually from the Actions tab.
99
workflow_dispatch:
10+
merge_group:
11+
12+
concurrency:
13+
group: ci-${{ github.ref }}-${{ github.event_path }}
14+
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
1015

1116
jobs:
1217
unit-tests-single:
@@ -25,60 +30,57 @@ jobs:
2530
build-trace-tools:
2631
uses: ./.github/workflows/build-trace-tools.yml
2732

28-
check-diff:
29-
uses: ./.github/workflows/check-diff.yml
30-
3133
fetch-lf:
3234
uses: lf-lang/lingua-franca/.github/workflows/extract-ref.yml@master
3335
with:
3436
file: 'lingua-franca-ref.txt'
3537

3638
lf-default-arduino:
37-
needs: [fetch-lf, check-diff]
39+
needs: [fetch-lf]
3840
uses: lf-lang/lingua-franca/.github/workflows/c-arduino-tests.yml@master
3941
with:
4042
runtime-ref: ${{ github.ref }}
4143
compiler-ref: ${{ needs.fetch-lf.outputs.ref }}
42-
if: ${{ needs.check-diff.outputs.run_arduino == 'true' }}
44+
if: ${{ github.event_name == 'merge_group' || github.ref == 'refs/heads/main' || contains( github.event.pull_request.labels.*.name, 'arduino') }}
4345

4446
lf-default-zephyr:
45-
needs: [fetch-lf, check-diff]
47+
needs: [fetch-lf]
4648
uses: lf-lang/lingua-franca/.github/workflows/c-zephyr-tests.yml@master
4749
with:
4850
runtime-ref: ${{ github.ref }}
4951
compiler-ref: ${{ needs.fetch-lf.outputs.ref }}
50-
if: ${{ needs.check-diff.outputs.run_zephyr == 'true' }}
52+
if: ${{ github.event_name == 'merge_group' || github.ref == 'refs/heads/main' ||contains( github.event.pull_request.labels.*.name, 'zephyr') }}
5153

5254
lf-default:
53-
needs: [fetch-lf, check-diff]
55+
needs: [fetch-lf]
5456
uses: lf-lang/lingua-franca/.github/workflows/c-tests.yml@master
5557
with:
5658
runtime-ref: ${{ github.ref }}
5759
compiler-ref: ${{ needs.fetch-lf.outputs.ref }}
58-
all-platforms: ${{ needs.check-diff.outputs.run_macos == 'true' || needs.check-diff.outputs.run_windows == 'true' }}
60+
all-platforms: ${{ github.event_name == 'merge_group' || github.ref == 'refs/heads/main' || contains( github.event.pull_request.labels.*.name, 'mac') || contains( github.event.pull_request.labels.*.name, 'windows') }}
5961

6062
lf-python:
61-
needs: [fetch-lf, check-diff]
63+
needs: [fetch-lf]
6264
uses: lf-lang/lingua-franca/.github/workflows/py-tests.yml@master
6365
with:
6466
reactor-c-ref: ${{ github.ref }}
6567
compiler-ref: ${{ needs.fetch-lf.outputs.ref }}
66-
if: ${{ needs.check-diff.outputs.run_python == 'true' }}
68+
if: ${{ github.event_name == 'merge_group' || github.ref == 'refs/heads/main' ||contains( github.event.pull_request.labels.*.name, 'python') }}
6769

6870
lf-gedf-np:
69-
needs: [fetch-lf, check-diff]
71+
needs: [fetch-lf]
7072
uses: lf-lang/lingua-franca/.github/workflows/c-tests.yml@master
7173
with:
7274
runtime-ref: ${{ github.ref }}
7375
compiler-ref: ${{ needs.fetch-lf.outputs.ref }}
7476
scheduler: GEDF_NP
75-
all-platforms: ${{ needs.check-diff.outputs.run_macos == 'true' || needs.check-diff.outputs.run_windows == 'true' }}
77+
all-platforms: ${{ github.event_name == 'merge_group' || github.ref == 'refs/heads/main' || contains( github.event.pull_request.labels.*.name, 'mac') || contains( github.event.pull_request.labels.*.name, 'windows') }}
7678

7779
lf-adaptive:
78-
needs: [fetch-lf, check-diff]
80+
needs: [fetch-lf]
7981
uses: lf-lang/lingua-franca/.github/workflows/c-tests.yml@master
8082
with:
8183
runtime-ref: ${{ github.ref }}
8284
compiler-ref: ${{ needs.fetch-lf.outputs.ref }}
8385
scheduler: ADAPTIVE
84-
all-platforms: ${{ needs.check-diff.outputs.run_macos == 'true' || needs.check-diff.outputs.run_windows == 'true' }}
86+
all-platforms: ${{ github.event_name == 'merge_group' || github.ref == 'refs/heads/main' || contains( github.event.pull_request.labels.*.name, 'mac') || contains( github.event.pull_request.labels.*.name, 'windows') }}

core/federated/RTI/rti_common.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,10 @@ void notify_advance_grant_if_safe(scheduling_node_t* e);
182182
void notify_provisional_tag_advance_grant(scheduling_node_t* e, tag_t tag);
183183

184184
/**
185-
* Determine whether the specified scheduling node is eligible for a tag advance grant,
186-
* (TAG) and, if so, return the details. This is called upon receiving a LTC, NET
187-
* or resign from an upstream node.
185+
* @brief Determine whether the specified scheduling node is eligible for a tag advance grant,
186+
* (TAG) and, if so, return the details.
187+
*
188+
* This is called upon receiving a LTC, NET or resign from an upstream node.
188189
*
189190
* This function calculates the minimum M over
190191
* all upstream scheduling nodes of the "after" delay plus the most recently

core/federated/federate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2730,8 +2730,8 @@ int lf_send_tagged_message(environment_t* env,
27302730
if (message_type == MSG_TYPE_P2P_TAGGED_MESSAGE) {
27312731
lf_print_warning("Failed to send message to %s. Dropping the message.", next_destination_str);
27322732
} else {
2733-
lf_print_error_system_failure("Failed to send message to %s. Connection lost to the RTI.",
2734-
next_destination_str);
2733+
lf_print_error_system_failure("Failed to send message to %s with error code %d (%s). Connection lost to the RTI.",
2734+
next_destination_str, errno, strerror(errno));
27352735
}
27362736
}
27372737
LF_MUTEX_UNLOCK(&lf_outbound_socket_mutex);

core/reactor_common.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,3 +1325,8 @@ void termination(void) {
13251325
}
13261326
lf_tracing_global_shutdown();
13271327
}
1328+
1329+
index_t lf_combine_deadline_and_level(interval_t deadline, int level) {
1330+
if (deadline > ULLONG_MAX >> 16) return ((ULLONG_MAX >> 16) << 16) | level;
1331+
else return (deadline << 16) | level;
1332+
}

core/tag.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ instant_t lf_time_start(void) {
128128
}
129129

130130
size_t lf_readable_time(char* buffer, instant_t time) {
131+
if (time <= (instant_t)0) {
132+
snprintf(buffer, 2, "0");
133+
return 1;
134+
}
131135
char* original_buffer = buffer;
132136
bool lead = false; // Set to true when first clause has been printed.
133137
if (time > WEEKS(1)) {
@@ -147,8 +151,8 @@ size_t lf_readable_time(char* buffer, instant_t time) {
147151
size_t printed = lf_comma_separated_time(buffer, time / DAYS(1));
148152
time = time % DAYS(1);
149153
buffer += printed;
150-
snprintf(buffer, 6, " days");
151-
buffer += 5;
154+
snprintf(buffer, 3, " d");
155+
buffer += 2;
152156
}
153157
if (time > HOURS(1)) {
154158
if (lead == true) {
@@ -159,8 +163,8 @@ size_t lf_readable_time(char* buffer, instant_t time) {
159163
size_t printed = lf_comma_separated_time(buffer, time / HOURS(1));
160164
time = time % HOURS(1);
161165
buffer += printed;
162-
snprintf(buffer, 7, " hours");
163-
buffer += 6;
166+
snprintf(buffer, 3, " h");
167+
buffer += 2;
164168
}
165169
if (time > MINUTES(1)) {
166170
if (lead == true) {
@@ -171,8 +175,8 @@ size_t lf_readable_time(char* buffer, instant_t time) {
171175
size_t printed = lf_comma_separated_time(buffer, time / MINUTES(1));
172176
time = time % MINUTES(1);
173177
buffer += printed;
174-
snprintf(buffer, 9, " minutes");
175-
buffer += 8;
178+
snprintf(buffer, 5, " min");
179+
buffer += 4;
176180
}
177181
if (time > SECONDS(1)) {
178182
if (lead == true) {
@@ -183,28 +187,26 @@ size_t lf_readable_time(char* buffer, instant_t time) {
183187
size_t printed = lf_comma_separated_time(buffer, time / SECONDS(1));
184188
time = time % SECONDS(1);
185189
buffer += printed;
186-
snprintf(buffer, 9, " seconds");
187-
buffer += 8;
190+
snprintf(buffer, 3, " s");
191+
buffer += 2;
188192
}
189193
if (time > (instant_t)0) {
190194
if (lead == true) {
191195
snprintf(buffer, 3, ", ");
192196
buffer += 2;
193197
}
194-
const char* units = "nanoseconds";
198+
const char* units = "ns";
195199
if (time % MSEC(1) == (instant_t) 0) {
196-
units = "milliseconds";
200+
units = "ms";
197201
time = time / MSEC(1);
198202
} else if (time % USEC(1) == (instant_t) 0) {
199-
units = "microseconds";
203+
units = "us";
200204
time = time / USEC(1);
201205
}
202206
size_t printed = lf_comma_separated_time(buffer, time);
203207
buffer += printed;
204-
snprintf(buffer, 14, " %s", units);
208+
snprintf(buffer, 3, " %s", units);
205209
buffer += strlen(units) + 1;
206-
} else {
207-
snprintf(buffer, 2, "0");
208210
}
209211
return (buffer - original_buffer);
210212
}

core/threaded/reactor_threaded.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,8 @@ void _lf_initialize_start_tag(environment_t *env) {
632632
LF_PRINT_LOG("Waiting for start time " PRINTF_TIME " plus STA " PRINTF_TIME ".",
633633
start_time, lf_fed_STA_offset);
634634
#else
635+
// For other than federated decentralized execution, there is no lf_fed_STA_offset variable defined.
636+
// To use uniform code below, we define it here as a local variable.
635637
instant_t lf_fed_STA_offset = 0;
636638
LF_PRINT_LOG("Waiting for start time " PRINTF_TIME ".",
637639
start_time);

include/core/reactor_common.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ extern struct allocation_record_t* _lf_reactors_to_free;
6565

6666
////////////////////// Functions //////////////////////
6767

68+
/**
69+
* @brief Combine a deadline and a level into a single index for sorting in the reaction queue.
70+
*
71+
* This shifts the deadline right by 16 bits and inserts the level in the low-order 16 bits.
72+
* If the deadline is larger than `ULLONG_MAX >> 16`, then it is treated as the largest possible deadline.
73+
* @oaran deadline THe deadline.
74+
* @param level The level in the reaction graph.
75+
*/
76+
index_t lf_combine_deadline_and_level(interval_t deadline, int level);
77+
6878
/**
6979
* @brief Create and initialize the required number of environments for the program.
7080
* @note This function will be code generated by the compiler.

logging/api/logging_macros.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,22 @@
7878
#define LF_ASSERT(condition, format, ...) \
7979
do { \
8080
if (!(condition)) { \
81-
lf_print_error_and_exit(format, ##__VA_ARGS__); \
81+
lf_print_error_and_exit("`" format "`. Failed assertion in %s:%d(%s):(" #condition \
82+
") != true`", ##__VA_ARGS__, __FILE__, __LINE__, __func__); \
8283
} \
8384
} while(0)
8485
#define LF_ASSERTN(condition, format, ...) \
8586
do { \
8687
if (condition) { \
87-
lf_print_error_and_exit(format, ##__VA_ARGS__); \
88+
lf_print_error_and_exit("`" format "`. Failed assertion in %s:%d(%s):(" #condition \
89+
") != false`", ##__VA_ARGS__, __FILE__, __LINE__, __func__); \
8890
} \
8991
} while(0)
9092
#define LF_ASSERT_NON_NULL(pointer) \
9193
do { \
9294
if (!(pointer)) { \
93-
lf_print_error_and_exit("Assertion failed: pointer is NULL Out of memory?."); \
95+
lf_print_error_and_exit("`Out of memory?` Assertion failed in %s:%d(%s):`" #pointer " == NULL`",\
96+
__FILE__, __LINE__, __func__); \
9497
} \
9598
} while(0)
9699
#endif // NDEBUG

tag/api/tag.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,21 +199,22 @@ instant_t lf_time_start(void);
199199
* Maximum number of nanoseconds is 999,999,999
200200
* Maximum number of microsteps is 4,294,967,295
201201
* Total number of characters for the above is 24.
202-
* Text descriptions and spaces add an additional 55,
203-
* for a total of 79. One more allows for a null terminator.
202+
* Text descriptions and spaces add an additional 30,
203+
* for a total of 54. One more allows for a null terminator.
204+
* Round up to a power of two.
204205
*/
205-
#define LF_TIME_BUFFER_LENGTH 80
206+
#define LF_TIME_BUFFER_LENGTH 64
206207

207208
/**
208209
* Store into the specified buffer a string giving a human-readable
209210
* rendition of the specified time. The buffer must have length at least
210211
* equal to LF_TIME_BUFFER_LENGTH. The format is:
211212
* ```
212-
* x weeks, x days, x hours, x minutes, x seconds, x unit
213+
* x weeks, x d, x hr, x min, x s, x unit
213214
* ```
214215
* where each `x` is a string of numbers with commas inserted if needed
215-
* every three numbers and `unit` is nanoseconds, microseconds, or
216-
* milliseconds.
216+
* every three numbers and `unit` is ns, us, or
217+
* ms.
217218
* @param buffer The buffer into which to write the string.
218219
* @param time The time to write.
219220
* @return The number of characters written (not counting the null terminator).

0 commit comments

Comments
 (0)