breaking change: remove support for strategy#4188
breaking change: remove support for strategy#4188PureWhiteWu wants to merge 1 commit intobytecodealliance:mainfrom
Conversation
cc8fc8f to
e8f0293
Compare
|
@PureWhiteWu thank you for this report! I agree that the current behavior is somewhat surprising and error-prone. The root issue seems to be that we have settings that silently update other settings as well. IMHO we should strive for the property that the order of calls to methods on @alexcrichton Any thoughts on that invariant? I suspect there may be a way to achieve requirements like "turning on reftypes enables safepoints under the hood" in another way, by having a "fixup phase" when the I feel that a focus on the |
Subscribe to Label Actioncc @peterhuene DetailsThis issue or pull request has been labeled: "wasmtime:api", "wasmtime:c-api", "wasmtime:config", "wasmtime:docs"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
Label Messager: wasmtime:configIt looks like you are changing Wasmtime's configuration options. Make sure to
DetailsTo modify this label's message, edit the To add new label messages or remove existing label messages, edit the |
|
@cfallin Thanks for your quick reply! Here's the log I got. The problematic version: The correct version: And I think there's also other flags and isa_flags that may be affected by this, so it's not only about
In fact, I didn't find a easy way to achieve this, because
Firstly, maybe we could make this another config field instead of |
|
Maybe have Config::with_strategy and remove the strategy method? |
|
To echo Chris thanks for bringing this up @PureWhiteWu! This has actually bit me many times in the past in one way or another so it's definitely something I'd like to see fixed. Additionally sorry for the breakage, it wasn't intended to be so impactful to validate runtime settings but in a sense I also think it's good to turn up bugs like this since this was something that needed fixing anyway. I would agree with everything Chris said as well. The intention of Overall I think that we should probably change all the methods of
I think that would make it so the |
|
@alexcrichton Thanks for your instructions! I'm happy to have a try! I'll close this pr, since this seems isn't the right way to fix the problems. I've opened an issue for this #4189, and will submit a new pr asap. |
TL;DR
This commit removes support for users to set the
strategyfield.I'd propose to do this because:
Misuse
I updated from wasmtime
0.35to0.37these days, and it breaks with thefollowing error:
And here's what my config code looks like:
It works fine in 0.35 but breaks in 0.37, and I found that it's because runtime checks
have been added in #3899. But it is weird that I've already set
cfg.wasm_reference_types(true)which should have set
enable_safepointsto true:And finally I found that it's because
config.strategycreates a newcompiler builderinstead,which invalidates all the compiler flags.
To use this field correctly, users should set the strategy first, and this is not documented.
This in fact caused a lot of configs to not work in the previous release(<0.36) without any errors
and really hard to discover. If I did set
references_typeto false, then I would not discover thiserror together with other not working configs such as simd.
So I think this is easy to misuse / causes problems and hard to discover / debug.
Not Useful
Per RFC 14 there seems only one
Strategyleft(
Cranelift), and I searched through issues and infomation, there's no plan to add new new backendsin the (near) futures.
This config field itself also did nothing useful other than creates the only
Craneliftbackend compiler builder,which is already created as the default value of
Config.Alternatives
Noop
The first is to make
strategyconfig field to a no-op, such as:But I think this field is useless now, and more important is that it is also likely to be useless in the future,
so I prefer to remove it directly.
Panic
The second is to panic if the
compilerfield has been set.But I don't find a clean way to check if the
compilerhas been changed (maybe need to iter / add anotherfield to mark), and same as the above reason, I'd prefer to remove it.
Document
The third is to document that this field must be called at the start of
Config.Besides the above reasons, there's also two cons of this way:
Conclusion
So I think directly remove this config field is the best way to avoid this problem.
And besides the problems it causes, it's also reasonable to remove this since this
is really useless these days and in the foreseeable future.