rustc: Implement simple interior vector append translation

This commit is contained in:
Patrick Walton
2011-06-13 18:52:04 -07:00
parent a1bb4a4ded
commit c3bf7d07e9
6 changed files with 305 additions and 35 deletions

View File

@@ -185,6 +185,30 @@ rust_vec : public rc_base<rust_vec>
// Rust types vec and str look identical from our perspective.
typedef rust_vec rust_str;
// Interior vectors (rust-user-code level).
struct
rust_ivec_heap
{
size_t fill;
uint8_t data[];
};
union
rust_ivec_payload
{
uint8_t data[]; // if on stack
struct rust_ivec_heap *ptr; // if on heap
};
struct
rust_ivec
{
size_t fill; // in bytes; if zero, heapified
size_t alloc; // in bytes
rust_ivec_payload payload;
};
//
// Local Variables:
// mode: C++