Scott Olson
330be7766f
Represent PrimVals as "bitbags".
...
Now instead of holding a native type based on the tag, all PrimVals
store a u64 (the `bits`), along with a `kind` corresponding to the
variant as it would be in the old PrimVal representation.
This commit makes no major optimizations and attempts to not change any
behaviour. There will be commits to follow that make use of this
representation to eliminate unnecessary allocation hacks like in
`value_to_primval`.
A number of places could be even more cleaned up after this commit,
particularly in `cast.rs`.
2016-10-20 04:42:19 -06:00
Scott Olson
197e89bbb0
Refactor alloc_ptr.
2016-10-16 00:12:11 -06:00
Scott Olson
49e6c57ef9
Do not pre-allocate local variables.
...
Thanks to the `Value` locals refactoring, now primitive locals (ints,
floats, chars, bools, and the like) will not require `Allocation`s at
all, and locals that are never initialized at all because of conditional
control flow won't be wasting memory.
2016-10-15 23:31:42 -06:00
Oliver Schneider
de38015e47
rustup
2016-10-01 15:33:07 +02:00
Oliver Schneider
5d1080d0ca
refactor Lvalue
and PrimVal::{SlicePtr, VtablePtr}
into Value::ByValPair
2016-09-26 17:49:30 +02:00
Oliver Schneider
fcbaf990f2
check Pointer::to_int
for non-integer pointers
2016-09-26 11:37:23 +02:00
Oliver Schneider
2282289ad5
refactor away intermediate allocations, stage1
2016-09-23 10:27:14 +02:00
Oliver Schneider
38748fa615
refactor away IntegerPtr
2016-09-22 15:47:16 +02:00
Oliver Schneider
875a4542f9
remove the ZST allocation and abort all zero byte writes/reads
2016-09-22 15:22:00 +02:00
Oliver Schneider
0690a26ddf
make Memory::dump use trace!
instead of println!
2016-09-22 13:01:08 +02:00
Oliver Schneider
0f578f0d2e
fully implement size_of_val
and add various tests that now succeed
2016-09-22 13:00:43 +02:00
Scott Olson
5b012edc7a
Rename AbstractPtr to Ptr.
2016-09-21 23:23:50 -06:00
Scott Olson
678b9ca328
Print "(immutable)" when dumping allocations.
2016-09-19 04:10:51 -06:00
Scott Olson
c679c71def
Freeze static memory of string constants.
2016-09-19 04:10:18 -06:00
Scott Olson
f731766805
Fix allocation of fn items by allowing ZST alignment to be 0.
2016-09-13 21:31:12 -06:00
Oliver Schneider
c57233abca
needless clones
2016-09-13 13:03:54 +02:00
Oliver Schneider
5c47e3dbd8
only allow the modification of static mut
or statics with interior mutability
2016-09-11 11:02:45 +02:00
Oliver Schneider
0e58c2a31b
document the fields of Allocation
2016-09-11 11:02:45 +02:00
Oliver Schneider
78bef956c9
don't load memory as mutable if not necessary
2016-09-11 11:02:45 +02:00
Oliver Schneider
00c551c5f0
implement calling methods through trait objects
2016-09-09 12:51:14 +02:00
Oliver Schneider
0f177fdecf
implement more casts
2016-09-07 18:34:59 +02:00
Oliver Schneider
cd91f9feee
replace all unreachable!
and panic!
calls with bug!
2016-09-06 16:16:49 +02:00
Oliver Schneider
f8cfc387fd
address nits
2016-07-25 12:30:35 +02:00
Oliver Schneider
ec897f9156
don't allow runtime-aligning of memory
2016-07-22 16:35:39 +02:00
Oliver Schneider
613d15c672
clippy
2016-07-07 13:19:17 +02:00
Oliver Schneider
4c258d1ed2
Merge remote-tracking branch 'origin/master' into alignment
2016-07-07 13:17:08 +02:00
Oliver Schneider
9669acc3a3
Merge remote-tracking branch 'origin/master' into the_outer_limits
2016-07-07 11:27:49 +02:00
Oliver Schneider
5381981446
shrink_to_fit some vectors to prevent interpreted code from passing the memory limits
2016-07-07 11:21:18 +02:00
Oliver Schneider
8d3817cfc6
use usize instead of u64 for memory limits
2016-07-07 11:20:46 +02:00
Oliver Schneider
51ce4a2584
use byteorder's write_f{32,64} instead of transmuting
2016-07-06 11:51:32 +02:00
Oliver Schneider
1bd8e04228
check alignment in various places
2016-07-06 11:12:44 +02:00
Oliver Schneider
50987e3697
some methods to check pointers for correct alignment
2016-07-06 10:58:51 +02:00
Oliver Schneider
082effb3ee
align allocations in the worst possible way
2016-07-05 14:27:27 +02:00
Oliver Schneider
756fbcce48
add a memory limit
2016-07-05 10:47:10 +02:00
Oliver Schneider
4b831569f6
implement floats by running the ops on the host architecture
2016-07-05 09:08:24 +02:00
Scott Olson
a7cc77a010
Compare against ZST_ALLOC_ID in points_to_zst.
2016-07-01 16:40:52 -06:00
Oliver Schneider
3d9588332f
address comments
2016-07-01 13:09:40 +02:00
Oliver Schneider
594f1d79da
optimize all ZST allocations into one single allocation
2016-07-01 13:09:17 +02:00
Scott Olson
756d73b3ca
Remove filling drop to prep for elaborated drops.
2016-06-30 21:30:03 -06:00
Oliver Schneider
b91338b220
things priroda needs to be public or changed
2016-06-30 11:29:25 +02:00
Oliver 'ker' Schneider
37287d2a5d
use free methods instead of traits
2016-06-25 16:50:33 +02:00
Oliver Schneider
0288486b73
use target byte order
2016-06-23 15:16:25 +02:00
Oliver Schneider
86040c0d29
simplify write_ptr
2016-06-23 13:04:05 +02:00
Oliver Schneider
4c7aae73bc
adjust all pointer_size checks to use the method
2016-06-23 10:02:39 +02:00
Oliver Schneider
d13153c424
add a pointer_size method to Memory for easy access
2016-06-23 09:59:16 +02:00
Oliver Schneider
205a988c1b
improve rustdoc rendering
2016-06-23 09:40:01 +02:00
Oliver Schneider
055b6a8d38
store full TargetDataLayout in Memory instead of just pointer size
2016-06-23 09:36:37 +02:00
Oliver Schneider
7a9272c8e1
no need to cast chars as u32 before casting to u64
2016-06-21 09:43:45 +02:00
Oliver Schneider
2dbd30fa51
implement char handling
2016-06-21 09:35:20 +02:00
Oliver Schneider
68469be89b
rename function cache member
2016-06-20 16:52:53 +02:00
Oliver Schneider
e90ee1674a
fix comparing of function pointers
2016-06-20 10:35:15 +02:00
Oliver Schneider
c36dcff005
forbid calling functions through pointers of a different type
2016-06-14 10:34:54 +02:00
Oliver Schneider
fe9b455006
comment nit
2016-06-13 15:32:08 +02:00
Oliver Schneider
4d090fa693
report better errors when using a fn ptr as memory and vice versa
2016-06-13 11:39:15 +02:00
Oliver Schneider
3aa585e421
Merge remote-tracking branch 'origin/master' into function_pointers2
2016-06-13 11:24:01 +02:00
Oliver Schneider
384623daa7
function pointers
2016-06-10 18:06:36 +02:00
Oliver Schneider
c881cf10d8
clippy nits
2016-06-08 09:41:28 +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
Scott Olson
382dc0ccb2
Update for my github username change.
2016-05-09 20:08:37 -06:00
Scott Olson
b859444562
Do or do not.
2016-05-09 18:52:53 -06:00
Scott Olson
49b6349577
Update to a new nightly.
2016-05-09 15:32:18 -06:00
Scott Olson
5f07e2ebd3
Merge branch 'new-data-layout'
2016-05-08 19:31:28 -06:00
Scott Olson
9e289fa0aa
Fully handle RawNullablePointer layout.
2016-04-30 01:04:17 -06:00
Andre Bogus
de64670de0
Fixed some clippy warnings
2016-04-29 06:01:17 +02: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
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
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
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
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
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
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
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
207463d9a0
Add array indexing for-loop test.
2016-03-21 02:37:31 -06:00
Scott Olson
0de1bbefd5
Refactor isize/usize read/writes.
2016-03-20 23:24:27 -06:00
Scott Olson
dbd01d071a
Refactor some names.
2016-03-20 22:07:25 -06:00
Scott Olson
2e12b220be
Stop unintentionally clearing source relocations when copying.
2016-03-20 20:15:13 -06:00
Scott Olson
26c4772f51
Implement string literals.
2016-03-18 23:19:39 -06:00
Scott Olson
dbc9913b7d
Implement pointer primvals and comparison ops on them.
2016-03-18 23:03:46 -06:00
Scott Olson
de10839f96
Avoid an integer underflow error.
2016-03-18 12:11:57 -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