Improve/add comments
This commit is contained in:
parent
e89908231b
commit
50be80b22d
2 changed files with 3 additions and 2 deletions
|
@ -80,8 +80,7 @@ pub struct CodegenCx<'ll, 'tcx> {
|
||||||
pub isize_ty: &'ll Type,
|
pub isize_ty: &'ll Type,
|
||||||
|
|
||||||
/// Cache for the mapping from source index to llvm index for struct fields,
|
/// Cache for the mapping from source index to llvm index for struct fields,
|
||||||
/// necessary because the mapping depends on padding and thus depens on
|
/// only present if synthetic fields are inserted for padding.
|
||||||
/// TyAndLayout.
|
|
||||||
pub field_projection_cache: RefCell<FxHashMap<TyAndLayout<'tcx>, Vec<u32>>>,
|
pub field_projection_cache: RefCell<FxHashMap<TyAndLayout<'tcx>, Vec<u32>>>,
|
||||||
|
|
||||||
pub coverage_cx: Option<coverageinfo::CrateCoverageContext<'ll, 'tcx>>,
|
pub coverage_cx: Option<coverageinfo::CrateCoverageContext<'ll, 'tcx>>,
|
||||||
|
|
|
@ -363,6 +363,8 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
|
||||||
|
|
||||||
FieldsShape::Array { .. } => index as u64,
|
FieldsShape::Array { .. } => index as u64,
|
||||||
|
|
||||||
|
// Look up llvm field index in projection cache if present. If no projection cache
|
||||||
|
// is present no padding is used and the llvm field index matches the memory index.
|
||||||
FieldsShape::Arbitrary { .. } => match cx.field_projection_cache.borrow().get(self) {
|
FieldsShape::Arbitrary { .. } => match cx.field_projection_cache.borrow().get(self) {
|
||||||
Some(projection) => projection[index] as u64,
|
Some(projection) => projection[index] as u64,
|
||||||
None => self.fields.memory_index(index) as u64,
|
None => self.fields.memory_index(index) as u64,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue