diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2011-08-24 16:54:10 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2011-08-24 16:54:10 -0700 |
| commit | b371891c7c35f5d561a4847515e41014c652fa26 (patch) | |
| tree | 7971cdd95273381c5bfd03e6bca3a2712e8e717c /src/rt/rust_shape.cpp | |
| parent | 72d78e6a93829703f64bd59f502410bebe64ae91 (diff) | |
| download | rust-b371891c7c35f5d561a4847515e41014c652fa26.tar.gz rust-b371891c7c35f5d561a4847515e41014c652fa26.zip | |
rt: Fix walk_obj_contents for type-parameteric objects. Hash tables can be logged now.
Diffstat (limited to 'src/rt/rust_shape.cpp')
| -rw-r--r-- | src/rt/rust_shape.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/rt/rust_shape.cpp b/src/rt/rust_shape.cpp index 8e99c41ea02..6a586860cd6 100644 --- a/src/rt/rust_shape.cpp +++ b/src/rt/rust_shape.cpp @@ -42,10 +42,21 @@ type_param::make(const type_desc **tydescs, unsigned n_tydescs, return ptrs; } +// Constructs type parameters from an object shape. This is a bit messy, +// because it requires that the object shape have a specific format. type_param * -type_param::from_obj_shape(const uint8_t *sp, arena &arena) { - // TODO - abort(); +type_param::from_obj_shape(const uint8_t *sp, ptr dp, arena &arena) { + uint8_t shape = *sp++; assert(shape == SHAPE_STRUCT); + get_u16_bump(sp); // Skip over the size. + shape = *sp++; assert(shape == SHAPE_PTR); + shape = *sp++; assert(shape == SHAPE_STRUCT); + + unsigned n_tydescs = get_u16_bump(sp); + + // Type descriptors start right after the reference count. + const type_desc **descs = (const type_desc **)(dp + sizeof(uintptr_t)); + + return make(descs, n_tydescs, arena); } |
