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

Test disable verification in cranelift backend #186

Closed
wants to merge 1 commit into from

Conversation

webmaster128
Copy link
Member

@webmaster128 webmaster128 commented Mar 25, 2020

Test the (unreleased) patch wasmerio/wasmer#1332 for #155

Based on #184

@webmaster128 webmaster128 force-pushed the test-disable-ir_verification branch from d364031 to a96c287 Compare March 25, 2020 11:01
Copy link
Member

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

Nice demo


use crate::errors::{CompileErr, Error};
use snafu::ResultExt;

static FAKE_GAS_AVAILABLE: u64 = 1_000_000;

pub fn compile(code: &[u8]) -> Result<Module, Error> {
compile_with(code, compiler().as_ref()).context(CompileErr {})
let config = CompilerConfig {
enable_verification: false, // As discussed in https://github.com/CosmWasm/cosmwasm/issues/155
Copy link
Member

Choose a reason for hiding this comment

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

I know this is draft, but it would be interesting to flag this based on test or release, so it is false when we compile for tests and true when we compile for release.

You can do this via

#[cfg(debug_assertions)]
enable_verification: false,
..Default::default(),

reference

Copy link
Member Author

@webmaster128 webmaster128 Mar 26, 2020

Choose a reason for hiding this comment

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

I don't know that this cranelift IR (intermediate representation) verifier does, but I think it should not run un release builds.

From bytecodealliance/cranelift#1247:

Run the Cranelift IR verifier at strategic times during compilation.

This makes compilation slower but catches many bugs. [...]

Before wasmerio/wasmer#1218, wasmer disabled it for us in all cases and only enabled it when running Wasmer tests.

I think as long as we don't have a good reason, we should disable it.

@webmaster128 webmaster128 deleted the test-disable-ir_verification branch July 8, 2020 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants