summary refs log tree commit diff
path: root/src/librustc_mir/interpret/eval_context.rs
AgeCommit message (Collapse)AuthorLines
2018-08-30Don't hash the ctfe memoryOliver Schneider-3/+3
2018-07-29Sanity-check all constantsOliver Schneider-70/+340
2018-07-23Promoteds are statics and statics have a place, not just a valueOliver Schneider-13/+1
2018-07-18Move the const casting code into its dedicated fileOliver Schneider-128/+2
2018-07-17Pull out a statement that all match arms are executingOliver Schneider-5/+4
2018-07-04Move `Eq + Hash + Clone` bounds to `Machine`Dylan MacKenzie-8/+4
2018-07-04Avoid overflow in step counterDylan MacKenzie-13/+14
This removes the `usize` argument to `inc_step_counter`. Now, the step counter increments by exactly one for every terminator evaluated. After `STEPS_UNTIL_DETECTOR_ENABLED` steps elapse, the detector is run every `DETECTOR_SNAPSHOT_PERIOD` steps. The step counter is only kept modulo this period.
2018-07-04Rename `bloom` to `hashes`Dylan MacKenzie-8/+8
2018-07-04Enable loop detector in step loopDylan MacKenzie-5/+10
The detector runs every `DETECTOR_SNAPSHOT_PERIOD` steps. Since the number of steps can increase by more than 1 (I'd like to remove this), the detector may fail if the step counter is incremented past the scheduled detection point during the loop.
2018-07-04Add an `InfiniteLoop` variant to `EvalErrorKind`Dylan MacKenzie-3/+3
2018-07-04Improve correctness of `Frame` and `Memory` equalityDylan MacKenzie-8/+10
Incorporate a subset of the suggestions from @oli-obk. More to come.
2018-07-04Revert "Refactor EvalContext stack and heap into inner struct"Dylan MacKenzie-121/+88
This reverts commit 59d21c526c036d7097d05edd6dffdad9c5b1cb62, and uses tuple to store the mutable parts of an EvalContext (which now includes `Machine`). This requires that `Machine` be `Clone`.
2018-07-04Add miri infinite loop detectionDylan MacKenzie-9/+62
Use the approach suggested by @oli-obk, a table holding `EvalState` hashes and a table holding full `EvalState` objects. When a hash collision is observed, the state is cloned and put into the full table. If the collision was not spurious, it will be detected during the next iteration of the infinite loop.
2018-07-04Implement Clone, Eq and Hash for the heap and stackDylan MacKenzie-2/+86
I use a pattern binding in each custom impl, so that adding fields to `Memory` or `Frame` will cause a compiler error instead of causing e.g. `PartialEq` to become invalid. This may be too cute. This adds several requirements to `Machine::MemoryData`. These can be removed if we don't want this associated type to be part of the equality of `Memory`.
2018-07-04Refactor EvalContext stack and heap into inner structDylan MacKenzie-63/+75
Change surrounding code to use accessor methods to refer to these fields. Similar changes have not yet been made in tools/miri
2018-07-02Removed `uninitialized_statics` field from `Memory` struct in miri.Alexander Regueiro-7/+7
Refactored code accordingly.
2018-07-01Auto merge of #51833 - wesleywiser:faster_large_constant_arrays, r=oli-obkbors-4/+8
Speed up compilation of large constant arrays This is a different approach to #51672 as suggested by @oli-obk. Rather than write each repeated value one-by-one, we write the first one and then copy its value directly into the remaining memory. With this change, the [toy program](https://github.com/rust-lang/rust/blob/c2f4744d2db4e162df824d0bd0b093ba4b351545/src/test/run-pass/mir_heavy_promoted.rs) goes from 63 seconds to 19 seconds on my machine. Edit: Inlining `Size::bytes()` saves an additional 6 seconds dropping the total time to 13 seconds on my machine. Edit2: Now down to 2.8 seconds. r? @oli-obk cc @nnethercote @eddyb
2018-06-28Merge `ConstVal` and `ConstValue`Oliver Schneider-33/+12
2018-06-28Move everything over from `middle::const_val` to `mir::interpret`Oliver Schneider-2/+2
2018-06-28Address review commentsOliver Schneider-2/+2
2018-06-28Eliminate old CTFE's `ErrKind`Oliver Schneider-2/+2
2018-06-26Speed up compilation of large constant arraysWesley Wiser-4/+8
This is a different approach to #51672 as suggested by @oli-obk. Rather than write each repeated value one-by-one, we write the first one and then copy its value directly into the remaining memory.
2018-06-14rustc: rename ty::maps to ty::query.Eduard-Mihai Burtescu-1/+1
2018-06-05Properly report transitive errorsOliver Schneider-10/+2
2018-06-05Refactor the const eval diagnostic APIOliver Schneider-75/+13
2018-05-31Don't store the discriminant with the enum's type sizeOliver Schneider-1/+1
2018-05-24Rename `amt` variables to `shift`Oliver Schneider-6/+6
2018-05-24Remove `ty_to_primitive`Oliver Schneider-7/+0
2018-05-24Replace `ScalarKind` with `Primitive`Oliver Schneider-74/+7
2018-05-24Get rid of `scalar_size`Oliver Schneider-5/+6
2018-05-24Update outdated commentOliver Schneider-1/+1
2018-05-24primval -> scalar renameOliver Schneider-34/+34
2018-05-24change `Value::Bytes` to `Value::Bits`Oliver Schneider-30/+57
2018-05-24Remove Pointer::zero in favor of Pointer::fromOliver Schneider-2/+1
2018-05-24Rename MemoryPointer to PointerOliver Schneider-6/+6
2018-05-24Eliminate the `Pointer` wrapper typeOliver Schneider-12/+12
2018-05-24Rename ByVal(Pair) to Scalar(Pair)Oliver Schneider-27/+27
2018-05-24Rename PrimVal to ScalarOliver Schneider-44/+44
2018-05-24Add constant for `Size::from_bytes(0)`Oliver Schneider-1/+1
2018-05-22Introduce AllocType which indicates what AllocIds point toJohn Kåre Alsaker-2/+3
2018-05-22Get rid of literal_alloc_cacheJohn Kåre Alsaker-1/+1
2018-05-20Auto merge of #50841 - oli-obk:promote_errors_to_panics, r=eddybbors-10/+2
Don't lint numeric overflows in promoteds in release mode r? @eddyb mitigates #50814
2018-05-19Use `Size` instead of `u64` in mir interpretationOliver Schneider-30/+29
2018-05-19Keep statics' constant as ByRefOliver Schneider-0/+14
2018-05-19Go through an allocation when accessing fields of constantsOliver Schneider-2/+2
2018-05-19Reintroduce some sanity checksOliver Schneider-4/+0
2018-05-19Release mode overflows should not cause const eval to errorOliver Schneider-10/+2
2018-05-11Introduce ConstValue and use it instead of miri's Value for constant valuesJohn Kåre Alsaker-78/+93
2018-05-10Auto merge of #50395 - Zoxc:small-tys, r=michaelwoeristerbors-11/+16
Optimize layout of TypeVariants This makes references to `Slice` use thin pointers by storing the slice length in the slice itself. `GeneratorInterior` is replaced by storing the movability of generators in `TyGenerator` and the interior witness is stored in `GeneratorSubsts` (which is just a wrapper around `&'tcx Substs`, like `ClosureSubsts`). Finally the fields of `TypeAndMut` is stored inline in `TyRef`. These changes combine to reduce `TypeVariants` from 48 bytes to 24 bytes on x86_64. r? @michaelwoerister
2018-05-08Insert fields from TypeAndMut into TyRef to allow layout optimizationJohn Kåre Alsaker-11/+16