Jan Voung | f76fd37 | 2014-10-16 15:39:22 -0700 | [diff] [blame] | 1 | //===- subzero/src/IceMemoryRegion.cpp - Memory region --------------------===// |
Jan Voung | 8acded0 | 2014-09-22 18:02:25 -0700 | [diff] [blame] | 2 | // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 3 | // for details. All rights reserved. Use of this source code is governed by a |
| 4 | // BSD-style license that can be found in the LICENSE file. |
| 5 | // |
| 6 | // Modified by the Subzero authors. |
| 7 | // |
Jan Voung | f76fd37 | 2014-10-16 15:39:22 -0700 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Jan Voung | 8acded0 | 2014-09-22 18:02:25 -0700 | [diff] [blame] | 9 | // |
| 10 | // The Subzero Code Generator |
| 11 | // |
| 12 | // This file is distributed under the University of Illinois Open Source |
| 13 | // License. See LICENSE.TXT for details. |
| 14 | // |
| 15 | //===----------------------------------------------------------------------===// |
| 16 | // |
| 17 | // This file defines the MemoryRegion class. It tracks a pointer plus its |
| 18 | // bounds for bounds-checking in debug mode. |
| 19 | //===----------------------------------------------------------------------===// |
| 20 | |
| 21 | #include "IceMemoryRegion.h" |
| 22 | |
| 23 | namespace Ice { |
| 24 | |
| 25 | void MemoryRegion::CopyFrom(uintptr_t offset, const MemoryRegion &from) const { |
| 26 | assert(from.pointer() != NULL && from.size() > 0); |
| 27 | assert(this->size() >= from.size()); |
| 28 | assert(offset <= this->size() - from.size()); |
| 29 | memmove(reinterpret_cast<void *>(start() + offset), from.pointer(), |
| 30 | from.size()); |
| 31 | } |
| 32 | |
| 33 | } // end of namespace Ice |