Oliver Schneider
dc1b0fb436
Compiles again
2017-03-21 13:53:55 +01:00
Scott Olson
0ca0676abd
Merge pull request #146 from oli-obk/peephole1
...
[Peephole Optimization 1/n] Don't allocate for structs with a single primval field
2017-03-14 09:57:02 -07:00
Oliver Schneider
8405770b51
Rustup to rustc 1.17.0-nightly ( be760566c
2017-02-28)
2017-03-02 13:11:33 +01:00
Oliver Schneider
8878a4030a
rustup to rustc 1.17.0-nightly ( 60a0edc6c
2017-02-26)
2017-02-28 12:35:00 +01:00
Oliver Schneider
2282e6b582
represent single field structs as their single field
2017-02-24 11:04:13 +01:00
Oliver Schneider
529efc51e8
detect memory leaks
2017-02-24 10:41:15 +01:00
Scott Olson
0f714b72a0
Formatting.
2017-02-10 13:35:45 -08:00
Scott Olson
6ffd7005c1
Cache string and bytestring literal allocs.
2017-02-10 13:35:33 -08:00
Oliver Schneider
333264c956
clarify comment on drop glue
2017-02-10 08:13:18 +01:00
Oliver Schneider
e58f750a49
refactor drop glue
2017-02-09 19:27:07 +01:00
Oliver Schneider
4beb774caa
don't mark the zst allocation as static
2017-02-08 17:24:20 +01:00
Oliver Schneider
080d3e4355
properly prevent recursive statics from marking each other
2017-02-08 16:27:28 +01:00
Oliver Schneider
fbfd2d4bca
re-add spaces before static kind
2017-02-08 09:17:48 +01:00
Oliver Schneider
98cda6cb07
freeze -> static
2017-02-07 20:28:54 +01:00
Oliver Schneider
01ac19d358
fix static mut
accidental dealloc or freeze
2017-02-07 19:20:16 +01:00
Oliver Schneider
45df853da7
cleanup buggy closure dispatch code
2017-02-07 14:22:20 +01:00
Scott Olson
9f7ca351e0
Dump fn ptr ABIs.
2017-02-07 01:57:42 -08:00
Scott Olson
097db58f30
Print fn name and type in dump_allocs.
2017-02-06 12:48:10 -08:00
Scott Olson
b36d8085a7
Fix duplicate allocation printing.
2017-02-06 09:26:01 -08:00
Scott Olson
7acbf7ef74
Cleanup: EvalResult<'a, ()> becomes EvalResult<'a>.
2017-02-04 13:09:10 -08:00
Oliver Schneider
c47c325252
remove duplicate alignment checks
2017-01-31 10:56:37 +01:00
Oliver Schneider
148c6de507
fix some unaligned reads
2017-01-31 10:36:46 +01:00
Oliver Schneider
96607d4593
document our packed struct strategy
2017-01-31 10:36:27 +01:00
Oliver Schneider
5e34740ab6
implement packed struct field access
2017-01-30 09:44:52 +01:00
Scott Olson
53fa985fc4
Update for changes in rustc.
2017-01-16 19:37:53 -08:00
Scott Olson
ac2bf50f9d
Use the new field init shorthand.
2017-01-16 18:45:30 -08:00
Oliver Schneider
3a658e09e8
rustup (i128)
2017-01-12 08:28:42 +01:00
Scott Olson
b233ada529
Change Option<Value> to Value, using ByVal(Undef).
...
This job isn't quite finished because it caused me to discover bugs
related to reading `ByVal(Undef)` when a `ByValPair` is expected, e.g.
for a fat pointer. This wasn't a problem with the `None` of
`Option<Value>`, but I realized an equivalent bug existed even then,
since you could transmute a `u64` like `ByVal(Bytes(42))` to a fat
pointer type on 32-bit targets.
Likewise, you could transmute a fat pointer to `u64` and get panics
related to expecting `ByVal` but finding `ByValPair`, so the problem
goes both ways.
2016-12-18 20:59:01 -08:00
Scott Olson
4fe41ad8d5
Refactor PrimVal::bits() out of existence.
2016-12-17 03:09:57 -08:00
Scott Olson
29e690fe14
Handle writing undefined PrimVals and mask properly.
2016-12-17 01:36:02 -08:00
Scott Olson
b36a83171b
Turn PrimVal into an enum including Undefined.
...
This is step 1 of a refactoring to fix #95 . The `Undefined` variant is
so far unused and the old `bits` and `relocation` fields are emulated
with two new temporary methods. There should be no functional change due
to this commit.
2016-12-16 22:03:34 -08:00
Scott Olson
6ec3d65068
Revert "Revert "rustup to rustc 1.15.0-dev ( ace092f56
2016-12-13)""
2016-12-16 17:10:16 -08:00
Scott Olson
0deabf9c00
Revert "rustup to rustc 1.15.0-dev ( ace092f56
2016-12-13)"
2016-12-15 01:16:06 -08:00
Oliver Schneider
fd0c21eeee
check that the null terminator is defined and not part of a pointer
2016-12-15 09:58:41 +01:00
Oliver Schneider
69fa3ebff6
rustup to rustc 1.15.0-dev ( ace092f56
2016-12-13) (always_encode_mir)
2016-12-14 17:06:23 +01:00
Scott Olson
1af63171f8
Split primval into operator and value.
2016-12-10 16:23:07 -08:00
Scott Olson
5ce6514f23
Dump allocations within PrimVal pointers.
2016-12-07 22:00:46 -08:00
Scott Olson
49f784a3e4
Remove PrimValKind field from PrimVal.
2016-11-26 23:21:20 -08:00
Oliver Schneider
0039ebc940
replace most uses of usize
with u64
so the host architecture isn't exposed anymore
2016-11-18 12:55:14 +01:00
Oliver Schneider
986b3a07c2
layout computation can fail, make it fail with a miri error
2016-11-18 10:38:07 +01:00
Oliver Schneider
fd6a90860c
simplify dumping of pointers to the zst or never alloc
2016-11-18 10:36:01 +01:00
Oliver Schneider
11a0594a1d
address comments
2016-11-18 10:35:41 +01:00
Oliver Schneider
51ff9fdaf6
deallocate all locals on function exit and transitively freeze constants through pointers
2016-11-18 10:05:55 +01:00
Oliver Schneider
a5aafbdfbf
rustup
2016-11-17 11:31:28 +01:00
Oliver Schneider
fd68670c0a
merge closures and function and implement some closure vtable cases
2016-11-15 17:19:37 +01:00
Oliver Schneider
f77a0ab10b
fix writing int->ptr transmuted primvals to memory
2016-11-15 15:18:49 +01:00
Oliver Schneider
14ff6411f0
make sure ByVal pointers act just like ByRef to a pointer
2016-11-15 14:12:49 +01:00
Oliver 'ker' Schneider
1c40fb0da1
report the bad integer size instead of just the fact that it is bad
2016-11-11 13:08:14 +01:00
Oliver 'ker' Schneider
921f5af1fe
ensure that integers cast to pointers will never point at a valid alloc, not even the zst alloc
2016-11-10 19:20:11 +01:00
Scott Olson
e7bcf35f8a
Simplify PrimValKind and remove a horrible hack.
...
This takes the `AllocId` out of PrimValKind, replacing it with a
`relocation` field on `PrimVal`, which is closer to an earlier design
for `PrimVal` I discussed with @eddyb.
This commit prepares the code for removing the `PrimValKind` from
`PrimVal` and making them more pure bitbags. The only code dealing with
`PrimValKind` will be code making decisions like "what kind of operation
do I need to do on these bits", like operators and casting. Transmutes
of `PrimVal`s will become true no-ops, not even adjusting a `kind`
field.
This commit also removes my horrible `value_to_primval` hack that made
an allocation for every `ByVal` passed in, so it could use `read_value`
to get a `PrimVal` with the right kind. Now I just compute the
`PrimValKind` from the `Ty` and re-tag the `PrimVal`.
The code got slightly messier in some areas here, but I think a _lot_ of
code will simplify in obvious ways once I remove the `kind` field from
`PrimVal`.
Gosh, if my commit messages aren't turning into essays these days.
2016-10-21 03:17:53 -06:00
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