Auto merge of #97905 - nnethercote:revert-infallible-encoder, r=bjorn3
Revert part of #94372 to improve performance #94732 was supposed to give small but widespread performance improvements, as judged from three per-merge performance runs. But the performance run that occurred after merging included a roughly equal number of improvements and regressions, for unclear reasons. This PR is for a test run reverting those changes, to see what happens. r? `@ghost`
This commit is contained in:
commit
c84594661c
25 changed files with 250 additions and 173 deletions
|
@ -29,8 +29,7 @@ use rustc_middle::dep_graph::WorkProduct;
|
|||
use rustc_middle::middle::dependency_format::Dependencies;
|
||||
use rustc_middle::middle::exported_symbols::SymbolExportKind;
|
||||
use rustc_middle::ty::query::{ExternProviders, Providers};
|
||||
use rustc_serialize::opaque::{MemDecoder, MemEncoder};
|
||||
use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
|
||||
use rustc_serialize::{opaque, Decodable, Decoder, Encodable, Encoder};
|
||||
use rustc_session::config::{CrateType, OutputFilenames, OutputType, RUST_CGU_EXT};
|
||||
use rustc_session::cstore::{self, CrateSource};
|
||||
use rustc_session::utils::NativeLibKind;
|
||||
|
@ -204,14 +203,14 @@ const RUSTC_VERSION: Option<&str> = option_env!("CFG_VERSION");
|
|||
|
||||
impl CodegenResults {
|
||||
pub fn serialize_rlink(codegen_results: &CodegenResults) -> Vec<u8> {
|
||||
let mut encoder = MemEncoder::new();
|
||||
let mut encoder = opaque::Encoder::new();
|
||||
encoder.emit_raw_bytes(RLINK_MAGIC);
|
||||
// `emit_raw_bytes` is used to make sure that the version representation does not depend on
|
||||
// Encoder's inner representation of `u32`.
|
||||
encoder.emit_raw_bytes(&RLINK_VERSION.to_be_bytes());
|
||||
encoder.emit_str(RUSTC_VERSION.unwrap());
|
||||
Encodable::encode(codegen_results, &mut encoder);
|
||||
encoder.finish()
|
||||
encoder.finish().unwrap()
|
||||
}
|
||||
|
||||
pub fn deserialize_rlink(data: Vec<u8>) -> Result<Self, String> {
|
||||
|
@ -231,7 +230,7 @@ impl CodegenResults {
|
|||
return Err(".rlink file was produced with encoding version {version_array}, but the current version is {RLINK_VERSION}".to_string());
|
||||
}
|
||||
|
||||
let mut decoder = MemDecoder::new(&data[4..], 0);
|
||||
let mut decoder = opaque::Decoder::new(&data[4..], 0);
|
||||
let rustc_version = decoder.read_str();
|
||||
let current_version = RUSTC_VERSION.unwrap();
|
||||
if rustc_version != current_version {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue