152 Commits

Author SHA1 Message Date
Santiago Pastorino
5d9b399044 Remove PlaceBase enum and make Place base field be local: Local 2020-01-10 09:08:25 +01:00
Santiago Pastorino
fd5aa32c35 Remove Static from PlaceBase 2020-01-10 09:08:24 +01:00
Santiago Pastorino
9e70c47783 Remove unused param_env parameter 2020-01-10 09:08:24 +01:00
Matthew Jasper
9462c8babb Improve hygiene of newtype_index
Also add unit tests
2020-01-06 20:43:10 +00:00
Mark Rousskov
a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Mark Mansi
02d93bd703 more private 2019-12-11 21:35:51 -06:00
Mark Mansi
697853117f fix imports 2019-12-11 21:35:50 -06:00
Paul Daniel Faria
b2fe254c98 Remove HasLocalDecls impl from BodyCache's, properly reborrow to Body, rename all body_cache back to body 2019-12-02 08:40:56 -05:00
Paul Daniel Faria
f534d9f8c4 Stop invalidating predecessors cache when accessing unique basic block, invalidate cache when accessing unique terminator 2019-12-02 08:30:30 -05:00
Matthew Jasper
9abc34ed9d Track pointers to statics in MIR 2019-11-21 20:55:17 +00:00
csmoe
64f61c7888 remove indexed_vec re-export from rustc_data_structures 2019-09-29 16:48:31 +00:00
csmoe
d20183dbbf remove bit_set re-export from rustc_data_structures 2019-09-29 16:11:30 +00:00
Santiago Pastorino
87420cd1bc
Make Place Boxed on Statement to reduce size from 64 bytes to 32 bytes 2019-09-11 16:28:06 -03:00
Santiago Pastorino
e9c41148c0
Convert Place's projection to a boxed slice 2019-09-09 18:16:49 -03:00
Matthew Jasper
c621919deb Kill borrows from assignments after generating new borrows 2019-08-31 15:35:20 +01:00
Oliver Scherer
7710820d18 Fiddle param env through to try_eval_bits in most places 2019-08-05 17:48:05 +02:00
Santiago Pastorino
d0accade3e Migrate from Place enum to Place struct 2019-07-20 05:08:38 +02:00
Santiago Pastorino
099f9e4e8a Implement From<Local> for Place and PlaceBase 2019-06-25 15:46:23 +02:00
Dylan MacKenzie
c8cbd4fc78 Merge BitSetOperator and InitialFlow into one trait.
Since the value of `InitialFlow` defines the semantics of the `join`
operation, there's no reason to have seperate traits for each. We can
add a default impl of `join` which branches based on `BOTTOM_VALUE`.
This should get optimized away.
2019-06-22 10:18:19 -07:00
Dylan MacKenzie
c054186ec7 rustc_mir: don't pass on_entry when building transfer functions.
This commit makes `sets.on_entry` inaccessible in
`{before_,}{statement,terminator}_effect`. This field was meant to allow
implementors of `BitDenotation` to access the initial state for each
block (optionally with the effect of all previous statements applied via
`accumulates_intrablock_state`) while defining transfer functions.
However, the ability to set the initial value for the entry set of each
basic block (except for START_BLOCK) no longer exists. As a result, this
functionality is mostly useless, and when it *was* used it was used
erroneously (see #62007).

Since `on_entry` is now useless, we can also remove `BlockSets`, which
held the `gen`, `kill`, and `on_entry` bitvectors and replace it with a
`GenKill` struct. Variables of this type are called `trans` since they
represent a transfer function. `GenKill`s are stored contiguously in
`AllSets`, which reduces the number of bounds checks and may improve
cache performance: one is almost never accessed without the other.

Replacing `BlockSets` with `GenKill` allows us to define some new helper
functions which streamline dataflow iteration and the
dataflow-at-location APIs. Notably, `state_for_location` used a subtle
side-effect of the `kill`/`kill_all` setters to apply the transfer
function, and could be incorrect if a transfer function depended on
effects of previous statements in the block on `gen_set`.
2019-06-22 10:18:19 -07:00
Dylan MacKenzie
f045008f94 Kill conflicting borrows of places with projections.
Resolves #62007.

Due to a bug, the previous version of this check did not actually kill
any conflicting borrows unless the borrowed place had no projections.
Specifically, `entry_set` will always be empty when `statement_effect`
is called. It does not contain the set of borrows which are live at this
point in the program.
2019-06-20 16:30:43 -07:00
Eduard-Mihai Burtescu
b25b466a88 rustc: remove 'x: 'y bounds (except from comments/strings). 2019-06-18 18:10:21 +03:00
Eduard-Mihai Burtescu
f3f9d6dfd9 Unify all uses of 'gcx and 'tcx. 2019-06-14 18:58:23 +03:00
Eduard-Mihai Burtescu
17cdd356da rustc: replace TyCtxt<'tcx, 'gcx, 'tcx> with TyCtxt<'gcx, 'tcx>. 2019-06-12 13:38:27 +03:00
Eduard-Mihai Burtescu
37799a5552 rustc: replace TyCtxt<'a, 'gcx, 'tcx> with TyCtxt<'tcx, 'gcx, 'tcx>. 2019-06-12 13:38:27 +03:00
Jad Ghalayini
80ff07f30d Changed usages of mir in librustc::mir and librustc_mir to body 2019-06-09 16:05:05 -04:00
Claude-Alban RANÉLY-VERGÉ-DÉPRÉ
6e5e0daff2 Changes the type mir::Mir into mir::Body
The commit should have changed comments as well.
At the time of writting, it passes the tidy and check tool.

Revisions asked by eddyb :
- Renamed of all the occurences of {visit/super}_mir
- Renamed test structures `CachedMir` to `Cached`

Fixing the missing import on `AggregateKind`
2019-05-28 19:17:51 +02:00
bors
e4c66afba5 Auto merge of #59612 - matthewjasper:dataflow-usual-newtype-index, r=estebank
Use normal newtype_index macro for MIR dataflows

* Makes the definition of these structs contain `struct IndexName`
* Avoids having an offset by removing high values, rather than 0
* Implements some traits for us.
2019-04-13 16:42:51 +00:00
Nicholas Nethercote
d00d639c54 Shrink mir::Statement.
The `InlineAsm` variant is extremely rare, and `mir::Statement` often
contributes significantly to peak memory usage.
2019-04-03 09:09:59 +11:00
Matthew Jasper
9eb6f32d45 Use normal newtype_index macro for MIR dataflow 2019-04-01 19:38:00 +01:00
Santiago Pastorino
0f993d5a7a Put Local, Static and Promoted as one Base variant of Place 2019-03-01 05:02:00 +01:00
Taiki Endo
725af30809 librustc_mir => 2018 2019-02-08 06:28:15 +09:00
Matthew Jasper
6fe370c7ce Pass correct arguments to places_conflict
The borrow place *must* be a place that we track borrows for, otherwise
we will likely ICE.
2019-01-30 19:49:31 +00:00
Matthew Jasper
2149d73358 Remove unnecessary borrow generation 2018-12-28 23:39:14 +00:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
bors
4755e2f3b6 Auto merge of #56741 - RalfJung:retag-to-raw, r=oli-obk
treat ref-to-raw cast like a reborrow: do a special kind of retag

r? @oli-obk

Cc @nikomatsakis
2018-12-20 09:58:10 +00:00
bors
817dda7df0 Auto merge of #56649 - davidtwco:issue-46589, r=pnkfelix
MIR borrowck doesn't accept the example of iterating and updating a mutable reference

Fixes #46589.

r? @pnkfelix or @nikomatsakis
2018-12-20 07:22:15 +00:00
Ralf Jung
c1160a8f86 treat ref-to-raw cast like a reborrow: do a special kind of retag 2018-12-18 09:56:31 +01:00
David Wood
7b628e18a3
Add required lifetime parameter to BitDenotation.
This avoids all sorts of confusing issues with using both `dest_place`
and `self` in the `propagate_call_return` function in the
`BitDenotation` implementation for `Borrows`.
2018-12-17 17:26:24 +01:00
David Wood
db635fc566
Kill borrows from a projection after assignment.
This commit extends previous work to kill borrows from a local after
assignment into that local to kill borrows from a projection after
assignment into a prefix of that place.
2018-12-17 14:49:52 +01:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
Matthew Jasper
4f5b8eace1 Remove the region_map field from BorrowSet 2018-11-30 21:48:31 +00:00
Matthew Jasper
6027e0810f Only handle ReVar regions in NLL borrowck
Now that lexical MIR borrowck is gone, there's no need to store Regions
unnecessarily.
2018-11-18 11:05:19 +00:00
Matthew Jasper
b16985a354 Remove mir::StatementKind::EndRegion
Since lexical MIR borrow check is gone, and validation no longer uses
these, they can be removed.
2018-11-18 11:05:19 +00:00
Ralf Jung
f27cd60ae1 no more action on ref or cast, but add new MIR statement for escaping a ptr to raw 2018-11-07 16:54:31 +01:00
Ralf Jung
aafcf2c942 Emit Retag statements, kill Validate statements
Also "rename" -Zmir-emit-validate to -Zmir-emit-retag, which is just a boolean (yes or no).
2018-10-29 09:05:18 +01:00
Wesley Wiser
c535147f29 Replace the run_passes! macro with a regular function
As suggested in the feedback for #55244.

When I replaced the macro with a function, rustc started complaining
that there were two unused functions so I also removed those.
2018-10-22 22:45:36 -04:00
Oliver Scherer
ee81739dc1 Deprecate the FxHashMap() and FxHashSet() constructor function hack 2018-10-19 14:34:44 +02:00
Nicholas Nethercote
a577f900a9 Shrink StatementKind::Assign.
This shrinks StatementKind from 80 bytes to 64 bytes on 64-bit.
2018-09-24 18:45:37 +10:00
Remy Rakic
f5e310530a Refactor 'ReadForMatch' into 'FakeRead' and add the cause of the fake read 2018-09-18 14:36:37 +02:00