about summary refs log tree commit diff
path: root/src/librustc_mir/interpret
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-8700/+0
2020-08-26Auto merge of #75893 - Dylan-DPC:fix/offset-to-u64, r=oli-obkbors-3/+3
change offset from u32 to u64 References #71696 r? @oli-obk (closed the earlier pr because the rebase got messed up)
2020-08-25cleanupDPC-3/+3
2020-08-24hir: consistent use and naming of lang itemsDavid Wood-2/+2
This commit adjusts the naming of various lang items so that they are consistent and don't include prefixes containing the target or "LangItem". In addition, lang item variants are no longer exported from the `lang_items` module. Signed-off-by: David Wood <david@davidtw.co>
2020-08-20Auto merge of #75562 - oli-obk:const_prop_no_aggregates, r=wesleywiserbors-1/+24
Check that we don't use `Rvalue::Aggregate` after the deaggregator fixes #75481 r? @wesleywiser cc @RalfJung (modified the validator)
2020-08-18Moved coverage counter injection from BasicBlock to Statement.Rich Kadel-5/+13
2020-08-18Address review commentsOliver Scherer-1/+1
2020-08-18Validate the MIR of all optimizations in the mir-opt directoryOliver Scherer-1/+24
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-4/+4
2020-08-17Auto merge of #74940 - oli-obk:const_is_null, r=RalfJungbors-3/+39
Make `<*const T>::is_null` const fn r? @RalfJung cc @rust-lang/wg-const-eval tracking issue: #74939
2020-08-17fix typoRalf Jung-1/+1
Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-08-16miri engine: add option to use force_int for alignment checkRalf Jung-10/+23
2020-08-14answer an old question re: intern kindsRalf Jung-1/+2
2020-08-12fix span of stack size errorRalf Jung-8/+0
2020-08-12fix typosRalf Jung-3/+3
Co-authored-by: Oliver Scherer <github35764891676564198441@oli-obk.de>
2020-08-12more precise span for erroneous consts during CTFE/MiriRalf Jung-16/+29
2020-08-12miri: fall back to whole-function span when loc==NoneRalf Jung-11/+9
2020-08-12only set frame location during push after preamble is doneRalf Jung-1/+2
2020-08-12Rollup merge of #75394 - oli-obk:get_static, r=RalfJungYuki Okushi-17/+5
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-11Auto merge of #73656 - oli-obk:deaggregate-is-cleanup, r=wesleywiserbors-1/+3
move Deaggregate pass to post_borrowck_cleanup Reopen of #71946 Only the second commit is from this PR, the other commit is a bugfix that's in the process of getting merged. I'll rebase once that's done In #70073 MIR pass handling got reorganized, but with the goal of not changing behavior (except for disabling some optimizations on opt-level = 0). But there we realized that the Deaggregator pass, while conceptually more of a "cleanup" pass (and one that should be run before optimizations), was run in the middle of the optimization chain. Likely this is an accident of history, so I suggest we try and clean that up by making it a proper cleanup pass. This does change mir-opt output, because deaggregation now runs before const-prop instead of after. r? @wesleywiser @rust-lang/wg-mir-opt cc @RalfJung
2020-08-11move Deaggregate pass to post_borrowck_cleanupRalf Jung-1/+3
2020-08-11Add a function to `TyCtxt` for computing an `Allocation` for a `static` ↵Oliver Scherer-17/+5
item's initializer
2020-08-11Make `<*const T>::is_null` const fnOliver Scherer-3/+39
2020-08-11Rollup merge of #75338 - RalfJung:const-eval-stack-size-check, r=oli-obkYuki Okushi-5/+1
move stack size check to const_eval machine This is consistent with how we enforce the step limit. In particular, we do not want this limit checked for Miri-the-tool.
2020-08-11Rollup merge of #75226 - pnadon:miri-undef-uninit, r=RalfJungYuki Okushi-10/+10
Miri: Renamed "undef" to "uninit" 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-09evaluate required_consts when pushing stack frame in Miri engineRalf Jung-0/+7
2020-08-09move stack size check to const_eval machineRalf Jung-5/+1
2020-08-09move const_eval error reporting logic into rustc_mir::const_eval::errorRalf Jung-5/+32
2020-08-08Miri: Renamed "undef" to "uninit"Philippe Nadon-10/+10
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-05Auto merge of #75155 - davidtwco:polymorphization-incr-comp-optimisations, ↵bors-2/+14
r=lcnr polymorphization: various improvements This PR includes a handful of polymorphisation-related changes: - @Mark-Simulacrum's suggestions [from this comment](https://github.com/rust-lang/rust/pull/74633#issuecomment-668684433): - Use a `FiniteBitSet<u32>` over a `FiniteBitSet<u64>` as most functions won't have 64 generic parameters. - Don't encode polymorphisation results in metadata when every parameter is used (in this case, just invoking polymorphisation will probably be quicker). - @lcnr's suggestion [from this comment](https://github.com/rust-lang/rust/pull/74717#discussion_r463690015). - Add an debug assertion in `ensure_monomorphic_enough` to make sure that polymorphisation did what we expect. r? @lcnr
2020-08-04mir: add debug assertion to check polymorphizationDavid Wood-2/+14
This commit adds some debug assertions to `ensure_monomorphic_enough` which checks that unused generic parameters have been replaced with a parameter. Signed-off-by: David Wood <david@davidtw.co>
2020-08-04Correct a typo in interpret/memory.rsFelix Yan-1/+1
2020-08-01Auto merge of #74726 - oli-obk:tracing, r=Mark-Simulacrumbors-2/+1
Move from `log` to `tracing` The only visible change is that we now get timestamps in our logs: ``` Jul 24 18:41:01.065 TRACE rustc_mir::transform::const_prop: skipping replace of Rvalue::Use(const () because it is already a const Jul 24 18:41:01.065 TRACE rustc_mir::transform::const_prop: propagated into _2 Jul 24 18:41:01.065 TRACE rustc_mir::transform::const_prop: visit_constant: const () ``` This PR was explicitly designed to be as low-impact as possible. We can now move to using the name `tracing` insteads of `log` on a crate-by-crate basis and use any of the other tracing features where desirable. As far as I can tell this will allow tools to seamlessly keep working (since they are using `rustc_driver::init_log...`). This is the first half of step 1 of the accepted `tracing` MCP (https://github.com/rust-lang/compiler-team/issues/331)
2020-08-01Auto merge of #74717 - ↵bors-20/+91
davidtwco:issue-74636-polymorphized-closures-inherited-params, r=oli-obk mir: add `used_generic_parameters_needs_subst` Fixes #74636. This PR adds a `used_generic_parameters_needs_subst` helper function which checks whether a type needs substitution, but only for parameters that the `unused_generic_params` query considers used. This is used in the MIR interpreter to make the check for some pointer casts and for reflection intrinsics more precise. I've opened this as a draft PR because this might not be the approach we want to fix this issue and we have to decide what to do about the reflection case. r? @eddyb cc @lcnr @wesleywiser
2020-07-31Move from `log` to `tracing`Oliver Scherer-2/+1
2020-07-31Miri: fix ICE when unwinding past topmost stack frameRalf Jung-0/+4
2020-07-31interp: needs_subst -> ensure_monomorphic_enoughDavid Wood-20/+91
This commit adds a `ensure_monomorphic_enough` utility function which checks whether a type needs substitution, but only for parameters that the `unused_generic_params` query considers used. `ensure_monomorphic_enough` is then used throughout interpret where `needs_subst` checks previously existed (in particular, for some pointer casts and for reflection intrinsics more precise). Signed-off-by: David Wood <david@davidtw.co>
2020-07-30Auto merge of #74930 - ecstatic-morse:const-size-align-of-val, r=oli-obkbors-0/+15
Make `mem::size_of_val` and `mem::align_of_val` unstably const Implements #46571 but does not stabilize it. I wanted this while working on something today. The only reason not to immediately stabilize are concerns around [custom DSTs](https://github.com/rust-lang/rust/issues/46571#issuecomment-387669352). That proposal has made zero progress in the last two years and const eval is rich enough to support pretty much any user-defined `len` function as long as nightly features are allowed (`raw_ptr_deref`). Currently, this raises a `const_err` lint when passed an `extern type`. r? @oli-obk cc @rust-lang/wg-const-eval
2020-07-29Make `{align,size}_of_val` `const`Dylan MacKenzie-0/+15
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-112/+152
2020-07-27Auto merge of #74775 - RalfJung:miri-alloc-ids, r=oli-obkbors-114/+98
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-27rename eval_const_to_op -> const_to_opRalf Jung-10/+6
2020-07-26typos + fmtRalf Jung-10/+10
2020-07-26move getting the initial value of a static into helper functionRalf Jung-12/+19
2020-07-26Miri: replace canonical_alloc_id mechanism by extern_static_alloc_id which ↵Ralf Jung-93/+74
is called only when a pointer is 'imported' into the machine
2020-07-26Auto merge of #74664 - pnadon:Miri-rename-undef-uninit, r=RalfJungbors-29/+29
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-12/+12
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-07-22renamed ScalarMaybeUninit::not_undef to check_initPhilippe Nadon-18/+18
Renamed the function ScalarMaybeUninit::not_undef to ScalarMaybeUninit::check_init in the file src/librustc_middle/mir/interpret/value.rs, to reflect changes in terminology used. Related issue rust-lang#71193