1
Fork 0

don't allocate for primvals

This commit is contained in:
Oliver Schneider 2017-02-15 11:00:29 +01:00
parent 2282e6b582
commit e2c5a6e64e
No known key found for this signature in database
GPG key ID: A69F8D225B3AD7D9

View file

@ -219,8 +219,12 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
(ptr, LvalueExtra::None)
},
Value::ByVal(PrimVal::Undef) => {
// FIXME: add some logic for when to not allocate
(self.force_allocation(base)?.to_ptr(), LvalueExtra::None)
// FIXME: allocate in fewer cases
if self.ty_to_primval_kind(base_ty).is_ok() {
return Ok(base);
} else {
(self.force_allocation(base)?.to_ptr(), LvalueExtra::None)
}
},
Value::ByVal(_) => {
assert_eq!(field_index, 0, "ByVal can only have 1 non zst field with offset 0");