Commit Graph

18 Commits

Author SHA1 Message Date
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