spicy icon indicating copy to clipboard operation
spicy copied to clipboard

Optimizer does not track feature requirements for functions args passed as `any`

Open bbannier opened this issue 4 years ago • 1 comments

We currently use the attribute &requires-type-feature on function arguments to notify the optimizer that use of the function introduces a feature requirement on the arg type. The optimizer takes this information into account when deciding whether to remove feature-dependent code.

This does not seem to work correctly when used with any parameters. We currently have e.g., the following declaration https://github.com/zeek/spicy/blob/ba586baeae7296eff9c3a3efc34532b545260b70/spicy/lib/spicy_rt.hlt#L42 The intention of the requirement is that for any concrete parser type passed as an argument to this function the supports_filters feature needs to be active. It however looks like the code performing the bookkeeping does not correctly track the feature, https://github.com/zeek/spicy/blob/ba586baeae7296eff9c3a3efc34532b545260b70/hilti/toolchain/src/compiler/optimizer.cc#L948-L976

That this example with supports_filters works at all at the moment seems to be due to us enabling the feature due to requirements elsewhere.

bbannier avatar Jan 19 '22 11:01 bbannier

Removing 1.4 milestone as it seems to be possible to address #1131 with touching this.

bbannier avatar Feb 22 '22 15:02 bbannier