Stream: cranelift

Topic: More info from verifier errors?


view this post on Zulip McCoy (Jun 04 2022 at 23:53):

I'm trying to write a small JIT for a language that is slightly different than the JIT tutorial. I've gotten a good ways through it, but I'm stuck at this point:

Translated:
function u0:0() system_v {
block0:
    v0 = iconst.i64 5
    v1 = iadd v0, v0
    v2 = imul v1, v0
    return v2
}

Error: Compilation error: Verifier errors

from these lines in my JIT:

        let id = self
            .module
            .declare_function("main", Linkage::Export, &self.ctx.func.signature)
            .map_err(|e| eyre!(e.to_string()))?;
        self.module
            .define_function(id, &mut self.ctx)
            .map_err(|e| eyre!(e.to_string()))?;

So now, I'm done with function building -- and I'm heading towards creating a ptr to the machine code, etc.

Is there any way to figure out what specific part of the IR the verifier is upset by?

view this post on Zulip McCoy (Jun 05 2022 at 00:01):

Edit: I figured out the error here (an issue with my signature) -- but still curious about info from verifier.

view this post on Zulip bjorn3 (Jun 05 2022 at 10:35):

You have to use the cranelift_codegen::pretty_error function for that. It accepts a CodegenError and a Function and then prints something like under the VerifierErrors section at https://github.com/bjorn3/rustc_codegen_cranelift/issues/970 (you need to click on it to expand)

This one looks a bit more complicated. Got entry block parameters (2) must match function signature (1) for tokio-rs/tokio-compat@180076a (master). rustc_codegen_cranelift: 9f602bf VerifierErrors e...

view this post on Zulip McCoy (Jun 06 2022 at 02:41):

Thank you!


Last updated: Nov 22 2024 at 16:03 UTC