Skip to content

Commit

Permalink
Fixup remaining direct relocation field references
Browse files Browse the repository at this point in the history
  • Loading branch information
HeroicKatora committed Aug 30, 2019
1 parent bee2d37 commit 7388cb4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/librustc_codegen_llvm/consts.rs
Expand Up @@ -25,12 +25,12 @@ use rustc::hir::{self, CodegenFnAttrs, CodegenFnAttrFlags};
use std::ffi::{CStr, CString};

pub fn const_alloc_to_llvm(cx: &CodegenCx<'ll, '_>, alloc: &Allocation) -> &'ll Value {
let mut llvals = Vec::with_capacity(alloc.relocations.len() + 1);
let mut llvals = Vec::with_capacity(alloc.relocations().len() + 1);
let dl = cx.data_layout();
let pointer_size = dl.pointer_size.bytes() as usize;

let mut next_offset = 0;
for &(offset, ((), alloc_id)) in alloc.relocations.iter() {
for &(offset, ((), alloc_id)) in alloc.relocations().iter() {
let offset = offset.bytes();
assert_eq!(offset as usize as u64, offset);
let offset = offset as usize;
Expand Down Expand Up @@ -455,7 +455,7 @@ impl StaticMethods for CodegenCx<'ll, 'tcx> {
//
// We could remove this hack whenever we decide to drop macOS 10.10 support.
if self.tcx.sess.target.target.options.is_like_osx {
assert_eq!(alloc.relocations.len(), 0);
assert_eq!(alloc.relocations().len(), 0);

let is_zeroed = {
// Treats undefined bytes as if they were defined with the byte value that
Expand Down Expand Up @@ -490,7 +490,7 @@ impl StaticMethods for CodegenCx<'ll, 'tcx> {
section.as_str().as_ptr() as *const _,
section.as_str().len() as c_uint,
);
assert!(alloc.relocations.is_empty());
assert!(alloc.relocations().is_empty());

// The `inspect` method is okay here because we checked relocations, and
// because we are doing this access to inspect the final interpreter state (not
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_mir/interpret/snapshot.rs
Expand Up @@ -287,7 +287,6 @@ impl<'a, Ctx> Snapshot<'a, Ctx> for &'a Allocation

fn snapshot(&self, ctx: &'a Ctx) -> Self::Item {
let Allocation {
relocations,
size,
align,
mutability,
Expand All @@ -300,7 +299,9 @@ impl<'a, Ctx> Snapshot<'a, Ctx> for &'a Allocation
// influence interpreter exeuction, but only to detect the error of cycles in evalution
// dependencies.
let bytes = self.inspect_with_undef_and_ptr_outside_interpreter(all_bytes);

let undef_mask = self.undef_mask();
let relocations = self.relocations();

AllocationSnapshot {
bytes,
Expand Down

0 comments on commit 7388cb4

Please sign in to comment.