Commit Graph

33 Commits

Author SHA1 Message Date
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
e2091ff934
add more atomic intrinsics 2016-11-15 15:19:38 +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
b2d476eb38 type_size now returns None for unsized types 2016-11-11 13:07:41 +01:00
Oliver Schneider
07c752cc82
fix the block processing for the drop_in_place intrinsic 2016-11-04 17:55:06 +01:00
Oliver Schneider
bd6e52d831
fix the drop_in_place intrinsic for fat pointers 2016-11-04 16:37:12 +01:00
Oliver Schneider
1e0d5b817d
implement a bunch of intrinsics 2016-11-03 17:32:06 +01:00
Oliver Schneider
a9b984d21e
don't always allocate for the uninit intrinsic 2016-11-03 13:13:47 +01:00
Oliver Schneider
92f6874ead
enable code sharing between global and local access 2016-11-03 12:52:13 +01:00
Oliver Schneider
bf73e7581e
don't always allocate during init intrinsic processing 2016-11-03 12:31:04 +01:00
Oliver Schneider
19c44dab05
rustup to rustc 1.14.0-nightly (7c69b0d5a 2016-11-01) 2016-11-03 10:38:08 +01:00
Scott Olson
7f3cb7fdb8 Merge pull request #68 from oli-obk/master
priroda requirements + static impl
2016-10-21 04:08:20 -06: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
Oliver Schneider
24be49f7dd
add a 'tcx lifetime to Lvalue in preparation for statics 2016-10-21 10:29:56 +02: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
d6b4e1aba6 Expand on "uninit" FIXME. 2016-10-19 20:27:35 -06:00
Scott Olson
7728de3e60 Do not force_allocate checked binop destination. 2016-10-16 17:18:06 -06:00
Scott Olson
c1b97f1440 Pass thin self ptr to virtual calls. 2016-10-16 02:12:26 -06:00
Scott Olson
6c463b7562 Hold an Lvalue for the return pointer in a frame.
Previously ReturnPointer was just the first slot in the locals array,
which had type `Vec<Pointer>`. But after my recent refactoring, locals
is `Vec<Value>` and it became increasingly hacky to pull a pointer out
of the first slot to be the value. Besides, that hack wouldn't allow
ReturnPointer to ever be an `Lvalue::Local`, referring directly to a
local on a higher stack frame.

Now ReturnPointer has no presence in the locals array, instead being
upgraded to its own field on `Frame`.

This introduces a couple of new hacks, detailed by some of my FIXME
comments, so that I could get the tests passing again and commit. More
commits coming soon should clean up these hacks without much trouble,
and overall I feel that the code is converging on a cleaner, more
efficient design.
2016-10-15 19:48:30 -06:00
Scott Olson
3d6dbb89dd Fix some long lines. 2016-10-14 03:52:23 -06:00
Scott Olson
8143a05812 Implement atomic_{load,store}. 2016-10-14 03:49:02 -06:00
Scott Olson
5f65ee2713 Refactor in preparation for Value locals.
Turning locals into `Vec<Value>` will allow writing `PrimVal` results
directly into the locals array without creating `memory::Allocation`s
for every local.

This will entail passing around a generalized kind of `Lvalue` instead
of `Pointer`s for the destinations of operations. Replacing `Pointer`
with `Lvalue` is mostly done with this commit, but expanding `Lvalue`
will come later.

This commit turns every local from `Pointer` into `Value::ByRef(ptr)`.
Locals which are `Value::ByVal(prim_val)` will come in a later commit.
2016-10-14 03:31:45 -06:00
Scott Olson
911e46fb0e Update for changes in rustc. 2016-10-03 20:45:50 -06:00
Oliver Schneider
18c8c852e4
factor out shared code 2016-09-29 16:42:01 +02:00
Oliver Schneider
f1c5bf2281
fix intrinsics and implement more of them 2016-09-29 15:58:26 +02:00
Oliver Schneider
5d1080d0ca
refactor Lvalue and PrimVal::{SlicePtr, VtablePtr} into Value::ByValPair 2016-09-26 17:49:30 +02:00
Oliver Schneider
fe614e342d
remove move_value, which is a dupe of write_value 2016-09-26 11:40:09 +02:00
Oliver Schneider
7714cccf26
implement "type_name" intrinsic 2016-09-23 10:38:30 +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
0f578f0d2e
fully implement size_of_val and add various tests that now succeed 2016-09-22 13:00:43 +02:00
Oliver Schneider
4ab704c57d
implement more intrinsics 2016-09-20 16:05:30 +02:00