diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-01-29 14:46:30 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-29 14:46:30 +0100 |
| commit | 9e86a434a770b453ded7dabd3203efc9c61eb2e5 (patch) | |
| tree | 9debcae2fcad4bc105599636e6c65d1b3a5173d5 /compiler/rustc_codegen_ssa | |
| parent | 11898a56c202076a3506928a11fcf402f6e1af3a (diff) | |
| parent | 9728cc4e26c936e17a107ceeccf029bde4e7e1f0 (diff) | |
| download | rust-9e86a434a770b453ded7dabd3203efc9c61eb2e5.tar.gz rust-9e86a434a770b453ded7dabd3203efc9c61eb2e5.zip | |
Rollup merge of #92274 - woppopo:const_deallocate, r=oli-obk
Add `intrinsics::const_deallocate` Tracking issue: #79597 Related: #91884 This allows deallocation of a memory allocated by `intrinsics::const_allocate`. At the moment, this can be only used to reduce memory usage, but in the future this may be useful to detect memory leaks (If an allocated memory remains after evaluation, raise an error...?).
Diffstat (limited to 'compiler/rustc_codegen_ssa')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/intrinsic.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs index 3657f80c2de..c654232c10a 100644 --- a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs +++ b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs @@ -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_") => { |
