Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
bb34751
Merge pull request #2 from fastly/ccole/merge-upstream
Mar 14, 2019
f69e455
Merge pull request #3 from fastly/ccole/merge-upstream
May 20, 2019
2f3c2fb
Merge pull request #4 from fastly/ccole/merge-upstream
May 22, 2019
6f8a180
Merge remote-tracking branch 'upstream/main' into kate/update-for-vmc
katef Jul 10, 2020
398d7ea
Merge pull request #5 from fastly/kate/update-for-vmc
katef Jul 10, 2020
2422342
ast.h: Add `extern` for `ast_expr_tombstone`.
silentbicycle Aug 28, 2020
6599ed1
Merge pull request #7 from fastly/sv/add-extern-to-ast_expr_tombstone…
katef Aug 28, 2020
b1c283b
Merge pull request #8 from fastly/kate/update-for-ast-rewriting
katef Oct 19, 2020
a99f92d
Merge github.com/katef/libfsm changes
fgsch Jan 20, 2022
20c65ff
Merge pull request #9 from fastly/fgsch/sync
fgsch Jan 25, 2022
18e1082
Merge branch 'main' into sv/sync-fastly-main-with-upstream
silentbicycle Feb 16, 2023
03da127
Merge pull request #11 from fastly/sv/sync-fastly-main-with-upstream
silentbicycle Feb 28, 2023
0e6b5f9
Merge branch 'main' into sv/sync-fastly-private-mirror-to-upstream
silentbicycle Apr 3, 2023
78eef00
Merge pull request #14 from fastly/sv/sync-fastly-private-mirror-to-u…
silentbicycle Apr 3, 2023
33b3531
Merge branch 'main' into sv/update-fastly-libfsm-for-memory-usage-fix
silentbicycle Apr 4, 2023
f32b238
Merge pull request #15 from fastly/sv/update-fastly-libfsm-for-memory…
katef Apr 4, 2023
1522788
Merge pull request #16 from fastly/kate/update-for-re-literal-header
katef Apr 6, 2023
da06445
Merge pull request #18 from fastly/kate/update-for-memcmp
katef May 24, 2023
a38b685
Merge pull request #19 from fastly/kate/update-for-bugfixin
katef Jun 2, 2023
55fc8f9
Merge pull request #20 from fastly/kate/update-for-strncmp
katef Jun 5, 2023
07e33d1
Merge pull request #21 from fastly/kate/update-for-trigraphs
katef Jun 6, 2023
7324337
Merge pull request #22 from fastly/kate/update-for-never-backslash-c
katef Jun 9, 2023
11d725e
Merge pull request #23 from katef/main
silentbicycle Sep 12, 2023
791f37a
Merge pull request #24 from katef/main
silentbicycle Oct 30, 2023
80b80a6
Merge pull request #25 from katef/main
silentbicycle May 8, 2024
3e3950b
Merge pull request #26 from katef/main
katef May 9, 2024
8b53634
Merge pull request #27 from fastly/sv/upstream-main
katef Oct 9, 2024
796c6ab
gen: No end states means nothing to do. (todo: cherry pick)
silentbicycle Aug 30, 2024
4a32885
experimental: Add eager outputs, similar to endids but eagerly matched.
silentbicycle Aug 27, 2024
9fcbdf5
Ensure .has_eager_outputs is zeroed on new states. (msan)
silentbicycle Oct 10, 2024
1baee53
eager_output interface cleanup: Replace _any with _count and _get.
silentbicycle Oct 10, 2024
8fd728e
minimise_test_oracle.c: mismatched eager outputs also prevent merging.
silentbicycle Oct 10, 2024
98e9cb4
Experimental initial support for CDATA output mode.
silentbicycle Sep 27, 2024
23e6142
fuzzer: Add seed argument for fsm_generate_matches (interface change).
silentbicycle Oct 10, 2024
4ea2588
Add `srand(seed)` to fuzzer harness.
silentbicycle Oct 12, 2024
25a9141
cdata: Remove assertions on realloc's result.
silentbicycle Oct 12, 2024
3ea0898
Add CDATA to rx.
silentbicycle Oct 12, 2024
4b61192
cdata: Avoid "zero size arrays are an extension" warning.
silentbicycle Oct 12, 2024
1d5c0a0
cdata: Fix output type for single endid in AMBIG_EARLIEST.
silentbicycle Oct 12, 2024
32121f3
cdata: Fix rollover on (255,255).
silentbicycle Oct 12, 2024
592b613
Merge pull request #31 from fastly/sv/upstream-sync-re-is-anchored
silentbicycle Oct 12, 2024
a779057
Merge branch 'f/main' into sv/eager-outputs
silentbicycle Oct 12, 2024
4544091
cdata: Treat '\' as non-printable, since it leads to line continuation.
silentbicycle Oct 12, 2024
bbcac92
fuzz/target.c: re_is_anchor interface changes.
silentbicycle Oct 12, 2024
e133a74
fuzz/target: fsm_generate_matches has randomized flag.
silentbicycle Oct 12, 2024
5f08778
cdata: Ensure config->state_info is zeroed.
silentbicycle Oct 12, 2024
7a935b4
Add cdata to retest. (This found a couple issues.)
silentbicycle Oct 12, 2024
c7b9e1d
Merge pull request #29 from fastly/sv/eager-outputs
silentbicycle Oct 12, 2024
f0e58bc
Merge branch 'f/main' into sv/add-cdata-codegen-with-eager-outputs
silentbicycle Oct 12, 2024
9f90b01
print: Add allocator handle to ir_print_f typedef.
silentbicycle Oct 13, 2024
4fe0beb
cdata: Use passed-in alloc handle and its interface.
silentbicycle Oct 13, 2024
6e9b7f1
Fix strange comparison on a bool.
silentbicycle Oct 13, 2024
7cb37be
Merge pull request #30 from fastly/sv/add-cdata-codegen-with-eager-ou…
silentbicycle Oct 13, 2024
f2ac082
tmp: Add EXPENSIVE_CHECKS wrapper around fsm_exec's is_isdfa check.
silentbicycle Oct 14, 2024
03033cc
cdata: Address warning, ensure closing `}` is always output.
silentbicycle Oct 14, 2024
adf2f2c
Merge pull request #32 from fastly/sv/add-cdata-codegen-with-eager-ou…
silentbicycle Oct 14, 2024
ed2e4d0
cdata: Move .end and (optional) .endid_offset into a separata array.
silentbicycle Oct 29, 2024
32eeaf4
cdata: Intern individual words from 256-bitsets.
silentbicycle Oct 29, 2024
af0ae65
Fix memory leak.
silentbicycle Nov 7, 2024
c5342a8
cdata: Buffer eager_outputs until match, rather than setting imediately.
silentbicycle Dec 9, 2024
8cd564b
Fix a bug in the CDATA interpreter's bitset checking.
silentbicycle Jan 17, 2025
6aa1962
update CI to lock to ubuntu 22.04 for clang 14.0.0
deg4uss3r Feb 7, 2025
924cb38
keep matrix.os so we can easily add more os variations in the future
deg4uss3r Feb 7, 2025
c111e3f
Merge pull request #35 from fastly/rth/update-ci-to-lock-to-ubuntu22.04
deg4uss3r Feb 11, 2025
a99b913
cdata: Instead of asserting, the print interface returns -1 on error.
silentbicycle Jun 16, 2025
0509696
cdata: Bubble up other allocation errors.
silentbicycle Jun 16, 2025
c783ce8
Rename test to _single, add _multiple variant.
silentbicycle Jan 31, 2025
0b601de
Fix memory leak in fsm_eager_output_compact, found while fuzzing.
silentbicycle Jan 31, 2025
efaa884
Fix fsm_union_repeated_pattern_group's anchoring linkage.
silentbicycle Feb 4, 2025
24817d3
fsm_union_repeated_pattern_group: Interface changes.
silentbicycle Feb 4, 2025
971bac6
fsm_union_repeated_pattern_group: fix linkage for mixed start anchoring.
silentbicycle Feb 5, 2025
d4e2d2c
Add tests, fix anchoring bugs in fsm_union_repeated_pattern_group.
silentbicycle Feb 12, 2025
b7fd1bc
Interface change: Add 'const'.
silentbicycle Feb 12, 2025
b79100a
update CI to lock to ubuntu 22.04 for clang 14.0.0
deg4uss3r Feb 7, 2025
9040973
keep matrix.os so we can easily add more os variations in the future
deg4uss3r Feb 7, 2025
64ba903
fuzz/target.c: fsm_union_repeated_pattern_group interface changes.
silentbicycle Feb 12, 2025
e80d3c5
union: Fix trivial memory leak.
silentbicycle Feb 12, 2025
e91d25b
union.c: Add comments for assertions.
silentbicycle Feb 12, 2025
7a434af
Switch to collecting an anchored_start state set, not just one state.
silentbicycle Feb 14, 2025
a72fc08
retest: extra error checking for retest's fileno, isatty
silentbicycle Jun 17, 2025
f565b93
cdata: change return types to void, since these functions can't fail.
silentbicycle Jun 17, 2025
8f1838b
cdata: Error check.
silentbicycle Jun 17, 2025
aa17202
Merge pull request #34 from fastly/sv/fix-anchoring-for-fsm_union_rep…
silentbicycle Jun 17, 2025
285f444
cdata: Fix NULL check. This looks like a merge error.
silentbicycle Jun 17, 2025
6078cdf
github workflows: ensure ${env.wc} exists.
silentbicycle Jun 18, 2025
b7a3ffc
Merge branch 'main' into sv/cdata-codegen-updates-part-3
silentbicycle Jun 18, 2025
43c851e
cdata: Add a few comments about internal structs.
silentbicycle Jun 18, 2025
3827dc5
Revert "github workflows: ensure ${env.wc} exists."
silentbicycle Jun 20, 2025
b8e2e9f
Merge pull request #33 from fastly/sv/cdata-codegen-updates-part-3
silentbicycle Jun 20, 2025
26f90c4
Stray const.
katef Aug 28, 2025
02c508d
Merge pull request #36 from fastly/kate/stray-const
katef Sep 4, 2025
051be1a
Merge branch 'main' into upstream-sync
silentbicycle Feb 9, 2026
5c0ed62
Merge remote-tracking branch 'origin/main' into sv/upstream-sync-eage…
silentbicycle Feb 9, 2026
00ffc70
Merge pull request #37 from fastly/sv/upstream-sync-eager-output
katef Feb 9, 2026
0695dfe
Merge branch 'katef:main' into main
katef Feb 10, 2026
d3658a1
Merge remote-tracking branch 'upstream/main' into kate/update-for-int…
katef Jul 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions include/fsm/fsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,15 @@ fsm_shortest(const struct fsm *fsm,
fsm_state_t start, fsm_state_t goal,
unsigned (*cost)(fsm_state_t from, fsm_state_t to, char c));

