Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #62428

Merged
merged 35 commits into from
Jul 6, 2019
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
16b37b5
Update linked OpenSSL version
alexcrichton Jun 26, 2019
05f4a57
forward read_c_str method from Memory to Alloc
RalfJung Jun 30, 2019
2bad604
request at least ptr-size alignment from posix_memalign
RalfJung Jul 2, 2019
576369b
improve and deduplicate comments
RalfJung Jul 2, 2019
45e7ba9
test more possible overaligned requests
RalfJung Jul 2, 2019
2e47fc3
fix unused-import error on android
RalfJung Jul 3, 2019
830ff4a
remove StringReader::peek
matklad Jul 2, 2019
e9dc95c
remove peek_token from StringReader
matklad Jul 2, 2019
256df83
remove peek_span_src_raw from StringReader
matklad Jul 3, 2019
601bad8
cleanup lexer constructors
matklad Jul 3, 2019
30fa99e
move constructors to top
matklad Jul 3, 2019
1c6eb19
slightly comment lexer API
matklad Jul 3, 2019
8bea334
don't rely on spans when checking tokens for jointness
matklad Jul 3, 2019
3035a05
remove unused mk_sp_and_raw
matklad Jul 3, 2019
3e362a4
make unwrap_or_abort non-generic again
matklad Jul 3, 2019
8ad28cd
Machine: make self-like parameters come first
RalfJung Jul 2, 2019
127610b
Go back to just passing MemoryExtra to the machine-level allocation h…
RalfJung Jul 2, 2019
1297a27
Add basic support for "other" kinds of values for function pointers, …
RalfJung Jun 30, 2019
5612feb
add machine hook to handle calls to 'extra' function values
RalfJung Jun 30, 2019
486720f
fix determinig the size of foreign static allocations
RalfJung Jun 30, 2019
b4be08a
fix for tidy
RalfJung Jun 30, 2019
842bbd2
make Memory::get_fn take a Scalar like most of the Memory API surface
RalfJung Jul 1, 2019
956a3ef
more inlining
RalfJung Jul 2, 2019
52e6f85
organize methods a bit better
RalfJung Jul 2, 2019
317c6ac
use get_size_and_align to test if an allocation is live
RalfJung Jul 1, 2019
d9d6b3b
turns out that dangling pointer branch is dead code; remove it and im…
RalfJung Jul 1, 2019
ceb496c
improve validity error range printing for singleton ranges
RalfJung Jul 1, 2019
12672e2
Add test for ICE #62375
wesleywiser Jul 4, 2019
a8f8c7c
Rollup merge of #62151 - alexcrichton:update-openssl, r=Mark-Simulacrum
Centril Jul 6, 2019
182248a
Rollup merge of #62245 - RalfJung:miri-extra-fn, r=eddyb,zackmdavis
Centril Jul 6, 2019
947d7cf
Rollup merge of #62257 - RalfJung:miri-c-str, r=estebank
Centril Jul 6, 2019
0383be8
Rollup merge of #62264 - RalfJung:inline-forcing, r=zackmdavis
Centril Jul 6, 2019
3c4a6c8
Rollup merge of #62296 - RalfJung:memalign, r=alexcrichton
Centril Jul 6, 2019
952ee77
Rollup merge of #62329 - matklad:no-peeking, r=petrochenkov
Centril Jul 6, 2019
46edb51
Rollup merge of #62377 - wesleywiser:fix_62375, r=alexcrichton
Centril Jul 6, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions src/librustc_mir/interpret/memory.rs
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ use std::collections::VecDeque;
use std::ptr;
use std::borrow::Cow;

use rustc::ty::{self, Instance, query::TyCtxtAt};
use rustc::ty::{self, Instance, ParamEnv, query::TyCtxtAt};
use rustc::ty::layout::{Align, TargetDataLayout, Size, HasDataLayout};
use rustc_data_structures::fx::{FxHashSet, FxHashMap};

@@ -536,19 +536,33 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
) -> InterpResult<'static, (Size, Align)> {
// Regular allocations.
if let Ok(alloc) = self.get(id) {
Ok((Size::from_bytes(alloc.bytes.len() as u64), alloc.align))
return Ok((Size::from_bytes(alloc.bytes.len() as u64), alloc.align));
}
// Function pointers.
else if let Ok(_) = self.get_fn_alloc(id) {
if let AllocCheck::Dereferencable = liveness {
if let Ok(_) = self.get_fn_alloc(id) {
return if let AllocCheck::Dereferencable = liveness {
// The caller requested no function pointers.
err!(DerefFunctionPointer)
} else {
Ok((Size::ZERO, Align::from_bytes(1).unwrap()))
};
}
// Foreign statics.
// Can't do this in the match argument, we may get cycle errors since the lock would
// be held throughout the match.
let alloc = self.tcx.alloc_map.lock().get(id);
match alloc {
Some(GlobalAlloc::Static(did)) => {
assert!(self.tcx.is_foreign_item(did));
// Use size and align of the type
let ty = self.tcx.type_of(did);
let layout = self.tcx.layout_of(ParamEnv::empty().and(ty)).unwrap();
return Ok((layout.size, layout.align.abi));
}
_ => {}
}
// The rest must be dead.
else if let AllocCheck::MaybeDead = liveness {
if let AllocCheck::MaybeDead = liveness {
// Deallocated pointers are allowed, we should be able to find
// them in the map.
Ok(*self.dead_alloc_map.get(&id)