1
Fork 0

const_deallocate: Don't deallocate memory allocated in an another const. Does nothing at runtime.

`const_allocate`:  Returns a null pointer at runtime.
This commit is contained in:
woppopo 2022-01-26 13:06:09 +09:00
parent aa6795e2d4
commit 29932db09b
8 changed files with 69 additions and 11 deletions

View file

@ -369,6 +369,16 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
}
}
sym::const_allocate => {
// returns a null pointer at runtime.
bx.const_null(bx.type_i8p())
}
sym::const_deallocate => {
// nop at runtime.
return;
}
// This requires that atomic intrinsics follow a specific naming pattern:
// "atomic_<operation>[_<ordering>]", and no ordering means SeqCst
name if name_str.starts_with("atomic_") => {