Skip to content

Commit

Permalink
FunctionCx: Fix field usage in inline_asm and vtable modules
Browse files Browse the repository at this point in the history
  • Loading branch information
CohenArthur committed Aug 22, 2020
1 parent 429e75f commit 4cb2a2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/inline_asm.rs
Expand Up @@ -73,7 +73,7 @@ pub(crate) fn codegen_inline_asm<'tcx>(
let asm_name = format!("{}__inline_asm_{}", fx.codegen_cx.tcx.symbol_name(fx.instance).name, inline_asm_index);

let generated_asm = generate_asm_wrapper(&asm_name, InlineAsmArch::X86_64, options, template, clobbered_regs, &inputs, &outputs);
fx.global_asm.push_str(&generated_asm);
fx.codegen_cx.global_asm.push_str(&generated_asm);

call_inline_asm(fx, &asm_name, slot_size, inputs, outputs);
}
Expand Down
6 changes: 3 additions & 3 deletions src/vtable.rs
Expand Up @@ -72,11 +72,11 @@ pub(crate) fn get_vtable<'tcx>(
layout: TyAndLayout<'tcx>,
trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>,
) -> Value {
let data_id = if let Some(data_id) = fx.vtables.get(&(layout.ty, trait_ref)) {
let data_id = if let Some(data_id) = fx.codegen_cx.vtables.get(&(layout.ty, trait_ref)) {
*data_id
} else {
let data_id = build_vtable(fx, layout, trait_ref);
fx.vtables.insert((layout.ty, trait_ref), data_id);
fx.codegen_cx.vtables.insert((layout.ty, trait_ref), data_id);
data_id
};

Expand Down Expand Up @@ -142,7 +142,7 @@ fn build_vtable<'tcx>(
.map(|trait_ref| format!("{:?}", trait_ref.skip_binder()).into())
.unwrap_or(std::borrow::Cow::Borrowed("???")),
layout.ty,
fx.vtables.len(),
fx.codegen_cx.vtables.len(),
),
Linkage::Local,
false,
Expand Down

0 comments on commit 4cb2a2b

Please sign in to comment.