1
Fork 0

Move vtable_size and vtable_align impls to cg_ssa

This commit is contained in:
bjorn3 2022-07-20 13:40:30 +00:00 committed by Ralf Jung
parent 1afea1f86a
commit 399e020b96
2 changed files with 10 additions and 11 deletions

View file

@ -3,6 +3,7 @@ use super::place::PlaceRef;
use super::FunctionCx;
use crate::common::{span_invalid_monomorphization_error, IntPredicate};
use crate::glue;
use crate::meth;
use crate::traits::*;
use crate::MemFlags;
@ -102,6 +103,15 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
bx.const_usize(bx.layout_of(tp_ty).align.abi.bytes())
}
}
sym::vtable_size | sym::vtable_align => {
let vtable = args[0].immediate();
let idx = match name {
sym::vtable_size => ty::COMMON_VTABLE_ENTRIES_SIZE,
sym::vtable_align => ty::COMMON_VTABLE_ENTRIES_ALIGN,
_ => bug!(),
};
meth::VirtualIndex::from_index(idx).get_usize(bx, vtable)
}
sym::pref_align_of
| sym::needs_drop
| sym::type_id