Conversation
src/printer.rs
Outdated
| } else if let Some(intrinsic_name) = inst.intrinsic_name() { | ||
| IntrinsicSym(intrinsic_name) | ||
| } else if let Some(_intrinsic_name) = inst.intrinsic_name() { | ||
| IntrinsicSym(inst.mangled_name()) |
There was a problem hiding this comment.
Here we are trying to dump the mangled name of the intrinsics instead of just the short name.
| [ | ||
| { | ||
| "IntrinsicSym": "black_box" | ||
| "IntrinsicSym": "_ZN4core10intrinsics9black_box17h422cafb34137ccebE" |
There was a problem hiding this comment.
This is the change that dumping the mangled name makes.
| fn main() { | ||
| checked_add_i32(1,2); | ||
| } | ||
|
|
||
| /// If the precondition is not met, the program is not executed (exits cleanly, ex falso quodlibet) | ||
| macro_rules! precondition { | ||
| ($pre:expr, $block:expr) => { | ||
| if $pre { $block } | ||
| }; | ||
| } | ||
|
|
||
| fn checked_add_i32(a: i32, b: i32) { | ||
|
|
||
| precondition!( | ||
| a.checked_add(b).is_some(), | ||
| unsafe { | ||
| let result = a.unchecked_add(b); | ||
| assert!(result as i64 == a as i64 + b as i64) | ||
| } | ||
| ); | ||
| } |
| [ | ||
| { | ||
| "IntrinsicSym": "_ZN4core10intrinsics9cold_path17hf51dae334946aea4E" | ||
| } | ||
| ], |
There was a problem hiding this comment.
Here we have the symbol name for cold_path dumped.
| "MonoItemFn": { | ||
| "body": { | ||
| "arg_count": 0, | ||
| "blocks": [ | ||
| { | ||
| "statements": [], | ||
| "terminator": { | ||
| "kind": "Return", | ||
| "span": 43 | ||
| } | ||
| } | ||
| ], | ||
| "locals": [ | ||
| { | ||
| "mutability": "Mut", | ||
| "span": 44, | ||
| "ty": 1 | ||
| } | ||
| ], | ||
| "span": 45, | ||
| "spread_arg": null, | ||
| "var_debug_info": [] | ||
| }, | ||
| "id": 3, | ||
| "name": "std::intrinsics::cold_path" | ||
| } | ||
| }, | ||
| "symbol_name": "_ZN4core10intrinsics9cold_path17h" | ||
| }, |
There was a problem hiding this comment.
And here is the implementation we are missing when loading into the KMIR state (even though it's here), because the last 20 characters (some sort of hash) do not match.
In this golden/expected file, this is truncated (missing the last 20 characters), because the output is non-deterministic.
How should we be looking up the needed MonoItemFn to execute this IntrinsicSym? Should it just be comparing the first 30 characters?
e290eca to
e3ecb71
Compare
No description provided.