[zeek/spicy] 4fa4ef: Run all optimizations until convergence.

0 views
Skip to first unread message

Evan Typanski

unread,
Aug 28, 2025, 4:08:29 PM (12 days ago) Aug 28
to spicy-...@zeek.org
Branch: refs/heads/topic/etyp/not-null-coercions-fix
Home: https://github.com/zeek/spicy
Commit: 4fa4ef4226ad3c682306788cb7baf93c9179df84
https://github.com/zeek/spicy/commit/4fa4ef4226ad3c682306788cb7baf93c9179df84
Author: Evan Typanski <evan.t...@corelight.com>
Date: 2025-08-28 (Thu, 28 Aug 2025)

Changed paths:
M hilti/toolchain/include/compiler/detail/optimizer.h
M hilti/toolchain/src/ast/ast-context.cc
M hilti/toolchain/src/compiler/optimizer.cc
M tests/Baseline/hilti.ast.basic-module/debug.log
M tests/Baseline/hilti.ast.imported-id/output
M tests/Baseline/hilti.ast.types/output
M tests/Baseline/hilti.expressions.ctor-replacement/output

Log Message:
-----------
Run all optimizations until convergence.

This is the first step to get the optimizer to play nicely with
coercion. We run resolution/coercion after optimization, but if we want
tho optimizer to play nice with newly-coerced results, we have to run
the optimizer after the coercion as well. This way, changes in coercion
from constant propagation can make other optimizations run.


Commit: 901f67cef96ebabb23a278cfa643d3760b3a5196
https://github.com/zeek/spicy/commit/901f67cef96ebabb23a278cfa643d3760b3a5196
Author: Evan Typanski <evan.t...@corelight.com>
Date: 2025-08-28 (Thu, 28 Aug 2025)

Changed paths:
M hilti/toolchain/include/ast/expressions/coerced.h
M hilti/toolchain/src/ast/visitor.cc
M hilti/toolchain/src/compiler/resolver.cc

Log Message:
-----------
Mark coercions with replaced children invalid.

This introduces a new mechanism to mark a coercion "invalid" if its
coerced child was replaced. This way, the coercer can go back and
recoerce the expression if it chooses to.


Commit: fc685d3a91ee2729c11d636fa27310208f292c0a
https://github.com/zeek/spicy/commit/fc685d3a91ee2729c11d636fa27310208f292c0a
Author: Evan Typanski <evan.t...@corelight.com>
Date: 2025-08-28 (Thu, 28 Aug 2025)

Changed paths:
M hilti/toolchain/src/ast/ast-context.cc
M tests/Baseline/hilti.ast.basic-module/debug.log
M tests/Baseline/hilti.ast.imported-id/output
M tests/Baseline/hilti.ast.types/output
M tests/Baseline/hilti.types.regexp.ctor/output

Log Message:
-----------
Validate after optimizing/resolving.

This isn't necessary for anything, but it seems reasonable to validate
that optimizations didn't mess stuff up now that we're doing more.


Commit: f9a8f7fd22f145f406d1db820f15505e05eaa1c0
https://github.com/zeek/spicy/commit/f9a8f7fd22f145f406d1db820f15505e05eaa1c0
Author: Evan Typanski <evan.t...@corelight.com>
Date: 2025-08-28 (Thu, 28 Aug 2025)

Changed paths:
M hilti/toolchain/src/compiler/coercer.cc
M hilti/toolchain/src/compiler/optimizer.cc
M tests/Baseline/spicy.optimization.default-parser-functions/log
M tests/Baseline/spicy.optimization.default-parser-functions/opt.hlt
M tests/Baseline/spicy.optimization.feature_requirements/log
M tests/Baseline/spicy.optimization.feature_requirements/opt.hlt
M tests/Baseline/spicy.optimization.unused-functions/log
M tests/Baseline/spicy.optimization.unused-functions/opt.hlt
M tests/Baseline/spicy.optimization.unused-types/log
M tests/Baseline/spicy.optimization.unused-types/opt.hlt
M tests/Baseline/spicy.rt.debug-trace/.stderr
M tests/Baseline/spicy.types.unit.canonical-ids-with-import/output
M tests/Baseline/spicy.types.unit.canonical-ids/output

Log Message:
-----------
Coerce `Null` to false and optimize it.

Fixes #2150

This does 2 things:

1) Makes Null (and null-like-things, like a strong ref ctor) coerce to
False when coercing to a boolean.
2) Allows the optimizer to work with boolean coercions.

In turn, this lets the optimizer get rid of `if (!Null)` checks that got
constant propagated from a previous optimizer run.


Compare: https://github.com/zeek/spicy/compare/4aed9e279b5b...f9a8f7fd22f1

To unsubscribe from these emails, change your notification settings at https://github.com/zeek/spicy/settings/notifications
Reply all
Reply to author
Forward
0 new messages