diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2011-08-17 18:14:47 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2011-08-17 18:14:57 -0700 |
| commit | f17edf9829e88090445a7f8b3e74979ca08ecfa0 (patch) | |
| tree | fd90dd7fc3cbba3c4aa6efd9cb64525bb359807c /src/rt/rust_shape.cpp | |
| parent | 0b7af403843d54c3200f8f9accbd2b279d6a7a0c (diff) | |
| download | rust-f17edf9829e88090445a7f8b3e74979ca08ecfa0.tar.gz rust-f17edf9829e88090445a7f8b3e74979ca08ecfa0.zip | |
rustc: Use obstacks in lieu of dynamically-allocated frames only when the frame is actually dynamically-sized
Diffstat (limited to 'src/rt/rust_shape.cpp')
| -rw-r--r-- | src/rt/rust_shape.cpp | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/rt/rust_shape.cpp b/src/rt/rust_shape.cpp index c23d3aaa858..e5b96e7e91f 100644 --- a/src/rt/rust_shape.cpp +++ b/src/rt/rust_shape.cpp @@ -64,18 +64,6 @@ const uint8_t CMP_LT = 1u; const uint8_t CMP_LE = 2u; -// Utility functions - -// Rounds |size| to the nearest |alignment|. Invariant: |alignment| is a power -// of two. -template<typename T> -static inline T -align_to(T size, size_t alignment) { - assert(alignment); - T x = (T)(((uintptr_t)size + alignment - 1) & ~(alignment - 1)); - return x; -} - // Utility classes struct size_align { @@ -185,11 +173,18 @@ public: } }; -inline ptr_pair -align_to(const ptr_pair &pair, size_t n) { - return ptr_pair::make(align_to(pair.fst, n), align_to(pair.snd, n)); +} // end namespace shape + + +inline shape::ptr_pair +align_to(const shape::ptr_pair &pair, size_t n) { + return shape::ptr_pair::make(align_to(pair.fst, n), + align_to(pair.snd, n)); } + +namespace shape { + // NB: This function does not align. template<typename T> inline data_pair<T> |
