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

Add fuzzing to the CI #246

Merged
merged 11 commits into from
Nov 11, 2022
Merged

Add fuzzing to the CI #246

merged 11 commits into from
Nov 11, 2022

Conversation

MarcelGarus
Copy link
Member

Depends on #245

This makes the exit code of the candy fuzz command match whether errors were found during fuzzing. It also adds fuzzing to the CI and fixes some errors that were discovered.

@MarcelGarus MarcelGarus self-assigned this Oct 19, 2022
@jwbot jwbot added P: Compiler: Frontend Package: The compiler frontend P: Core Package: Candy's standard library labels Oct 19, 2022
@MarcelGarus
Copy link
Member Author

MarcelGarus commented Oct 19, 2022

In the logs, you may have noticed that the functions in Core are fuzzed several times. That's because the tree of modules created from Core/_.candy contains the outer leaf files many times. For example, the core.bool module is imported by many other modules in the core package, causing it to be instantiated and evaluated many times. All the created closures are separate and fuzzed independently.

I guess I'll start working on some basic optimizations such as function inlining, duplicate subtree elimination, and compile-time evaluation soon to fix the problem described above. LLVM would also do those optimizations, but we'd have to turn the entire tree (including expanded uses, thus an exponential amount of code) into LLVM-IR for it to do its magic, so that's too late in the pipeline and it makes sense to do these optimizations in Candy itself.

Copy link
Member

@JonasWanke JonasWanke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust also has a few complaints:

image

packages/Benchmark.candy Outdated Show resolved Hide resolved
packages/Core/int.candy Outdated Show resolved Hide resolved
.github/workflows/compiler.yaml Outdated Show resolved Hide resolved
compiler/src/main.rs Outdated Show resolved Hide resolved
@MarcelGarus
Copy link
Member Author

Fuzzing works fine locally. Seems like this is an issue of nightly cargo: rust-lang/cargo#8557

Copy link
Member

@JonasWanke JonasWanke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether the issue you linked is really related since it's been closed for more than two years, but I couldn't find a good-looking current one. Maybe we should disable the action for now so that we don't get used to the failing CI?

Other than that, the PR looks fine

@MarcelGarus
Copy link
Member Author

Fair enough, I'll just disable the fuzzing for now

@JonasWanke JonasWanke merged commit 5ac4b58 into main Nov 11, 2022
@JonasWanke JonasWanke deleted the add-ci branch November 11, 2022 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted P: Compiler: Frontend Package: The compiler frontend P: Core Package: Candy's standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants