From 311b406bf90a8244a39a8eff933c7fce45b9c7f2 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Wed, 15 May 2019 20:35:44 +0800 Subject: standalone_miri - Fiddling for 1.29 support (not working yet) --- tools/standalone_miri/value.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tools/standalone_miri/value.cpp') diff --git a/tools/standalone_miri/value.cpp b/tools/standalone_miri/value.cpp index 9007eb5c..0b3aa988 100644 --- a/tools/standalone_miri/value.cpp +++ b/tools/standalone_miri/value.cpp @@ -13,6 +13,38 @@ #include #include "debug.hpp" +FfiLayout FfiLayout::new_const_bytes(size_t s) +{ + return FfiLayout { + { Range {s, true, false} } + }; +} +bool FfiLayout::is_valid_read(size_t o, size_t s) const +{ + for(const auto& r : ranges) + { + if( o < r.len ) { + if( !r.is_valid ) + return false; + if( o + s <= r.len ) + { + s = 0; + break; + } + s -= (r.len - o); + o = 0; + } + else { + o -= r.len; + } + } + if( s > 0 ) + { + return false; + } + return true; +} + AllocationHandle Allocation::new_alloc(size_t size) { Allocation* rv = new Allocation(); -- cgit v1.2.3