Implement vtable_size and vtable_align intrinsics for cg_clif

This commit is contained in:
bjorn3 2022-07-20 13:36:58 +00:00 committed by Ralf Jung
parent 6c9abfa0f3
commit f8feed7d27

View File

@ -431,6 +431,16 @@ fn codegen_regular_intrinsic_call<'tcx>(
ret.write_cvalue(fx, CValue::by_val(align, usize_layout)); ret.write_cvalue(fx, CValue::by_val(align, usize_layout));
}; };
vtable_size, (v vtable) {
let size = crate::vtable::size_of_obj(fx, vtable);
ret.write_cvalue(fx, CValue::by_val(size, usize_layout));
};
vtable_align, (v vtable) {
let align = crate::vtable::min_align_of_obj(fx, vtable);
ret.write_cvalue(fx, CValue::by_val(align, usize_layout));
};
unchecked_add | unchecked_sub | unchecked_mul | unchecked_div | exact_div | unchecked_rem unchecked_add | unchecked_sub | unchecked_mul | unchecked_div | exact_div | unchecked_rem
| unchecked_shl | unchecked_shr, (c x, c y) { | unchecked_shl | unchecked_shr, (c x, c y) {
// FIXME trap on overflow // FIXME trap on overflow