Sync from rust 17c11672167827b0dd92c88ef69f24346d1286dd
This commit is contained in:
commit
86a71bf45b
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -223,9 +223,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "1.9.2"
|
version = "1.9.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
|
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"hashbrown 0.12.3",
|
"hashbrown 0.12.3",
|
||||||
|
@ -25,7 +25,7 @@ target-lexicon = "0.12.0"
|
|||||||
gimli = { version = "0.27.2", default-features = false, features = ["write"]}
|
gimli = { version = "0.27.2", default-features = false, features = ["write"]}
|
||||||
object = { version = "0.30.3", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
|
object = { version = "0.30.3", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
|
||||||
|
|
||||||
indexmap = "1.9.1"
|
indexmap = "1.9.3"
|
||||||
libloading = { version = "0.7.3", optional = true }
|
libloading = { version = "0.7.3", optional = true }
|
||||||
once_cell = "1.10.0"
|
once_cell = "1.10.0"
|
||||||
smallvec = "1.8.1"
|
smallvec = "1.8.1"
|
||||||
|
@ -54,12 +54,22 @@ pub(crate) fn codegen_tls_ref<'tcx>(
|
|||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
layout: TyAndLayout<'tcx>,
|
layout: TyAndLayout<'tcx>,
|
||||||
) -> CValue<'tcx> {
|
) -> CValue<'tcx> {
|
||||||
let data_id = data_id_for_static(fx.tcx, fx.module, def_id, false);
|
let tls_ptr = if !def_id.is_local() && fx.tcx.needs_thread_local_shim(def_id) {
|
||||||
let local_data_id = fx.module.declare_data_in_func(data_id, &mut fx.bcx.func);
|
let instance = ty::Instance {
|
||||||
if fx.clif_comments.enabled() {
|
def: ty::InstanceDef::ThreadLocalShim(def_id),
|
||||||
fx.add_comment(local_data_id, format!("tls {:?}", def_id));
|
substs: ty::InternalSubsts::empty(),
|
||||||
}
|
};
|
||||||
let tls_ptr = fx.bcx.ins().tls_value(fx.pointer_type, local_data_id);
|
let func_ref = fx.get_function_ref(instance);
|
||||||
|
let call = fx.bcx.ins().call(func_ref, &[]);
|
||||||
|
fx.bcx.func.dfg.first_result(call)
|
||||||
|
} else {
|
||||||
|
let data_id = data_id_for_static(fx.tcx, fx.module, def_id, false);
|
||||||
|
let local_data_id = fx.module.declare_data_in_func(data_id, &mut fx.bcx.func);
|
||||||
|
if fx.clif_comments.enabled() {
|
||||||
|
fx.add_comment(local_data_id, format!("tls {:?}", def_id));
|
||||||
|
}
|
||||||
|
fx.bcx.ins().tls_value(fx.pointer_type, local_data_id)
|
||||||
|
};
|
||||||
CValue::by_val(tls_ptr, layout)
|
CValue::by_val(tls_ptr, layout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user