Commit Graph

379 Commits

Author SHA1 Message Date
Oliver Schneider
2405c81c65
stepwise interpretation 2016-06-01 18:50:20 +02:00
Oliver Schneider
5a8b0ab579
don't clone the MIR Rc in every iteration 2016-06-01 18:50:20 +02:00
Oliver Schneider
8398781132
remove one layer of indirection when interpreting const/static/main functions 2016-06-01 18:50:20 +02:00
Oliver Schneider
e73fa7733d
can't evaluate failed assertions yet 2016-06-01 18:50:20 +02:00
Oliver Schneider
fee3a2c1a7
remove intermediate vars 2016-06-01 18:42:57 +02:00
Oliver Schneider
af41c54301
use format! compile time magics for indentation 2016-06-01 18:33:29 +02:00
Oliver Schneider
c62cce3116
wraparound when reaching indentation lvl 40 2016-06-01 18:18:01 +02:00
Oliver Schneider
b7df4fdc75
use a number for the maximum indentation instead of relying on str::len() 2016-06-01 17:58:50 +02:00
Oliver Schneider
f9a5416135
use MIRI_LOG instead of RUST_LOG, because rustc's output is very verbose 2016-06-01 17:32:57 +02:00
Oliver Schneider
f1e4ef6c6f
re-introduce the module name to the logs and show vertical bars 2016-06-01 11:47:55 +02:00
Oliver Schneider
4f3f2020ed
add the log crate + env_logger to be able to choose the log granularity at runtime 2016-06-01 11:47:41 +02:00
Oliver Schneider
f910019da1
add a note to Memory::new mentioning tcx.data_layout 2016-06-01 11:24:23 +02:00
Oliver Schneider
29516c3129
improve out of bounds error message 2016-06-01 11:22:37 +02:00
Oliver Schneider
12c2e5fab2
4byte pointers 2016-06-01 11:10:43 +02:00
Oliver Schneider
b78ca5f7e1
replace panic!s with Result 2016-06-01 11:10:43 +02:00
Oliver Schneider
cecae8050e
remove unnecessary printlns for benchmarks 2016-05-30 13:40:46 +02:00
Oliver Schneider
c55b3666ea
clippy nit 2016-05-27 16:12:17 +02:00
Scott Olson
8961063c60 Handle some cases of StructWrappedNullablePointer.
... plus a bunch of minor refactorings.
2016-05-25 00:39:12 -06:00
Scott Olson
3ba923701f Update for changes in rustc nightly. 2016-05-13 22:34:50 -06:00
Scott Olson
f63206ed2f Handle discriminant_value intrinsic. 2016-05-09 23:41:57 -06:00
Scott Olson
2d32503409 Support C ABI memcmp function. 2016-05-09 21:53:20 -06:00
Scott Olson
b9c37124be Handle size_of_val for slice types. 2016-05-09 21:01:12 -06:00
Scott Olson
6d9a748858 Handle size_of_val for sized types. 2016-05-09 20:44:42 -06:00
Scott Olson
382dc0ccb2 Update for my github username change. 2016-05-09 20:08:37 -06:00
Scott Olson
ddfbb655e1 Handle statics. 2016-05-09 20:03:13 -06:00
Scott Olson
b859444562 Do or do not. 2016-05-09 18:52:53 -06:00
Scott Olson
753971a4c5 Handle promoted rvalues by recursing with call_nested. 2016-05-09 18:21:52 -06:00
Scott Olson
49b6349577 Update to a new nightly. 2016-05-09 15:32:18 -06:00
Scott Olson
a6b9b165c3 Handle CEnum layouts with signed representations. 2016-05-08 19:49:07 -06:00
Scott Olson
5f07e2ebd3 Merge branch 'new-data-layout' 2016-05-08 19:31:28 -06:00
Scott Olson
d288472b29 Handle CEnum layouts with unsigned representations. 2016-05-08 19:29:07 -06:00
Scott Olson
9e289fa0aa Fully handle RawNullablePointer layout. 2016-04-30 01:04:17 -06:00
Scott Olson
30f07f3d7f Re-implement support for downcast lvalues. 2016-04-29 23:32:15 -06:00
Andre Bogus
7cb6c0dbfe back out similar_names change 2016-04-29 17:47:10 +02:00
Andre Bogus
de64670de0 Fixed some clippy warnings 2016-04-29 06:01:17 +02:00
Scott Olson
3fd2ee9ddc Remove unused eval_operand_and_layout fn. 2016-04-23 20:46:27 -06:00
Scott Olson
500cd25627 Add missing boolean binops. 2016-04-23 20:13:00 -06:00
Scott Olson
2db3597b56 Implement boolean binops. 2016-04-23 00:39:38 -06:00
Scott Olson
6f50289d43 Fix lvalue projections with fat pointer bases. 2016-04-23 00:26:10 -06:00
Scott Olson
4a863c2a6a Replace Repr with the new ty::layout in rustc.
Lvalues still need work (see lvalue_layout).
2016-04-23 00:03:59 -06:00
Oliver Schneider
ef5fc75c35 various testing improvements 2016-04-22 20:09:00 +02:00
Oliver Schneider
211c12a1d0 use compiletest_rs 2016-04-22 10:34:14 +02:00
Scott Olson
e81d88d236 Use 8-byte pointers on 32-bit hosts for now.
This will be target-dependent and host-independent eventually.
2016-04-15 03:28:18 -06:00
Scott Olson
84f21584ea Fix drop fill checking on 32-bit hosts. 2016-04-15 03:16:35 -06:00
Scott Olson
926bbba459 Fix over-long bitshift on 32-bit hosts.
Fixes #4. (Hopefully.)
2016-04-14 17:39:06 -06:00
Pascal Hertleif
6abfa56b20
Update to Rust Nightly 2016-04-11 2016-04-14 00:01:00 +02:00
Scott Olson
a69ad6703f Store AllocIds directly in allocation map. 2016-04-09 19:31:53 -06:00
Scott Olson
910ad2a391 Implement filling drop. 2016-04-07 05:56:07 -06:00
Scott Olson
6be14eab15 Handle missing allocations in Memory::dump. 2016-04-07 03:07:57 -06:00
Scott Olson
1f6583fe06 Implement drop/deallocation for Box. 2016-04-07 03:02:02 -06:00
Scott Olson
bef57b291b Simplify intrinsic/c_abi call argument evaluation. 2016-04-07 02:02:30 -06:00
Scott Olson
f97eb35222 Change debug log format. 2016-04-06 19:28:40 -06:00
Scott Olson
6a99779740 Rename ty_size -> type_size and ty_to_repr -> type_repr. 2016-04-06 19:01:00 -06:00
Scott Olson
c55320a3db Update for changes in rustc master. 2016-04-06 19:00:34 -06:00
Scott Olson
f4dce09c97 Print sizes in allocation dumps. 2016-04-06 17:33:24 -06:00
Scott Olson
f472018fbb Partially implement reallocation (e.g. for growing Vecs). 2016-04-06 17:29:56 -06:00
Scott Olson
284404da06 Fix undef mask initialization and test undef reads. 2016-04-06 04:35:25 -06:00
Scott Olson
dbd8a82643 Add a test for overwriting part of a relocation. 2016-04-06 04:19:56 -06:00
Scott Olson
c08ddaaa48 Implement a naive, slow version of undef mask copying. 2016-04-06 04:08:52 -06:00
Scott Olson
8a0aa9291a Switch to bitmask-based undef mask. 2016-04-06 03:45:06 -06:00
Scott Olson
bdba4641cc Rearrange code in memory.rs. 2016-04-04 20:33:41 -06:00
Scott Olson
682742c223 Print terminator kinds (without spans) when debugging. 2016-04-04 20:07:22 -06:00
Scott Olson
e72d8f8dc6 Update for changes in rustc master. 2016-03-31 22:34:07 -06:00
Scott Olson
d25ddb3130 Add stack traces to error notes. 2016-03-30 22:04:53 -06:00
Scott Olson
17df5cfec3 Move substs stack management into main stack managment fns. 2016-03-29 22:13:31 -06:00
Scott Olson
6a8bb2c1c0 Add initial error reporting via rustc's interface. 2016-03-29 19:09:32 -06:00
Scott Olson
e4dcdcab65 Remove unnecessary Result return in push_stack_frame. 2016-03-29 19:08:45 -06:00
Scott Olson
63fdd46f9a Handle custom discriminant values and detect invalid discriminants. 2016-03-28 21:08:16 -06:00
Scott Olson
1861dbc2ab Update for changes in rustc master. 2016-03-28 17:43:23 -06:00
Scott Olson
62294d0c42 Mark bytes undefined in uninit intrinsic. 2016-03-28 16:37:07 -06:00
Scott Olson
56e118f86c Mark partially-overwritten relocations as undefined. 2016-03-27 00:29:02 -06:00
Scott Olson
62fab9268e Fix bug where &str's lengths were not copied. 2016-03-26 23:57:14 -06:00
Scott Olson
acf2ceb534 Check for undefinedness when reading from memory. 2016-03-26 23:56:49 -06:00
Scott Olson
68ccf3904e Add method for checking if a range is defined in an allocation. 2016-03-26 23:25:35 -06:00
Scott Olson
33e924d383 Add undefined byte tracking. 2016-03-26 22:25:08 -06:00
Scott Olson
5451b6115b Reorganize memory methods. 2016-03-23 21:40:58 -06:00
Scott Olson
87458955dd Refactor memory/allocation handling. 2016-03-23 19:44:05 -06:00
Scott Olson
f96c76e878 Use Box<[u8]> instead of Vec<u8> for allocations. 2016-03-22 00:48:28 -06:00
Scott Olson
e6c58d8277 Assert the absence of fat pointers more often. 2016-03-21 18:51:08 -06:00
Scott Olson
69c41f5372 Write the correct size for PrimVall::IntegerPtr. 2016-03-21 05:42:42 -06:00
Scott Olson
600ff26e65 Refactor handling of relocations. 2016-03-21 05:27:34 -06:00
Scott Olson
59e25cc52c Hide execution traces (they are getting long...) 2016-03-21 04:19:27 -06:00
Scott Olson
3fc9b7dd2c Make more MIR match statements exhaustive. 2016-03-21 04:01:52 -06:00
Scott Olson
69f41facb9 Support intrinsics::overflowing_sub for vec![x; n]. 2016-03-21 03:42:34 -06:00
Scott Olson
dc5fbf17ca Support [x; N] array repeat rvalues. 2016-03-21 03:34:24 -06:00
Scott Olson
6eef7cc01a Make mir::Rvalue handling exhaustive (some still unimplemented). 2016-03-21 03:19:48 -06:00
Scott Olson
877d2d900e Abort miri if the Rust code had compilation errors. 2016-03-21 02:54:20 -06:00
Scott Olson
207463d9a0 Add array indexing for-loop test. 2016-03-21 02:37:31 -06:00
Scott Olson
2994732a81 Remove debug print. 2016-03-21 01:04:50 -06:00
Scott Olson
0de1bbefd5 Refactor isize/usize read/writes. 2016-03-20 23:24:27 -06:00
Scott Olson
95e225d765 Monomorphize lvalue types. 2016-03-20 23:11:06 -06:00
Scott Olson
49e8d3ef5e Simplify handling of Result in eval_assignment. 2016-03-20 23:09:27 -06:00
Scott Olson
f7d0e0423b Support fat pointer reborrowing, length checking. 2016-03-20 22:59:13 -06:00
Scott Olson
dbd01d071a Refactor some names. 2016-03-20 22:07:25 -06:00
Scott Olson
40d0a1f67f Implement length access and indexing for fixed-sized arrays. 2016-03-20 21:30:31 -06:00
Scott Olson
62c5083f30 Reduce duplication for integer reprs. 2016-03-20 20:33:46 -06:00
Scott Olson
c8781e3c01 Support fn pointer type sizes. 2016-03-20 20:16:40 -06:00
Scott Olson
2e12b220be Stop unintentionally clearing source relocations when copying. 2016-03-20 20:15:13 -06:00
Scott Olson
493b5f649c Implement the move_val_init intrinsic. 2016-03-20 19:23:57 -06:00
Scott Olson
28ccc2bf65 Implement the __rust_allocate C ABI function. 2016-03-20 18:41:39 -06:00
Scott Olson
6a000b37cc Simplify Misc casts (still incorrect). 2016-03-19 11:07:19 -06:00
Scott Olson
20f152296a Implement min_align_of and a hacky mul_with_overflow. 2016-03-19 11:01:33 -06:00
Scott Olson
6c6cea28bd Write intrinsic result to correct lvalue. 2016-03-19 10:01:53 -06:00
Scott Olson
1eb66b6701 Handle "offset" intrinsic on integer pointers. 2016-03-19 09:09:13 -06:00
Scott Olson
668f2b6fd4 Implement bytestring literals. 2016-03-18 23:20:59 -06:00
Scott Olson
26c4772f51 Implement string literals. 2016-03-18 23:19:39 -06:00
Scott Olson
5d4a804100 Implement the dummy 'assume' intrinsic. 2016-03-18 23:04:07 -06:00
Scott Olson
dbc9913b7d Implement pointer primvals and comparison ops on them. 2016-03-18 23:03:46 -06:00
Scott Olson
81f49ed1c0 Implement transmute. 2016-03-18 12:42:09 -06:00
Scott Olson
de10839f96 Avoid an integer underflow error. 2016-03-18 12:11:57 -06:00
Scott Olson
e910d40e6a Add error message for missing MIR. 2016-03-18 12:11:39 -06:00
Scott Olson
31b8c17770 Reformat for consistency. 2016-03-18 11:53:24 -06:00
Scott Olson
b1af71e217 Implement more intrinsics. 2016-03-18 11:52:28 -06:00
Scott Olson
ee47ce3978 Normalize associated types when monomorphizing. 2016-03-18 11:52:13 -06:00
Scott Olson
27ff9ab914 Add initial support for closures. 2016-03-18 10:48:31 -06:00
Scott Olson
f8f31ea549 Remove some TODOs. 2016-03-17 08:01:34 -06:00
Scott Olson
12457607c3 Choose pointer size dynamically. 2016-03-17 07:53:26 -06:00
Scott Olson
0b37be71c2 Change invalid pointer read panic into Err. 2016-03-17 07:24:10 -06:00
Scott Olson
6477a5c694 Fix boolean tests and clean up code. 2016-03-17 06:39:29 -06:00
Scott Olson
0a8491b985 Simplify integer reading/writing. 2016-03-17 06:26:37 -06:00
Scott Olson
961137c018 Remove fn_ty argument from call_intrinsic for now. 2016-03-17 06:04:24 -06:00
Scott Olson
36dfde50f4 Extract intrinsic function handling. 2016-03-17 06:00:27 -06:00
Scott Olson
e057a156f2 Shorten ty_to_repr(ty).size() to ty_size(ty). 2016-03-17 05:49:16 -06:00
Scott Olson
49a26b93ca whitespace. 2016-03-17 05:40:56 -06:00
Scott Olson
20da5cacc6 Cached those outputs. 2016-03-17 05:40:27 -06:00
Scott Olson
19bf6eec6b Arena allocate and cache type representations. 2016-03-17 05:32:00 -06:00
Scott Olson
432619ea5e Use total size instead of max variant size in aggregates. 2016-03-17 04:57:50 -06:00
Scott Olson
573c11cef5 Simplify make_aggregate_repr. 2016-03-17 04:55:12 -06:00
Scott Olson
3ebf5063a4 Merge sum and product representations. 2016-03-17 04:38:46 -06:00
Scott Olson
71ed952465 Simplify primitive type reprs. 2016-03-17 03:36:06 -06:00
Scott Olson
c55d4b07fd Fix typo. 2016-03-17 03:20:49 -06:00
Scott Olson
7698a85d01 Simplify Repr::Array's elem size. 2016-03-17 03:19:13 -06:00
Scott Olson
4704bdca8d Simplify PrimVals. 2016-03-17 03:12:15 -06:00
Scott Olson
abd235837a Simplify FieldRepr sizes. 2016-03-17 03:11:40 -06:00
Scott Olson
a1fc284559 Simplify some Repr code. 2016-03-17 02:53:03 -06:00
Scott Olson
aa791a4085 Add fixmes to horrible casting code. 2016-03-17 01:11:06 -06:00
Scott Olson
d3b47c418f WIP: Support array indexing including a get_unchecked test.
Required supporting:
  * Trait method lookup
  * The `offset` intrinsic
  * Fat pointers
  * Unsizing coercions and some raw pointer and integer casts
2016-03-16 23:28:49 -06:00
Scott Olson
59cf49baf4 Create a pointer-only version of eval_operand. Fix pointer offset. 2016-03-16 23:28:09 -06:00
Scott Olson
3ab619c5c3 Update for changes in rustc master. 2016-03-15 16:09:08 -06:00
Scott Olson
c18e7a68fb Split Repr creation out of eval_lvalue. 2016-03-15 07:13:31 -06:00
Scott Olson
8f84d3abc6 Implement fixed-sized arrays. 2016-03-15 05:51:02 -06:00
Scott Olson
40462d64ef Implement the size_of intrinsic. 2016-03-15 00:45:25 -06:00
Scott Olson
9d1d96ce07 Add unsigned integers. 2016-03-14 23:03:31 -06:00
Scott Olson
9e1bb9841e Fix substs in nested generic function calls. 2016-03-14 22:26:39 -06:00
Scott Olson
fbb9dd260d Clarify output allocations. 2016-03-14 22:08:38 -06:00
Scott Olson
b1475e5cd4 Implement Rvalue::Box allocations. 2016-03-14 22:05:50 -06:00
Scott Olson
a7c7764c93 Reorganize and simplify. 2016-03-14 21:48:00 -06:00
Scott Olson
f74d1dc7f1 Improve execution trace logging. 2016-03-14 21:29:25 -06:00
Scott Olson
4a22283d8b Extract Terminator evaluation out of the main loop. 2016-03-14 21:18:39 -06:00
Scott Olson
7bac5963b9 Handle recursive calls without recursing in miri. 2016-03-14 20:39:51 -06:00
Scott Olson
66eb109070 Properly handle generic fn calls. 2016-03-13 18:33:26 -06:00
Scott Olson
1a27734a7b Reimplement cross-crate function calls. 2016-03-13 17:19:42 -06:00
Scott Olson
7740268dd5 Reimplement crate-local function calls. 2016-03-13 16:08:23 -06:00
Scott Olson
373f8a7a87 Fix typo. 2016-03-13 14:46:24 -06:00
Scott Olson
f145017319 Add support for pointers. 2016-03-13 14:36:25 -06:00
Scott Olson
250e9615c5 Remove unused variable. 2016-03-13 08:01:22 -06:00
Scott Olson
2105914886 Remove old commented-out code. 2016-03-13 07:40:52 -06:00
Scott Olson
9aa3a8675f Reimplement variant downcast projection. 2016-03-13 07:23:48 -06:00
Scott Olson
dd3d58f249 Reimplement field lvalue projection. 2016-03-13 06:48:04 -06:00
Scott Olson
6d37e7fc29 Reimplement sum type switching. 2016-03-13 06:30:28 -06:00
Scott Olson
80d12601ff Write enum discriminants. 2016-03-13 06:05:48 -06:00
Scott Olson
cc8b8efd33 Allow switching on non-integer types. 2016-03-13 04:50:16 -06:00
Scott Olson
96c51dc8ed Make sum repr discriminant an arbitrary repr. 2016-03-13 01:55:48 -06:00
Scott Olson
dad5edd4f3 Unnest integer reprs. 2016-03-13 01:48:07 -06:00
Scott Olson
6b4d2b11a6 Add support for smaller signed integers. 2016-03-13 01:43:28 -06:00
Scott Olson
c1edb9f978 More work for multiple int sizes. 2016-03-13 01:14:20 -06:00
Scott Olson
397dbd909a Add initial support for different int sizes. 2016-03-12 23:15:53 -06:00
Scott Olson
7cda22f8c5 Add initial enum initialization support. 2016-03-12 22:27:54 -06:00
Scott Olson
1370008576 Restructure aggregates and pave the way for enums. 2016-03-12 22:15:59 -06:00
Scott Olson
346618cd2b Fix 0-sized writes being treated as out of bounds. 2016-03-12 21:32:05 -06:00
Scott Olson
bffbb89354 Update for changes in rustc master. 2016-03-12 20:23:48 -06:00
Scott Olson
8a0b95bc8b Support structs and single-variant enums. 2016-03-11 21:27:54 -06:00
Scott Olson
fd10ec9278 Clean up unused things. 2016-03-07 10:14:47 -06:00
Scott Olson
0cb7e3fae0 Support SwitchInt for integer types. 2016-03-07 08:22:18 -06:00
Scott Olson
e41af43dbf Re-add support for integer unary ops. 2016-03-07 07:57:08 -06:00
Scott Olson
f72b0c9b12 Make formatting consistent. 2016-03-07 07:50:49 -06:00
Scott Olson
619daf0129 Re-add support for integer binops. 2016-03-07 07:48:38 -06:00
Scott Olson
83adde623f Simplfy memory allocation. 2016-03-07 07:19:43 -06:00
Scott Olson
3ae6b80ab1 Remove Pointer's repr field and make it Copy.
This required refactoring throughout and math operators have been temporarily
commented out.
2016-03-07 07:10:52 -06:00
Scott Olson
6d6cd1f420 Rename 'block' to 'current_block'. 2016-03-07 04:50:44 -06:00
Scott Olson
586bc5d1da Reimplement 'if' conditions. 2016-03-07 04:48:12 -06:00
Scott Olson
a1adc55370 Add basic bool support. 2016-03-07 04:44:03 -06:00
Scott Olson
d330bd6a32 Glob import variants before matching and simplify some code. 2016-03-07 04:10:57 -06:00
Scott Olson
4f4e0b5051 Implement a call stack using the new memory system. 2016-03-06 04:23:24 -06:00
Scott Olson
e784659568 Sort imports. 2016-03-05 00:52:14 -06:00
Scott Olson
b0683c4c72 Remove Allocation's Clone impl. 2016-03-05 00:50:53 -06:00
Scott Olson
7c5ea62156 Move memory module to its own file. 2016-03-05 00:48:23 -06:00
Scott Olson
a29a6e0db9 Refactor integer reading and writing. 2016-03-05 00:45:54 -06:00
Scott Olson
6686944ded Refactor memory range access error checnking. 2016-03-05 00:23:37 -06:00
Scott Olson
45677b453c Rename memory "values" to "allocations". 2016-03-04 23:44:49 -06:00
Scott Olson
3d9a91d0f7 Remove alloc_id_hack. 2016-03-04 23:22:41 -06:00
Scott Olson
53403ee8bd WIP: Add some support for tuples. Optimize memory copies. 2016-03-04 23:22:24 -06:00
Scott Olson
83fbfb95c0 WIP: Add EvalError/EvalResult and apply throughout. 2016-02-28 01:07:03 -06:00
Scott Olson
255927bc0c WIP: Support unary integer ops again. 2016-02-28 00:49:27 -06:00
Scott Olson
21f97a436b WIP: Rename eval_constant to const_to_ptr. 2016-02-27 22:10:10 -06:00
Scott Olson
2776f55d0c WIP: Switching to a new byte-based value representation. 2016-02-27 19:20:25 -06:00
Scott Olson
b263886598 Update for changes in rustc master. 2016-02-25 16:06:50 -06:00
Scott Olson
d4c0ef420d Remove old comments. 2016-02-18 19:24:42 -06:00
Scott Olson
1c7738d38a Update for changes in rustc master. 2016-02-18 19:06:22 -06:00
Scott Olson
416bc12669 Update for changes in rustc master. 2016-01-11 20:30:15 -06:00