diff options
| author | Oliver Schneider <git-no-reply-9879165716479413131@oli-obk.de> | 2018-04-11 13:31:37 +0200 |
|---|---|---|
| committer | Oliver Schneider <git-no-reply-9879165716479413131@oli-obk.de> | 2018-04-14 12:21:46 +0200 |
| commit | 04b3ab67d9d30a292e94d3875e5b7ee46fbdb563 (patch) | |
| tree | be0531a7747a90b32043e30b5b31f4949901b975 /src/librustc_metadata/encoder.rs | |
| parent | 6f251c2a0318cc4b61c7f9e96113d2e31175d8fc (diff) | |
| download | rust-04b3ab67d9d30a292e94d3875e5b7ee46fbdb563.tar.gz rust-04b3ab67d9d30a292e94d3875e5b7ee46fbdb563.zip | |
Encode items before encoding the list of AllocIds
Diffstat (limited to 'src/librustc_metadata/encoder.rs')
| -rw-r--r-- | src/librustc_metadata/encoder.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index d6c673f550d..5ecfbd7c6fb 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -445,12 +445,24 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { let tcx = self.tcx; + // Encode the items. + i = self.position(); + let items = self.encode_info_for_items(); + let item_bytes = self.position() - i; + // Encode the allocation index let interpret_alloc_index = { let mut interpret_alloc_index = Vec::new(); let mut n = 0; + trace!("beginning to encode alloc ids"); loop { let new_n = self.interpret_alloc_ids.len(); + // if we have found new ids, serialize those, too + if n == new_n { + // otherwise, abort + break; + } + trace!("encoding {} further alloc ids", new_n - n); for idx in n..new_n { let id = self.interpret_allocs_inverse[idx]; let pos = self.position() as u32; @@ -461,21 +473,12 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { id, ).unwrap(); } - // if we have found new ids, serialize those, too - if n == new_n { - // otherwise, abort - break; - } n = new_n; } self.lazy_seq(interpret_alloc_index) }; - // Encode and index the items. - i = self.position(); - let items = self.encode_info_for_items(); - let item_bytes = self.position() - i; - + // Index the items i = self.position(); let index = items.write_index(&mut self.opaque.cursor); let index_bytes = self.position() - i; |
