about summary refs log tree commit diff
path: root/src/librustc_mir/interpret/memory.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-1028/+0
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-1/+1
2020-08-16miri engine: add option to use force_int for alignment checkRalf Jung-10/+13
2020-08-12Rollup merge of #75394 - oli-obk:get_static, r=RalfJungYuki Okushi-16/+4
Add a function to `TyCtxt` for computing an `Allocation` for a `static` item's initializer r? @RalfJung miri-side: https://github.com/rust-lang/miri/issues/1507 split out of https://github.com/rust-lang/rust/pull/74949#discussion_r468100991 to make that PR leaner
2020-08-11Add a function to `TyCtxt` for computing an `Allocation` for a `static` ↵Oliver Scherer-16/+4
item's initializer
2020-08-08Miri: Renamed "undef" to "uninit"Philippe Nadon-3/+3
Renamed remaining references to "undef" to "uninit" when referring to Miri. Impacted directories are: - src/librustc_codegen_llvm/consts.rs - src/librustc_middle/mir/interpret/ - src/librustc_middle/ty/print/pretty.rs - src/librustc_mir/ - src/tools/clippy/clippy_lints/src/consts.rs Upon building Miri based on the new changes it was verified that no changes needed to be made with the Miri project. Related issue #71193
2020-08-04Correct a typo in interpret/memory.rsFelix Yan-1/+1
2020-07-28Replace write-to-vec hack by introducing a display renderer for allocationsOliver Scherer-7/+1
2020-07-28Replace all uses of `log::log_enabled` with `Debug` printersOliver Scherer-61/+91
2020-07-27Auto merge of #74775 - RalfJung:miri-alloc-ids, r=oli-obkbors-35/+51
Miri: replace canonical_alloc_id mechanism by extern_static_alloc_id We only have to call `extern_static_alloc_id` when a `Pointer` is "imported" from the `tcx` to the machine, not on each access. Also drop the old hook for TLS handling, it is not needed any more. The Miri side of this is at https://github.com/rust-lang/miri/pull/1489. Fixes https://github.com/rust-lang/rust/issues/71194 r? @oli-obk
2020-07-26typos + fmtRalf Jung-9/+9
2020-07-26move getting the initial value of a static into helper functionRalf Jung-11/+18
2020-07-26Miri: replace canonical_alloc_id mechanism by extern_static_alloc_id which ↵Ralf Jung-25/+34
is called only when a pointer is 'imported' into the machine
2020-07-26Auto merge of #74664 - pnadon:Miri-rename-undef-uninit, r=RalfJungbors-9/+9
Miri rename undef uninit Renamed parts of code within the `librustc_middle/mir/interpret/` directory. Related issue [#71193](https://github.com/rust-lang/rust/issues/71193)
2020-07-25Miri: rename "undef" to "uninit"Philippe Nadon-9/+9
renamed Allocation::check_defined_and_ptr to Allocation::check_init_and_ptr renamed Allocation::check_defined_and_ptr to Allocation::check_init_and_ptr in src/librustc_middle/mir/interpret/allocation.rs renamed Allocation::is_defined and Allocation::check_defined, fixed documentation renamed Allocation::is_defined and Allocation::check_defined to is_init and check_init respectively. Fixed documentation so it correctly refers to "initialization" instead of "defined"-ness renamed Allocation::mark_definedness renamed Allocation::mark_definedness to Allocation::mark_init Renamed new_state parameter in Allocation::mark_init Renamed new_state to is_init, as the latter is more descriptive. renamed functions in AllocationDefinedness renamed AllocationDefinedness::all_bytes_undef and AllocationDefinedness::mark_compressed_undef_range to no_bytes_init and mark_compressed_init_range respectively. renamed AllocationDefinedness to InitMaskCompressed renamed Immediate::to_scalar_or_undef renamed to to_scalar_or_uninit fixed comment references to "undef" Changed comments referring to "undef" and "definedness" to "initialization" and "initialization state" in src/librustc_mir/interpret/memory.rs and src/librustc_middle/mir/interpret/allocation.rs changed references to "undef" in comments and a variable Changed some comments referring to "undef" to use "uninitialized" instead. Also changed a variable from "undef_end" to "uninit_end". All changes were made within src/librustc_middle/mir/interpret/allocation.rs. Changed more comments referring to undef Changed comments to use "uninitialized" instead of "undef" in src/librustc_middle/mir/interpret/allocation.rs.
2020-07-23on Windows, use miri_static_root for TLS dtorsRalf Jung-1/+4
2020-06-12make miri InterpCx TyCtxtAt a TyCtxt, and separately remember the root span ↵Ralf Jung-1/+1
of the evaluation
2020-06-12make miri memory TyCtxtAt a TyCtxtRalf Jung-10/+10
2020-05-30Make TLS accesses explicit in MIROliver Scherer-0/+2
2020-05-08Create a convenience wrapper for `get_global_alloc(id).unwrap()`Oliver Scherer-1/+1
2020-05-08Move `unwrap_fn` and `unwrap_memory` to `GlobalAlloc`Oliver Scherer-1/+1
2020-05-08Simplify the `tcx.alloc_map` APIOliver Scherer-11/+9
2020-05-01Move recursion check for zsts back to read site instead of access check site.Oliver Scherer-12/+1
2020-05-01rename InvalidIntPtrUsageRalf Jung-1/+1
2020-04-30Rollup merge of #71590 - RalfJung:mir-dump-pointers, r=oli-obkTyler Mandry-1/+1
MIR dump: print pointers consistently with Miri output This makes MIR allocation dump pointer printing consistent with Miri output: both use hexadecimal offsets with a `0x` prefix. To save some space, MIR dump replaces the `alloc` prefix by `a` when necessary. I also made AllocId/Pointer printing more consistent in their Debug/Display handling, and adjusted Display printing for Scalar a bit to avoid using decimal printing when we do not know the sign with which to interpret the value (IMO using decimal then is misleading).
2020-04-29expand comment in memory.rs with extra soundness concernsRalf Jung-1/+3
2020-04-26sync alloc dump and pointer printingRalf Jung-1/+1
2020-04-26Rollup merge of #71140 - oli-obk:static_cycle, r=RalfJungDylan DPC-1/+12
[breaking change] Disallow statics initializing themselves fixes #71078 Self-initialization is unsound because it breaks privacy assumptions that unsafe code can make. In ```rust pub mod foo { #[derive(Debug, Copy, Clone)] pub struct Foo { x: (), } } pub static FOO: foo::Foo = FOO; ``` unsafe could could expect that ony functions inside the `foo` module were able to create a value of type `Foo`.
2020-04-23Update src/librustc_mir/interpret/memory.rsOliver Scherer-1/+3
Co-Authored-By: Ralf Jung <post@ralfj.de>
2020-04-23Disallow statics initializing themselvesOliver Scherer-1/+10
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-1/+1
2020-04-16mir/interpret: only use `ErrorHandled::Reported` for `ErrorReported`.Eduard-Mihai Burtescu-6/+3
2020-04-13Miri: let machine hook dynamically decide about alignment checksRalf Jung-2/+2
2020-04-10added machine hooks to track deallocationsOzaren-0/+2
2020-04-04indicate better which kind of memory got leakedRalf Jung-11/+15
2020-04-04share more alloc printing code between Miri and MIR dumpingRalf Jung-37/+34
2020-04-04avoid printing allocations twiceRalf Jung-8/+10
2020-04-04Miri leak_report: do not report leaks of allocations that are reachable from ↵Ralf Jung-5/+24
globals
2020-04-02nix rustc_target::abi::* reexport in ty::layoutMazdak Farrokhzad-3/+2
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-1/+1
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-2/+2
2020-03-27Auto merge of #69916 - oli-obk:mir_bless, r=eddybbors-71/+25
Enable blessing of mir opt tests cc @rust-lang/wg-mir-opt cc @RalfJung Long overdue, but now you can finally just add a ```rust // EMIT_MIR rustc.function_name.MirPassName.before.mir ``` (or `after.mir` since most of the time you want to know the MIR after a pass). A `--bless` invocation will automatically create the files for you. I suggest we do this for all mir opt tests that have all of the MIR in their source anyway If you use `rustc.function.MirPass.diff` you only get the diff that the MIR pass causes on the MIR. Fixes #67865
2020-03-26add 'fn write_u16s'(rustc_mir::interpret::Memory)JOE1994-2/+42
2020-03-26Enable `--bless`ing of MIR dumpsOliver Scherer-71/+25
2020-03-25Rollup merge of #70379 - JOE1994:patch-2, r=petrochenkovDylan DPC-2/+2
fix incorrect type name in doc comments Change : `InterpCtx` => `InterpCx` (`rustc_mir::interpret::InterpCx`)
2020-03-25add usize methods for Size gettersRalf Jung-7/+6
2020-03-25go back to infix ops for SizeRalf Jung-7/+7
2020-03-25make Size::from* methods generic in the integer type they acceptRalf Jung-1/+1
2020-03-25use checked casts and arithmetic in Miri engineRalf Jung-16/+14
2020-03-24fix type name typo in doc commentsYoungsuk Kim-2/+2
InterpCtx => InterpCx (rustc_mir::interpret::InterpCx)