/* HACK */
typedef void
fsm_eager_endid_cb(fsm_end_id_t id, void *opaque);
void
fsm_eager_endid_set_cb(struct fsm *fsm, fsm_eager_endid_cb *cb, void *opaque);

void
fsm_eager_endid_get_cb(const struct fsm *fsm, fsm_eager_endid_cb **cb, void **opaque);

/*
* Execute an FSM reading input from the user-specified callback fsm_getc().
* fsm_getc() is passed the opaque pointer given, and is expected to return
Expand Down
2 changes: 2 additions & 0 deletions include/fsm/print.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ enum fsm_print_lang {
FSM_PRINT_VMC, /* ISO C90 code, VM style */
FSM_PRINT_VMDOT, /* Graphviz Dot format, showing VM opcodes */

FSM_PRINT_CDATA, /* C data tables and small interpreter */

FSM_PRINT_VMOPS_C, /* VM opcodes as a datastructure */
FSM_PRINT_VMOPS_H,
FSM_PRINT_VMOPS_MAIN
Expand Down
2 changes: 2 additions & 0 deletions src/libfsm/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ fsm_exec(const struct fsm *fsm,

/* TODO: pass struct of callbacks to call during each event; transitions etc */

#if EXPENSIVE_CHECKS
if (!fsm_all(fsm, fsm_isdfa)) {
errno = EINVAL;
return -1;
}
#endif

if (!fsm_getstart(fsm, &state)) {
errno = EINVAL;
Expand Down
4 changes: 3 additions & 1 deletion src/libfsm/print.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ fsm_print(FILE *f, const struct fsm *fsm,
case FSM_PRINT_VMC: print_vm = fsm_print_vmc; break;
case FSM_PRINT_VMDOT: print_vm = fsm_print_vmdot; break;

case FSM_PRINT_CDATA: print_ir = fsm_print_cdata; break;

case FSM_PRINT_VMOPS_C: print_vm = fsm_print_vmops_c; break;
case FSM_PRINT_VMOPS_H: print_vm = fsm_print_vmops_h; break;
case FSM_PRINT_VMOPS_MAIN: print_vm = fsm_print_vmops_main; break;
Expand Down Expand Up @@ -364,7 +366,7 @@ fsm_print(FILE *f, const struct fsm *fsm,
}

if (print_ir != NULL) {
r = print_ir(f, opt, hooks, ir);
r = print_ir(f, fsm->alloc, opt, hooks, ir);
goto done;
}

Expand Down
2 changes: 2 additions & 0 deletions src/libfsm/print.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ typedef int fsm_print_f(FILE *f,
const struct fsm *fsm);

typedef int ir_print_f(FILE *f,
const struct fsm_alloc *alloc,
const struct fsm_options *opt,
const struct fsm_hooks *hooks,
const struct ir *ir);
Expand Down Expand Up @@ -89,6 +90,7 @@ vm_print_f fsm_print_llvm;
vm_print_f fsm_print_rust;
vm_print_f fsm_print_sh;
vm_print_f fsm_print_vmc;
ir_print_f fsm_print_cdata;

vm_print_f fsm_print_vmdot;
vm_print_f fsm_print_vmops_c;
Expand Down
1 change: 1 addition & 0 deletions src/libfsm/print/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ SRC += src/libfsm/print/irdot.c
SRC += src/libfsm/print/irjson.c
SRC += src/libfsm/print/json.c
SRC += src/libfsm/print/llvm.c
SRC += src/libfsm/print/cdata.c
SRC += src/libfsm/print/rust.c
SRC += src/libfsm/print/sh.c
SRC += src/libfsm/print/vmasm.c
Expand Down
2 changes: 2 additions & 0 deletions src/libfsm/print/c.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,13 @@ fsm_print_c_body(FILE *f, const struct ir *ir,

int
fsm_print_c(FILE *f,
const struct fsm_alloc *alloc,
const struct fsm_options *opt,
const struct fsm_hooks *hooks,
const struct ir *ir)
{
const char *prefix;
(void)alloc;

assert(f != NULL);
assert(opt != NULL);
Expand Down
Loading
Loading