about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/interpret/machine.rs
AgeCommit message (Collapse)AuthorLines
2021-09-07Rename rustc_mir to rustc_const_eval.Camille GILLOT-479/+0
2021-07-15enable Miri to fix the bytes in an allocation (since ptr offsets have ↵Ralf Jung-9/+4
different meanings there)
2021-07-15adjustions and cleanup to make Miri build againRalf Jung-59/+49
2021-07-14consistently treat None-tagged pointers as ints; get rid of some deprecated ↵Ralf Jung-0/+3
Scalar methods
2021-07-14CTFE/Miri engine Pointer type overhaul: make Scalar-to-Pointer conversion ↵Ralf Jung-33/+39
infallible This resolves all the problems we had around "normalizing" the representation of a Scalar in case it carries a Pointer value: we can just use Pointer if we want to have a value taht we are sure is already normalized.
2021-07-02Allocation failure in constprop panics right awaySmitty-0/+3
2021-05-23Pass `StackPopUnwind` to `eval_fn_call()` and some other functions that are ↵hyd-dev-5/+5
called by `eval_fn_call()`
2021-05-22Add default implementation for `enforce_abi()`hyd-dev-6/+3
2021-05-21Add `rustc_mir::interpret::Machine::enforce_abi()`hyd-dev-0/+8
2021-05-19CTFE Machine: do not expose AllocationRalf Jung-3/+4
2021-05-18CTFE core engine allocation & memory API improvemenetsRalf Jung-7/+35
- make Allocation API offset-based (no more Pointer) - make Memory API higher-level (combine checking for access and getting access into one operation)
2021-05-06use CheckInAllocMsg::PointerArithmeticTest for ptr_offset errorRalf Jung-0/+1
2021-02-16Pass PlaceTy by reference not valueTomasz Miąsko-6/+6
2021-02-16Pass OpTy by reference not valueTomasz Miąsko-2/+2
2021-01-12Auto merge of #78407 - oli-obk:ub_checkable_ctfe, r=RalfJung,pnkfelixbors-0/+10
Make CTFE able to check for UB... ... by not doing any optimizations on the `const fn` MIR used in CTFE. This means we duplicate all `const fn`'s MIR now, once for CTFE, once for runtime. This PR is for checking the perf effect, so we have some data when talking about https://github.com/rust-lang/const-eval/blob/master/rfcs/0000-const-ub.md To do this, we now have two queries for obtaining mir: `optimized_mir` and `mir_for_ctfe`. It is now illegal to invoke `optimized_mir` to obtain the MIR of a const/static item's initializer, an array length, an inline const expression or an enum discriminant initializer. For `const fn`, both `optimized_mir` and `mir_for_ctfe` work, the former returning the MIR that LLVM should use if the function is called at runtime. Similarly it is illegal to invoke `mir_for_ctfe` on regular functions. This is all checked via appropriate assertions and I don't think it is easy to get wrong, as there should be no `mir_for_ctfe` calls outside the const evaluator or metadata encoding. Almost all rustc devs should keep using `optimized_mir` (or `instance_mir` for that matter).
2021-01-10Add ABI argument to `find_mir_or_eval_fn`Nym Seddon-0/+4
Add ABI argument for called function in `find_mir_or_eval_fn` and `call_extra_fn`. Useful for comparing with expected ABI in interpreters. Related to [miri/1631](https://github.com/rust-lang/miri/issues/1631)
2021-01-04Move MIR body loading to a machine functionoli-0/+10
2020-12-11Fix rustfmt failureJCTyblaidd-1/+1
2020-12-11Add post-initialization hook for static memory initialized using the ↵JCTyblaidd-0/+10
interpereter.
2020-12-10Auto merge of #79621 - usbalbin:constier_maybe_uninit, r=RalfJungbors-1/+1
Constier maybe uninit I was playing around trying to make `[T; N]::zip()` in #79451 be `const fn`. One of the things I bumped into was `MaybeUninit::assume_init`. Is there any reason for the intrinsic `assert_inhabited<T>()` and therefore `MaybeUninit::assume_init` not being `const`? --- I have as best as I could tried to follow the instruction in [library/core/src/intrinsics.rs](https://github.com/rust-lang/rust/blob/master/library/core/src/intrinsics.rs#L11). I have no idea what I am doing but it seems to compile after some slight changes after the copy paste. Is this anywhere near how this should be done? Also any ideas for name of the feature gate? I guess `const_maybe_assume_init` is quite misleading since I have added some more methods. Should I add test? If so what should be tested?
2020-12-06Fix comments related to abort()Albin Hedman-4/+2
2020-12-05abort() now takes a msg parameterAlbin Hedman-2/+4
2020-12-03move interpret::MemoryKind::Heap to const evalVishnunarayan K I-4/+4
2020-10-13Replace absolute paths with relative onesest31-3/+4
Modern compilers allow reaching external crates like std or core via relative paths in modules outside of lib.rs and main.rs.
2020-08-30mv compiler to compiler/mark-0/+422