diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2011-08-30 13:50:48 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2011-08-30 13:50:48 -0700 |
| commit | 05d96f155f8bc6eec0e9f3485b47698fb858aa72 (patch) | |
| tree | 4814c9ecf2134338210e1010d337231aade4699d /src/rt/rust_shape.cpp | |
| parent | 7bbe8d2e8c61165d539a9e4d916566a57f59d708 (diff) | |
| download | rust-05d96f155f8bc6eec0e9f3485b47698fb858aa72.tar.gz rust-05d96f155f8bc6eec0e9f3485b47698fb858aa72.zip | |
rustc: Allow non-type-parametric resources to be logged
Diffstat (limited to 'src/rt/rust_shape.cpp')
| -rw-r--r-- | src/rt/rust_shape.cpp | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/src/rt/rust_shape.cpp b/src/rt/rust_shape.cpp index e80512b92a0..71a11a7d758 100644 --- a/src/rt/rust_shape.cpp +++ b/src/rt/rust_shape.cpp @@ -111,23 +111,42 @@ print::walk_struct(bool align, const uint8_t *end_sp) { void print::walk_res(bool align, const rust_fn *dtor, uint16_t n_ty_params, - const uint8_t *ty_params_sp) { + const uint8_t *ty_params_sp, const uint8_t *end_sp) { DPRINT("res@%p", dtor); - if (!n_ty_params) + + // Print type parameters. + if (n_ty_params) { + DPRINT("<"); + + bool first = true; + for (uint16_t i = 0; i < n_ty_params; i++) { + if (!first) + DPRINT(","); + first = false; + get_u16_bump(sp); // Skip over the size. + walk(align); + } + + DPRINT(">"); + } + + // Print arguments. + + if (sp == end_sp) return; - DPRINT("<"); + DPRINT("("); bool first = true; - for (uint16_t i = 0; i < n_ty_params; i++) { + while (sp != end_sp) { if (!first) DPRINT(","); first = false; - get_u16_bump(sp); // Skip over the size. + walk(align); } - DPRINT(">"); + DPRINT(")"); } void @@ -328,7 +347,8 @@ public: const data_pair<uint32_t> &tag_variants); void walk_struct(bool align, const uint8_t *end_sp); void walk_res(bool align, const rust_fn *dtor, uint16_t n_ty_params, - const uint8_t *ty_params_sp); + const uint8_t *ty_params_sp, const uint8_t *end_sp, + const data_pair<uintptr_t> &live); void walk_variant(bool align, tag_info &tinfo, uint32_t variant_id, const std::pair<const uint8_t *,const uint8_t *> variant_ptr_and_end); @@ -380,7 +400,8 @@ cmp::walk_struct(bool align, const uint8_t *end_sp) { void cmp::walk_res(bool align, const rust_fn *dtor, uint16_t n_ty_params, - const uint8_t *ty_params_sp) { + const uint8_t *ty_params_sp, const uint8_t *end_sp, + const data_pair<uintptr_t> &live) { abort(); // TODO } @@ -480,6 +501,28 @@ log::walk_variant(bool align, tag_info &tinfo, uint32_t variant_id, out << ")"; } +void +log::walk_res(bool align, const rust_fn *dtor, uint16_t n_ty_params, + const uint8_t *ty_params_sp, const uint8_t *end_sp, + bool live) { + out << "res"; + + if (this->sp == end_sp) + return; + + out << "("; + + bool first = true; + while (sp != end_sp) { + if (!first) + out << ", "; + walk(align); + align = true, first = false; + } + + out << ")"; +} + } // end namespace shape extern "C" void |
