-
Notifications
You must be signed in to change notification settings - Fork 0
Use mangled name for intrinsic symbols #85
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
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) | ||
} | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Example we are trying.
[ | ||
{ | ||
"IntrinsicSym": "_ZN4core10intrinsics9cold_path17hf51dae334946aea4E" | ||
} | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.