rust/compiler/rustc_data_structures/src
bors 8cfa7b4ec9 Auto merge of #78588 - HeroicKatora:sccc, r=nikomatsakis
Reworks Sccc computation to iteration instead of recursion

Linear graphs, producing as many scc's as nodes, would recurse once for every node when entered from the start of the list. This adds a test that exhausted the stack at least on my machine with error:

```
thread 'graph::scc::tests::test_deep_linear' has overflowed its stack
fatal runtime error: stack overflow
```

This may or may not be connected to #78567. I was only reminded that I started this rework some time ago. It might be plausible as borrow checking a long function with many borrow regions around each other—((((((…))))))— may produce the linear list setup to trigger this stack overflow ? I don't know enough about borrow check to say for sure.

This is best read in two separate commits. The first addresses only `find_state` internally. This is classical union phase from union-find. There's also a common solution of using the parent pointers in the (virtual) linked list to track the backreferences while traversing upwards and then following them backwards in a second path compression phase.

The second is more involved as it rewrites the mutually recursive `walk_node` and `walk_unvisited_node`. Firstly, the caller is required to handle the unvisited case of `walk_node` so a new `start_walk_from` method is added to handle that by walking the unvisited node if necessary. Then `walk_unvisited_node`, where we would previously recurse into in the missing case, is rewritten to construct a manual stack of its frames. The state fields consist of the previous stack slots.
2020-11-21 01:30:26 +00:00
..
base_n mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
binary_search_util mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
graph Auto merge of #78588 - HeroicKatora:sccc, r=nikomatsakis 2020-11-21 01:30:26 +00:00
obligation_forest Turn Outcome into an opaque type to remove some runtime checks 2020-10-15 08:32:41 +02:00
owning_ref mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
sip128 SipHasher128: improve constant names and add more comments 2020-10-11 23:48:35 -07:00
small_c_str mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
snapshot_map mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
sorted_map mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
sso Fix even more clippy warnings 2020-10-30 10:13:39 -04:00
stable_hasher Stable hashing: add comments and tests concerning platform-independence 2020-09-30 00:57:35 -07:00
tagged_ptr Use T::BITS instead of size_of::<T> * 8. 2020-09-19 06:54:42 +02:00
tiny_list mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
transitive_relation mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
atomic_ref.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
base_n.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
box_region.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
captures.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
const_cstr.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
fingerprint.rs Make PackedFingerprint's Fingerprint private 2020-11-18 15:10:43 -08:00
flock.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
frozen.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
functor.rs words 2020-11-16 22:42:09 +01:00
fx.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
jobserver.rs datastructures: replace lazy_static by SyncLazy from std 2020-09-01 22:06:47 +01:00
lib.rs Set unaligned_references lint to deny in rustc_data_structures 2020-11-20 01:13:15 -08:00
macros.rs Remove unused static_assert macro 2020-09-20 11:40:51 +02:00
map_in_place.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
profiling.rs [self-profiling] Include the estimated size of each cgu in the profile 2020-11-03 07:55:17 -05:00
ptr_key.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
sharded.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
sip128.rs SipHasher128: improve constant names and add more comments 2020-10-11 23:48:35 -07:00
small_c_str.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
sorted_map.rs Replace absolute paths with relative ones 2020-10-13 14:16:45 +02:00
stable_hasher.rs Replace absolute paths with relative ones 2020-10-13 14:16:45 +02:00
stable_map.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
stable_set.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
stack.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
steal.rs Move Steal to rustc_data_structures. 2020-11-14 01:30:56 +01:00
svh.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
sync.rs Use RwLock instead of Lock for SourceMap::files 2020-10-29 18:09:53 +01:00
tagged_ptr.rs Fix typos 2020-10-29 16:51:46 +01:00
temp_dir.rs Capitalize safety comments 2020-09-08 22:37:18 -04:00
thin_vec.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
tiny_list.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
transitive_relation.rs Fix typos 2020-10-29 16:51:46 +01:00
unhash.rs Avoid rehashing Fingerprint as a map key 2020-09-01 18:27:02 -07:00
vec_linked_list.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
work_queue.rs Remove unused code from remaining compiler crates 2020-10-14 04:14:32 +02:00