rt: Make |align| a member of the shape glue class instead of threading it through every function
This commit is contained in:
parent
03ddc8fdd3
commit
143569fce4
@ -121,9 +121,9 @@ gc::mark(std::vector<root> &roots) {
|
||||
shape::arena arena;
|
||||
shape::type_param *params = shape::type_param::from_tydesc(ri->tydesc,
|
||||
arena);
|
||||
shape::log log(task, ri->tydesc->shape, params,
|
||||
shape::log log(task, true, ri->tydesc->shape, params,
|
||||
ri->tydesc->shape_tables, ri->data, std::cerr);
|
||||
log.walk(true);
|
||||
log.walk();
|
||||
DPRINT("\n");
|
||||
|
||||
++ri;
|
||||
|
@ -73,7 +73,7 @@ type_param::from_obj_shape(const uint8_t *sp, ptr dp, arena &arena) {
|
||||
// A shape printer, useful for debugging
|
||||
|
||||
void
|
||||
print::walk_tag(bool align, tag_info &tinfo) {
|
||||
print::walk_tag(tag_info &tinfo) {
|
||||
DPRINT("tag%u", tinfo.tag_id);
|
||||
if (!tinfo.n_params)
|
||||
return;
|
||||
@ -87,14 +87,14 @@ print::walk_tag(bool align, tag_info &tinfo) {
|
||||
first = false;
|
||||
|
||||
ctxt<print> sub(*this, tinfo.params[i].shape);
|
||||
sub.walk(align);
|
||||
sub.walk();
|
||||
}
|
||||
|
||||
DPRINT(">");
|
||||
}
|
||||
|
||||
void
|
||||
print::walk_struct(bool align, const uint8_t *end_sp) {
|
||||
print::walk_struct(const uint8_t *end_sp) {
|
||||
DPRINT("(");
|
||||
|
||||
bool first = true;
|
||||
@ -103,14 +103,14 @@ print::walk_struct(bool align, const uint8_t *end_sp) {
|
||||
DPRINT(",");
|
||||
first = false;
|
||||
|
||||
walk(align);
|
||||
walk();
|
||||
}
|
||||
|
||||
DPRINT(")");
|
||||
}
|
||||
|
||||
void
|
||||
print::walk_res(bool align, const rust_fn *dtor, unsigned n_params,
|
||||
print::walk_res(const rust_fn *dtor, unsigned n_params,
|
||||
const type_param *params, const uint8_t *end_sp) {
|
||||
DPRINT("res@%p", dtor);
|
||||
|
||||
@ -125,7 +125,7 @@ print::walk_res(bool align, const rust_fn *dtor, unsigned n_params,
|
||||
first = false;
|
||||
|
||||
ctxt<print> sub(*this, params[i].shape);
|
||||
sub.walk(align);
|
||||
sub.walk();
|
||||
}
|
||||
|
||||
DPRINT(">");
|
||||
@ -144,41 +144,41 @@ print::walk_res(bool align, const rust_fn *dtor, unsigned n_params,
|
||||
DPRINT(",");
|
||||
first = false;
|
||||
|
||||
walk(align);
|
||||
walk();
|
||||
}
|
||||
|
||||
DPRINT(")");
|
||||
}
|
||||
|
||||
void
|
||||
print::walk_var(bool align, uint8_t param_index) {
|
||||
print::walk_var(uint8_t param_index) {
|
||||
DPRINT("%c=", 'T' + param_index);
|
||||
|
||||
const type_param *param = ¶ms[param_index];
|
||||
print sub(*this, param->shape, param->params, param->tables);
|
||||
sub.walk(align);
|
||||
sub.walk();
|
||||
}
|
||||
|
||||
template<>
|
||||
void print::walk_number<uint8_t>(bool align) { DPRINT("u8"); }
|
||||
void print::walk_number<uint8_t>() { DPRINT("u8"); }
|
||||
template<>
|
||||
void print::walk_number<uint16_t>(bool align) { DPRINT("u16"); }
|
||||
void print::walk_number<uint16_t>() { DPRINT("u16"); }
|
||||
template<>
|
||||
void print::walk_number<uint32_t>(bool align) { DPRINT("u32"); }
|
||||
void print::walk_number<uint32_t>() { DPRINT("u32"); }
|
||||
template<>
|
||||
void print::walk_number<uint64_t>(bool align) { DPRINT("u64"); }
|
||||
void print::walk_number<uint64_t>() { DPRINT("u64"); }
|
||||
template<>
|
||||
void print::walk_number<int8_t>(bool align) { DPRINT("i8"); }
|
||||
void print::walk_number<int8_t>() { DPRINT("i8"); }
|
||||
template<>
|
||||
void print::walk_number<int16_t>(bool align) { DPRINT("i16"); }
|
||||
void print::walk_number<int16_t>() { DPRINT("i16"); }
|
||||
template<>
|
||||
void print::walk_number<int32_t>(bool align) { DPRINT("i32"); }
|
||||
void print::walk_number<int32_t>() { DPRINT("i32"); }
|
||||
template<>
|
||||
void print::walk_number<int64_t>(bool align) { DPRINT("i64"); }
|
||||
void print::walk_number<int64_t>() { DPRINT("i64"); }
|
||||
template<>
|
||||
void print::walk_number<float>(bool align) { DPRINT("f32"); }
|
||||
void print::walk_number<float>() { DPRINT("f32"); }
|
||||
template<>
|
||||
void print::walk_number<double>(bool align) { DPRINT("f64"); }
|
||||
void print::walk_number<double>() { DPRINT("f64"); }
|
||||
|
||||
|
||||
void
|
||||
@ -197,6 +197,7 @@ size_of::compute_tag_size(tag_info &tinfo) {
|
||||
const uint8_t *variant_end = variant_ptr_and_end.second;
|
||||
|
||||
size_of sub(*this, variant_ptr, tinfo.params, NULL);
|
||||
sub.align = false;
|
||||
|
||||
// Compute the size of this variant.
|
||||
size_align variant_sa;
|
||||
@ -204,8 +205,8 @@ size_of::compute_tag_size(tag_info &tinfo) {
|
||||
while (sub.sp != variant_end) {
|
||||
if (!first)
|
||||
variant_sa.size = align_to(variant_sa.size, sub.sa.alignment);
|
||||
sub.walk(!first);
|
||||
first = false;
|
||||
sub.walk();
|
||||
sub.align = true, first = false;
|
||||
|
||||
variant_sa.add(sub.sa.size, sub.sa.alignment);
|
||||
}
|
||||
@ -224,21 +225,21 @@ size_of::compute_tag_size(tag_info &tinfo) {
|
||||
}
|
||||
|
||||
void
|
||||
size_of::walk_tag(bool align, tag_info &tinfo) {
|
||||
size_of::walk_tag(tag_info &tinfo) {
|
||||
compute_tag_size(*this, tinfo);
|
||||
sa = tinfo.tag_sa;
|
||||
}
|
||||
|
||||
void
|
||||
size_of::walk_struct(bool align, const uint8_t *end_sp) {
|
||||
size_of::walk_struct(const uint8_t *end_sp) {
|
||||
size_align struct_sa(0, 1);
|
||||
|
||||
bool first = true;
|
||||
while (sp != end_sp) {
|
||||
if (!first)
|
||||
struct_sa.size = align_to(struct_sa.size, sa.alignment);
|
||||
walk(!first);
|
||||
first = false;
|
||||
walk();
|
||||
align = true, first = false;
|
||||
|
||||
struct_sa.add(sa);
|
||||
}
|
||||
@ -264,21 +265,21 @@ class cmp : public data<cmp,ptr_pair> {
|
||||
friend class data<cmp,ptr_pair>;
|
||||
|
||||
private:
|
||||
void walk_vec(bool align, bool is_pod,
|
||||
void walk_vec(bool is_pod,
|
||||
const std::pair<ptr_pair,ptr_pair> &data_range);
|
||||
|
||||
inline void walk_subcontext(bool align, cmp &sub) {
|
||||
sub.walk(align);
|
||||
inline void walk_subcontext(cmp &sub) {
|
||||
sub.walk();
|
||||
result = sub.result;
|
||||
}
|
||||
|
||||
inline void walk_box_contents(bool align, cmp &sub,
|
||||
ptr_pair &ref_count_dp) {
|
||||
sub.walk(true);
|
||||
inline void walk_box_contents(cmp &sub, ptr_pair &ref_count_dp) {
|
||||
sub.align = true;
|
||||
sub.walk();
|
||||
result = sub.result;
|
||||
}
|
||||
|
||||
inline void cmp_two_pointers(bool align) {
|
||||
inline void cmp_two_pointers() {
|
||||
if (align) dp = align_to(dp, alignof<uint8_t *>() * 2);
|
||||
data_pair<uint8_t *> fst = bump_dp<uint8_t *>(dp);
|
||||
data_pair<uint8_t *> snd = bump_dp<uint8_t *>(dp);
|
||||
@ -287,7 +288,7 @@ private:
|
||||
cmp_number(snd);
|
||||
}
|
||||
|
||||
inline void cmp_pointer(bool align) {
|
||||
inline void cmp_pointer() {
|
||||
if (align) dp = align_to(dp, alignof<uint8_t *>());
|
||||
cmp_number(bump_dp<uint8_t *>(dp));
|
||||
}
|
||||
@ -301,12 +302,13 @@ public:
|
||||
int result;
|
||||
|
||||
cmp(rust_task *in_task,
|
||||
bool in_align,
|
||||
const uint8_t *in_sp,
|
||||
const type_param *in_params,
|
||||
const rust_shape_tables *in_tables,
|
||||
uint8_t *in_data_0,
|
||||
uint8_t *in_data_1)
|
||||
: data<cmp,ptr_pair>(in_task, in_sp, in_params, in_tables,
|
||||
: data<cmp,ptr_pair>(in_task, in_align, in_sp, in_params, in_tables,
|
||||
ptr_pair::make(in_data_0, in_data_1)),
|
||||
result(0) {}
|
||||
|
||||
@ -315,6 +317,7 @@ public:
|
||||
const type_param *in_params = NULL,
|
||||
const rust_shape_tables *in_tables = NULL)
|
||||
: data<cmp,ptr_pair>(other.task,
|
||||
other.align,
|
||||
in_sp ? in_sp : other.sp,
|
||||
in_params ? in_params : other.params,
|
||||
in_tables ? in_tables : other.tables,
|
||||
@ -322,35 +325,35 @@ public:
|
||||
result(0) {}
|
||||
|
||||
cmp(const cmp &other, const ptr_pair &in_dp)
|
||||
: data<cmp,ptr_pair>(other.task, other.sp, other.params, other.tables,
|
||||
: data<cmp,ptr_pair>(other.task,
|
||||
other.align,
|
||||
other.sp,
|
||||
other.params,
|
||||
other.tables,
|
||||
in_dp),
|
||||
result(0) {}
|
||||
|
||||
void walk_evec(bool align, bool is_pod, uint16_t sp_size) {
|
||||
walk_vec(align, is_pod, get_evec_data_range(dp));
|
||||
void walk_evec(bool is_pod, uint16_t sp_size) {
|
||||
walk_vec(is_pod, get_evec_data_range(dp));
|
||||
}
|
||||
|
||||
void walk_vec(bool align, bool is_pod, uint16_t sp_size) {
|
||||
walk_vec(align, is_pod, get_vec_data_range(dp));
|
||||
void walk_vec(bool is_pod, uint16_t sp_size) {
|
||||
walk_vec(is_pod, get_vec_data_range(dp));
|
||||
}
|
||||
|
||||
void walk_box(bool align) {
|
||||
data<cmp,ptr_pair>::walk_box_contents(align);
|
||||
void walk_box() {
|
||||
data<cmp,ptr_pair>::walk_box_contents();
|
||||
}
|
||||
|
||||
void walk_fn(bool align) { return cmp_two_pointers(align); }
|
||||
void walk_obj(bool align) { return cmp_two_pointers(align); }
|
||||
void walk_port(bool align) { return cmp_pointer(align); }
|
||||
void walk_chan(bool align) { return cmp_pointer(align); }
|
||||
void walk_task(bool align) { return cmp_pointer(align); }
|
||||
void walk_fn() { return cmp_two_pointers(); }
|
||||
void walk_obj() { return cmp_two_pointers(); }
|
||||
|
||||
void walk_tag(bool align, tag_info &tinfo,
|
||||
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,
|
||||
void walk_tag(tag_info &tinfo, const data_pair<uint32_t> &tag_variants);
|
||||
void walk_struct(const uint8_t *end_sp);
|
||||
void walk_res(const rust_fn *dtor, uint16_t n_ty_params,
|
||||
const type_param *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,
|
||||
void walk_variant(tag_info &tinfo, uint32_t variant_id,
|
||||
const std::pair<const uint8_t *,const uint8_t *>
|
||||
variant_ptr_and_end);
|
||||
|
||||
@ -364,14 +367,13 @@ void cmp::cmp_number<int32_t>(const data_pair<int32_t> &nums) {
|
||||
}
|
||||
|
||||
void
|
||||
cmp::walk_vec(bool align, bool is_pod,
|
||||
const std::pair<ptr_pair,ptr_pair> &data_range) {
|
||||
cmp::walk_vec(bool is_pod, const std::pair<ptr_pair,ptr_pair> &data_range) {
|
||||
cmp sub(*this, data_range.first);
|
||||
ptr_pair data_end = data_range.second;
|
||||
while (!result && sub.dp < data_end) {
|
||||
sub.walk_reset(align);
|
||||
sub.walk_reset();
|
||||
result = sub.result;
|
||||
align = true;
|
||||
sub.align = true;
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
@ -383,40 +385,39 @@ cmp::walk_vec(bool align, bool is_pod,
|
||||
}
|
||||
|
||||
void
|
||||
cmp::walk_tag(bool align, tag_info &tinfo,
|
||||
const data_pair<uint32_t> &tag_variants) {
|
||||
cmp::walk_tag(tag_info &tinfo, const data_pair<uint32_t> &tag_variants) {
|
||||
cmp_number(tag_variants);
|
||||
if (result != 0)
|
||||
return;
|
||||
data<cmp,ptr_pair>::walk_variant(align, tinfo, tag_variants.fst);
|
||||
data<cmp,ptr_pair>::walk_variant(tinfo, tag_variants.fst);
|
||||
}
|
||||
|
||||
void
|
||||
cmp::walk_struct(bool align, const uint8_t *end_sp) {
|
||||
cmp::walk_struct(const uint8_t *end_sp) {
|
||||
while (!result && this->sp != end_sp) {
|
||||
this->walk(align);
|
||||
this->walk();
|
||||
align = true;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cmp::walk_res(bool align, const rust_fn *dtor, uint16_t n_ty_params,
|
||||
cmp::walk_res(const rust_fn *dtor, uint16_t n_ty_params,
|
||||
const type_param *ty_params_sp, const uint8_t *end_sp,
|
||||
const data_pair<uintptr_t> &live) {
|
||||
abort(); // TODO
|
||||
}
|
||||
|
||||
void
|
||||
cmp::walk_variant(bool align, tag_info &tinfo, uint32_t variant_id,
|
||||
cmp::walk_variant(tag_info &tinfo, uint32_t variant_id,
|
||||
const std::pair<const uint8_t *,const uint8_t *>
|
||||
variant_ptr_and_end) {
|
||||
cmp sub(*this, variant_ptr_and_end.first, tinfo.params);
|
||||
|
||||
const uint8_t *variant_end = variant_ptr_and_end.second;
|
||||
while (!result && sub.sp < variant_end) {
|
||||
sub.walk(align);
|
||||
sub.walk();
|
||||
result = sub.result;
|
||||
align = true;
|
||||
sub.align = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -441,14 +442,14 @@ log::walk_string(const std::pair<ptr,ptr> &data) {
|
||||
}
|
||||
|
||||
void
|
||||
log::walk_struct(bool align, const uint8_t *end_sp) {
|
||||
log::walk_struct(const uint8_t *end_sp) {
|
||||
out << "(";
|
||||
|
||||
bool first = true;
|
||||
while (sp != end_sp) {
|
||||
if (!first)
|
||||
out << ", ";
|
||||
walk(align);
|
||||
walk();
|
||||
align = true, first = false;
|
||||
}
|
||||
|
||||
@ -456,7 +457,7 @@ log::walk_struct(bool align, const uint8_t *end_sp) {
|
||||
}
|
||||
|
||||
void
|
||||
log::walk_vec(bool align, bool is_pod, const std::pair<ptr,ptr> &data) {
|
||||
log::walk_vec(bool is_pod, const std::pair<ptr,ptr> &data) {
|
||||
if (peek() == SHAPE_U8) {
|
||||
sp++; // It's a string. We handle this ourselves.
|
||||
walk_string(data);
|
||||
@ -469,20 +470,16 @@ log::walk_vec(bool align, bool is_pod, const std::pair<ptr,ptr> &data) {
|
||||
|
||||
bool first = true;
|
||||
while (sub.dp < data.second) {
|
||||
if (!first)
|
||||
out << ", ";
|
||||
|
||||
sub.walk_reset(align);
|
||||
|
||||
align = true;
|
||||
first = false;
|
||||
if (!first) out << ", ";
|
||||
sub.walk_reset();
|
||||
sub.align = true, first = false;
|
||||
}
|
||||
|
||||
out << "]";
|
||||
}
|
||||
|
||||
void
|
||||
log::walk_variant(bool align, tag_info &tinfo, uint32_t variant_id,
|
||||
log::walk_variant(tag_info &tinfo, uint32_t variant_id,
|
||||
const std::pair<const uint8_t *,const uint8_t *>
|
||||
variant_ptr_and_end) {
|
||||
log sub(*this, variant_ptr_and_end.first, tinfo.params);
|
||||
@ -491,11 +488,8 @@ log::walk_variant(bool align, tag_info &tinfo, uint32_t variant_id,
|
||||
bool first = true;
|
||||
while (sub.sp < variant_end) {
|
||||
out << (first ? "(" : ", ");
|
||||
|
||||
sub.walk(align);
|
||||
|
||||
align = true;
|
||||
first = false;
|
||||
sub.walk();
|
||||
sub.align = true, first = false;
|
||||
}
|
||||
|
||||
if (!first)
|
||||
@ -503,7 +497,7 @@ log::walk_variant(bool align, tag_info &tinfo, uint32_t variant_id,
|
||||
}
|
||||
|
||||
void
|
||||
log::walk_res(bool align, const rust_fn *dtor, unsigned n_params,
|
||||
log::walk_res(const rust_fn *dtor, unsigned n_params,
|
||||
const type_param *params, const uint8_t *end_sp, bool live) {
|
||||
out << "res";
|
||||
|
||||
@ -516,7 +510,7 @@ log::walk_res(bool align, const rust_fn *dtor, unsigned n_params,
|
||||
while (sp != end_sp) {
|
||||
if (!first)
|
||||
out << ", ";
|
||||
walk(align);
|
||||
walk();
|
||||
align = true, first = false;
|
||||
}
|
||||
|
||||
@ -531,9 +525,9 @@ upcall_cmp_type(int8_t *result, rust_task *task, type_desc *tydesc,
|
||||
uint8_t *data_1, uint8_t cmp_type) {
|
||||
shape::arena arena;
|
||||
shape::type_param *params = shape::type_param::from_tydesc(tydesc, arena);
|
||||
shape::cmp cmp(task, tydesc->shape, params, tydesc->shape_tables, data_0,
|
||||
data_1);
|
||||
cmp.walk(true);
|
||||
shape::cmp cmp(task, true, tydesc->shape, params, tydesc->shape_tables,
|
||||
data_0, data_1);
|
||||
cmp.walk();
|
||||
|
||||
switch (cmp_type) {
|
||||
case shape::CMP_EQ: *result = cmp.result == 0; break;
|
||||
@ -552,10 +546,10 @@ upcall_log_type(rust_task *task, type_desc *tydesc, uint8_t *data,
|
||||
shape::type_param *params = shape::type_param::from_tydesc(tydesc, arena);
|
||||
|
||||
std::stringstream ss;
|
||||
shape::log log(task, tydesc->shape, params, tydesc->shape_tables, data,
|
||||
ss);
|
||||
shape::log log(task, true, tydesc->shape, params, tydesc->shape_tables,
|
||||
data, ss);
|
||||
|
||||
log.walk(true);
|
||||
log.walk();
|
||||
|
||||
task->sched->log(task, level, "%s", ss.str().c_str());
|
||||
}
|
||||
|
@ -6,10 +6,13 @@
|
||||
|
||||
#include "rust_internal.h"
|
||||
|
||||
// ISAAC pollutes our namespace.
|
||||
#undef align
|
||||
|
||||
#define ARENA_SIZE 256
|
||||
|
||||
#define DPRINT(fmt,...) fprintf(stderr, fmt, ##__VA_ARGS__)
|
||||
#define DPRINTCX(cx) print::print_cx(cx)
|
||||
#define DPRINTCX(cx) shape::print::print_cx(cx)
|
||||
|
||||
//#define DPRINT(fmt,...)
|
||||
//#define DPRINTCX(cx)
|
||||
@ -198,12 +201,18 @@ public:
|
||||
const type_param *params; // shapes of type parameters
|
||||
const rust_shape_tables *tables;
|
||||
rust_task *task;
|
||||
bool align;
|
||||
|
||||
ctxt(rust_task *in_task,
|
||||
bool in_align,
|
||||
const uint8_t *in_sp,
|
||||
const type_param *in_params,
|
||||
const rust_shape_tables *in_tables)
|
||||
: sp(in_sp), params(in_params), tables(in_tables), task(in_task) {}
|
||||
: sp(in_sp),
|
||||
params(in_params),
|
||||
tables(in_tables),
|
||||
task(in_task),
|
||||
align(in_align) {}
|
||||
|
||||
template<typename U>
|
||||
ctxt(const ctxt<U> &other,
|
||||
@ -213,10 +222,11 @@ public:
|
||||
: sp(in_sp ? in_sp : other.sp),
|
||||
params(in_params ? in_params : other.params),
|
||||
tables(in_tables ? in_tables : other.tables),
|
||||
task(other.task) {}
|
||||
task(other.task),
|
||||
align(other.align) {}
|
||||
|
||||
void walk(bool align);
|
||||
void walk_reset(bool align);
|
||||
void walk();
|
||||
void walk_reset();
|
||||
|
||||
std::pair<const uint8_t *,const uint8_t *>
|
||||
get_variant_sp(tag_info &info, uint32_t variant_id);
|
||||
@ -227,13 +237,13 @@ protected:
|
||||
inline size_align get_size_align(const uint8_t *&addr);
|
||||
|
||||
private:
|
||||
void walk_evec(bool align);
|
||||
void walk_vec(bool align);
|
||||
void walk_tag(bool align);
|
||||
void walk_box(bool align);
|
||||
void walk_struct(bool align);
|
||||
void walk_res(bool align);
|
||||
void walk_var(bool align);
|
||||
void walk_evec();
|
||||
void walk_vec();
|
||||
void walk_tag();
|
||||
void walk_box();
|
||||
void walk_struct();
|
||||
void walk_res();
|
||||
void walk_var();
|
||||
};
|
||||
|
||||
|
||||
@ -308,13 +318,12 @@ public:
|
||||
// Traversals
|
||||
|
||||
#define WALK_NUMBER(c_type) \
|
||||
static_cast<T *>(this)->template walk_number<c_type>(align)
|
||||
#define WALK_SIMPLE(method) static_cast<T *>(this)->method(align)
|
||||
static_cast<T *>(this)->template walk_number<c_type>()
|
||||
#define WALK_SIMPLE(method) static_cast<T *>(this)->method()
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ctxt<T>::walk(bool align) {
|
||||
|
||||
ctxt<T>::walk() {
|
||||
switch (*sp++) {
|
||||
case SHAPE_U8: WALK_NUMBER(uint8_t); break;
|
||||
case SHAPE_U16: WALK_NUMBER(uint16_t); break;
|
||||
@ -326,24 +335,24 @@ ctxt<T>::walk(bool align) {
|
||||
case SHAPE_I64: WALK_NUMBER(int64_t); break;
|
||||
case SHAPE_F32: WALK_NUMBER(float); break;
|
||||
case SHAPE_F64: WALK_NUMBER(double); break;
|
||||
case SHAPE_EVEC: walk_evec(align); break;
|
||||
case SHAPE_VEC: walk_vec(align); break;
|
||||
case SHAPE_TAG: walk_tag(align); break;
|
||||
case SHAPE_BOX: walk_box(align); break;
|
||||
case SHAPE_STRUCT: walk_struct(align); break;
|
||||
case SHAPE_EVEC: walk_evec(); break;
|
||||
case SHAPE_VEC: walk_vec(); break;
|
||||
case SHAPE_TAG: walk_tag(); break;
|
||||
case SHAPE_BOX: walk_box(); break;
|
||||
case SHAPE_STRUCT: walk_struct(); break;
|
||||
case SHAPE_FN: WALK_SIMPLE(walk_fn); break;
|
||||
case SHAPE_OBJ: WALK_SIMPLE(walk_obj); break;
|
||||
case SHAPE_RES: walk_res(align); break;
|
||||
case SHAPE_VAR: walk_var(align); break;
|
||||
case SHAPE_RES: walk_res(); break;
|
||||
case SHAPE_VAR: walk_var(); break;
|
||||
default: abort();
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ctxt<T>::walk_reset(bool align) {
|
||||
ctxt<T>::walk_reset() {
|
||||
const uint8_t *old_sp = sp;
|
||||
walk(align);
|
||||
walk();
|
||||
sp = old_sp;
|
||||
}
|
||||
|
||||
@ -371,33 +380,33 @@ ctxt<T>::get_variant_sp(tag_info &tinfo, uint32_t variant_id) {
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ctxt<T>::walk_evec(bool align) {
|
||||
ctxt<T>::walk_evec() {
|
||||
bool is_pod = *sp++;
|
||||
|
||||
uint16_t sp_size = get_u16_bump(sp);
|
||||
const uint8_t *end_sp = sp + sp_size;
|
||||
|
||||
static_cast<T *>(this)->walk_evec(align, is_pod, sp_size);
|
||||
static_cast<T *>(this)->walk_evec(is_pod, sp_size);
|
||||
|
||||
sp = end_sp;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ctxt<T>::walk_vec(bool align) {
|
||||
ctxt<T>::walk_vec() {
|
||||
bool is_pod = *sp++;
|
||||
|
||||
uint16_t sp_size = get_u16_bump(sp);
|
||||
const uint8_t *end_sp = sp + sp_size;
|
||||
|
||||
static_cast<T *>(this)->walk_vec(align, is_pod, sp_size);
|
||||
static_cast<T *>(this)->walk_vec(is_pod, sp_size);
|
||||
|
||||
sp = end_sp;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ctxt<T>::walk_tag(bool align) {
|
||||
ctxt<T>::walk_tag() {
|
||||
tag_info tinfo;
|
||||
tinfo.tag_id = get_u16_bump(sp);
|
||||
|
||||
@ -429,34 +438,34 @@ ctxt<T>::walk_tag(bool align) {
|
||||
tinfo.params = params;
|
||||
|
||||
// Call to the implementation.
|
||||
static_cast<T *>(this)->walk_tag(align, tinfo);
|
||||
static_cast<T *>(this)->walk_tag(tinfo);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ctxt<T>::walk_box(bool align) {
|
||||
ctxt<T>::walk_box() {
|
||||
uint16_t sp_size = get_u16_bump(sp);
|
||||
const uint8_t *end_sp = sp + sp_size;
|
||||
|
||||
static_cast<T *>(this)->walk_box(align);
|
||||
static_cast<T *>(this)->walk_box();
|
||||
|
||||
sp = end_sp;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ctxt<T>::walk_struct(bool align) {
|
||||
ctxt<T>::walk_struct() {
|
||||
uint16_t sp_size = get_u16_bump(sp);
|
||||
const uint8_t *end_sp = sp + sp_size;
|
||||
|
||||
static_cast<T *>(this)->walk_struct(align, end_sp);
|
||||
static_cast<T *>(this)->walk_struct(end_sp);
|
||||
|
||||
sp = end_sp;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ctxt<T>::walk_res(bool align) {
|
||||
ctxt<T>::walk_res() {
|
||||
uint16_t dtor_offset = get_u16_bump(sp);
|
||||
const rust_fn **resources =
|
||||
reinterpret_cast<const rust_fn **>(tables->resources);
|
||||
@ -476,17 +485,16 @@ ctxt<T>::walk_res(bool align) {
|
||||
uint16_t sp_size = get_u16_bump(sp);
|
||||
const uint8_t *end_sp = sp + sp_size;
|
||||
|
||||
static_cast<T *>(this)->walk_res(align, dtor, n_ty_params, params,
|
||||
end_sp);
|
||||
static_cast<T *>(this)->walk_res(dtor, n_ty_params, params, end_sp);
|
||||
|
||||
sp = end_sp;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ctxt<T>::walk_var(bool align) {
|
||||
ctxt<T>::walk_var() {
|
||||
uint8_t param = *sp++;
|
||||
static_cast<T *>(this)->walk_var(align, param);
|
||||
static_cast<T *>(this)->walk_var(param);
|
||||
}
|
||||
|
||||
// A shape printer, useful for debugging
|
||||
@ -500,35 +508,33 @@ public:
|
||||
const rust_shape_tables *in_tables = NULL)
|
||||
: ctxt<print>(other, in_sp, in_params, in_tables) {}
|
||||
|
||||
void walk_tag(bool align, tag_info &tinfo);
|
||||
void walk_struct(bool align, const uint8_t *end_sp);
|
||||
void walk_res(bool align, const rust_fn *dtor, unsigned n_params,
|
||||
void walk_tag(tag_info &tinfo);
|
||||
void walk_struct(const uint8_t *end_sp);
|
||||
void walk_res(const rust_fn *dtor, unsigned n_params,
|
||||
const type_param *params, const uint8_t *end_sp);
|
||||
void walk_var(bool align, uint8_t param);
|
||||
void walk_var(uint8_t param);
|
||||
|
||||
void walk_evec(bool align, bool is_pod, uint16_t sp_size) {
|
||||
DPRINT("evec<"); walk(align); DPRINT(">");
|
||||
void walk_evec(bool is_pod, uint16_t sp_size) {
|
||||
DPRINT("evec<"); walk(); DPRINT(">");
|
||||
}
|
||||
void walk_vec(bool align, bool is_pod, uint16_t sp_size) {
|
||||
DPRINT("vec<"); walk(align); DPRINT(">");
|
||||
void walk_vec(bool is_pod, uint16_t sp_size) {
|
||||
DPRINT("vec<"); walk(); DPRINT(">");
|
||||
}
|
||||
void walk_box(bool align) {
|
||||
DPRINT("box<"); walk(align); DPRINT(">");
|
||||
void walk_box() {
|
||||
DPRINT("box<"); walk(); DPRINT(">");
|
||||
}
|
||||
|
||||
void walk_port(bool align) { DPRINT("port"); }
|
||||
void walk_chan(bool align) { DPRINT("chan"); }
|
||||
void walk_task(bool align) { DPRINT("task"); }
|
||||
void walk_fn(bool align) { DPRINT("fn"); }
|
||||
void walk_obj(bool align) { DPRINT("obj"); }
|
||||
void walk_fn() { DPRINT("fn"); }
|
||||
void walk_obj() { DPRINT("obj"); }
|
||||
|
||||
template<typename T>
|
||||
void walk_number(bool align) {}
|
||||
void walk_number() {}
|
||||
|
||||
template<typename T>
|
||||
static void print_cx(const T *cx) {
|
||||
print self(*cx);
|
||||
self.walk(false);
|
||||
self.align = false;
|
||||
self.walk();
|
||||
}
|
||||
};
|
||||
|
||||
@ -558,37 +564,34 @@ public:
|
||||
const rust_shape_tables *in_tables = NULL)
|
||||
: ctxt<size_of>(other, in_sp, in_params, in_tables) {}
|
||||
|
||||
void walk_tag(bool align, tag_info &tinfo);
|
||||
void walk_struct(bool align, const uint8_t *end_sp);
|
||||
void walk_tag(tag_info &tinfo);
|
||||
void walk_struct(const uint8_t *end_sp);
|
||||
|
||||
void walk_box(bool align) { sa.set(sizeof(void *), sizeof(void *)); }
|
||||
void walk_port(bool align) { sa.set(sizeof(void *), sizeof(void *)); }
|
||||
void walk_chan(bool align) { sa.set(sizeof(void *), sizeof(void *)); }
|
||||
void walk_task(bool align) { sa.set(sizeof(void *), sizeof(void *)); }
|
||||
void walk_fn(bool align) { sa.set(sizeof(void *)*2, sizeof(void *)); }
|
||||
void walk_obj(bool align) { sa.set(sizeof(void *)*2, sizeof(void *)); }
|
||||
void walk_box() { sa.set(sizeof(void *), sizeof(void *)); }
|
||||
void walk_fn() { sa.set(sizeof(void *)*2, sizeof(void *)); }
|
||||
void walk_obj() { sa.set(sizeof(void *)*2, sizeof(void *)); }
|
||||
|
||||
void walk_evec(bool align, bool is_pod, uint16_t sp_size) {
|
||||
void walk_evec(bool is_pod, uint16_t sp_size) {
|
||||
sa.set(sizeof(void *), sizeof(void *));
|
||||
}
|
||||
void walk_vec(bool align, bool is_pod, uint16_t sp_size) {
|
||||
sa.set(sizeof(void*), sizeof(void*));
|
||||
void walk_vec(bool is_pod, uint16_t sp_size) {
|
||||
sa.set(sizeof(void *), sizeof(void *));
|
||||
}
|
||||
|
||||
void walk_var(bool align, uint8_t param_index) {
|
||||
void walk_var(uint8_t param_index) {
|
||||
const type_param *param = ¶ms[param_index];
|
||||
size_of sub(*this, param->shape, param->params, param->tables);
|
||||
sub.walk(align);
|
||||
sub.walk();
|
||||
sa = sub.sa;
|
||||
}
|
||||
|
||||
void walk_res(bool align, const rust_fn *dtor, unsigned n_params,
|
||||
void walk_res(const rust_fn *dtor, unsigned n_params,
|
||||
const type_param *params, const uint8_t *end_sp) {
|
||||
abort(); // TODO
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void walk_number(bool align) { sa.set(sizeof(T), alignof<T>()); }
|
||||
void walk_number() { sa.set(sizeof(T), alignof<T>()); }
|
||||
|
||||
void compute_tag_size(tag_info &tinfo);
|
||||
|
||||
@ -601,7 +604,8 @@ public:
|
||||
template<typename T>
|
||||
static size_align get(const ctxt<T> &other_cx, unsigned back_up = 0) {
|
||||
size_of cx(other_cx, other_cx.sp - back_up);
|
||||
cx.walk(false);
|
||||
cx.align = false;
|
||||
cx.walk();
|
||||
assert(cx.sa.alignment > 0);
|
||||
return cx.sa;
|
||||
}
|
||||
@ -751,7 +755,7 @@ namespace shape {
|
||||
// for methods that actually manipulate the data involved.
|
||||
|
||||
#define DATA_SIMPLE(ty, call) \
|
||||
if (align) dp = align_to(dp, alignof<ty>()); \
|
||||
if (this->align) dp = align_to(dp, alignof<ty>()); \
|
||||
U end_dp = dp + sizeof(ty); \
|
||||
static_cast<T *>(this)->call; \
|
||||
dp = end_dp;
|
||||
@ -759,10 +763,10 @@ namespace shape {
|
||||
template<typename T,typename U>
|
||||
class data : public ctxt< data<T,U> > {
|
||||
protected:
|
||||
void walk_box_contents(bool align);
|
||||
void walk_fn_contents(bool align, ptr &dp);
|
||||
void walk_obj_contents(bool align, ptr &dp);
|
||||
void walk_variant(bool align, tag_info &tinfo, uint32_t variant);
|
||||
void walk_box_contents();
|
||||
void walk_fn_contents(ptr &dp);
|
||||
void walk_obj_contents(ptr &dp);
|
||||
void walk_variant(tag_info &tinfo, uint32_t variant);
|
||||
|
||||
static std::pair<uint8_t *,uint8_t *> get_evec_data_range(ptr dp);
|
||||
static std::pair<uint8_t *,uint8_t *> get_vec_data_range(ptr dp);
|
||||
@ -773,80 +777,79 @@ public:
|
||||
U dp;
|
||||
|
||||
data(rust_task *in_task,
|
||||
bool in_align,
|
||||
const uint8_t *in_sp,
|
||||
const type_param *in_params,
|
||||
const rust_shape_tables *in_tables,
|
||||
U const &in_dp)
|
||||
: ctxt< data<T,U> >(in_task, in_sp, in_params, in_tables), dp(in_dp) {}
|
||||
: ctxt< data<T,U> >(in_task, in_align, in_sp, in_params, in_tables),
|
||||
dp(in_dp) {}
|
||||
|
||||
void walk_tag(bool align, tag_info &tinfo);
|
||||
void walk_tag(tag_info &tinfo);
|
||||
|
||||
void walk_struct(bool align, const uint8_t *end_sp) {
|
||||
static_cast<T *>(this)->walk_struct(align, end_sp);
|
||||
void walk_struct(const uint8_t *end_sp) {
|
||||
static_cast<T *>(this)->walk_struct(end_sp);
|
||||
}
|
||||
|
||||
void walk_evec(bool align, bool is_pod, uint16_t sp_size) {
|
||||
DATA_SIMPLE(void *, walk_evec(align, is_pod, sp_size));
|
||||
void walk_evec(bool is_pod, uint16_t sp_size) {
|
||||
DATA_SIMPLE(void *, walk_evec(is_pod, sp_size));
|
||||
}
|
||||
void walk_vec(bool align, bool is_pod, uint16_t sp_size) {
|
||||
DATA_SIMPLE(void *, walk_vec(align, is_pod, sp_size));
|
||||
void walk_vec(bool is_pod, uint16_t sp_size) {
|
||||
DATA_SIMPLE(void *, walk_vec(is_pod, sp_size));
|
||||
}
|
||||
|
||||
void walk_box(bool align) { DATA_SIMPLE(void *, walk_box(align)); }
|
||||
void walk_port(bool align) { DATA_SIMPLE(void *, walk_port(align)); }
|
||||
void walk_chan(bool align) { DATA_SIMPLE(void *, walk_chan(align)); }
|
||||
void walk_task(bool align) { DATA_SIMPLE(void *, walk_task(align)); }
|
||||
void walk_box() { DATA_SIMPLE(void *, walk_box()); }
|
||||
|
||||
void walk_fn(bool align) {
|
||||
if (align) dp = align_to(dp, sizeof(void *));
|
||||
void walk_fn() {
|
||||
if (this->align) dp = align_to(dp, sizeof(void *));
|
||||
U next_dp = dp + sizeof(void *) * 2;
|
||||
static_cast<T *>(this)->walk_fn(align);
|
||||
static_cast<T *>(this)->walk_fn();
|
||||
dp = next_dp;
|
||||
}
|
||||
|
||||
void walk_obj(bool align) {
|
||||
if (align) dp = align_to(dp, sizeof(void *));
|
||||
void walk_obj() {
|
||||
if (this->align) dp = align_to(dp, sizeof(void *));
|
||||
U next_dp = dp + sizeof(void *) * 2;
|
||||
static_cast<T *>(this)->walk_obj(align);
|
||||
static_cast<T *>(this)->walk_obj();
|
||||
dp = next_dp;
|
||||
}
|
||||
|
||||
void walk_res(bool align, const rust_fn *dtor, unsigned n_params,
|
||||
void walk_res(const rust_fn *dtor, unsigned n_params,
|
||||
const type_param *params, const uint8_t *end_sp) {
|
||||
typename U::template data<uintptr_t>::t live = bump_dp<uintptr_t>(dp);
|
||||
// Delegate to the implementation.
|
||||
static_cast<T *>(this)->walk_res(align, dtor, n_params, params,
|
||||
end_sp, live);
|
||||
static_cast<T *>(this)->walk_res(dtor, n_params, params, end_sp,
|
||||
live);
|
||||
}
|
||||
|
||||
void walk_var(bool align, uint8_t param_index) {
|
||||
void walk_var(uint8_t param_index) {
|
||||
const type_param *param = &this->params[param_index];
|
||||
T sub(*static_cast<T *>(this), param->shape, param->params,
|
||||
param->tables);
|
||||
static_cast<T *>(this)->walk_subcontext(align, sub);
|
||||
static_cast<T *>(this)->walk_subcontext(sub);
|
||||
dp = sub.dp;
|
||||
}
|
||||
|
||||
template<typename W>
|
||||
void walk_number(bool align) { DATA_SIMPLE(W, walk_number<W>()); }
|
||||
void walk_number() { DATA_SIMPLE(W, walk_number<W>()); }
|
||||
};
|
||||
|
||||
template<typename T,typename U>
|
||||
void
|
||||
data<T,U>::walk_box_contents(bool align) {
|
||||
data<T,U>::walk_box_contents() {
|
||||
typename U::template data<uint8_t *>::t box_ptr = bump_dp<uint8_t *>(dp);
|
||||
|
||||
U ref_count_dp(box_ptr);
|
||||
T sub(*static_cast<T *>(this), ref_count_dp + sizeof(uint32_t));
|
||||
static_cast<T *>(this)->walk_box_contents(align, sub, ref_count_dp);
|
||||
static_cast<T *>(this)->walk_box_contents(sub, ref_count_dp);
|
||||
}
|
||||
|
||||
template<typename T,typename U>
|
||||
void
|
||||
data<T,U>::walk_variant(bool align, tag_info &tinfo, uint32_t variant_id) {
|
||||
data<T,U>::walk_variant(tag_info &tinfo, uint32_t variant_id) {
|
||||
std::pair<const uint8_t *,const uint8_t *> variant_ptr_and_end =
|
||||
this->get_variant_sp(tinfo, variant_id);
|
||||
static_cast<T *>(this)->walk_variant(align, tinfo, variant_id,
|
||||
static_cast<T *>(this)->walk_variant(tinfo, variant_id,
|
||||
variant_ptr_and_end);
|
||||
}
|
||||
|
||||
@ -887,10 +890,10 @@ data<T,U>::get_vec_data_range(ptr_pair &dp) {
|
||||
|
||||
template<typename T,typename U>
|
||||
void
|
||||
data<T,U>::walk_tag(bool align, tag_info &tinfo) {
|
||||
data<T,U>::walk_tag(tag_info &tinfo) {
|
||||
size_of::compute_tag_size(*this, tinfo);
|
||||
|
||||
if (tinfo.variant_count > 1 && align)
|
||||
if (tinfo.variant_count > 1 && this->align)
|
||||
dp = align_to(dp, alignof<uint32_t>());
|
||||
|
||||
U end_dp = dp + tinfo.tag_sa.size;
|
||||
@ -901,14 +904,14 @@ data<T,U>::walk_tag(bool align, tag_info &tinfo) {
|
||||
else
|
||||
tag_variant = 0;
|
||||
|
||||
static_cast<T *>(this)->walk_tag(align, tinfo, tag_variant);
|
||||
static_cast<T *>(this)->walk_tag(tinfo, tag_variant);
|
||||
|
||||
dp = end_dp;
|
||||
}
|
||||
|
||||
template<typename T,typename U>
|
||||
void
|
||||
data<T,U>::walk_fn_contents(bool align, ptr &dp) {
|
||||
data<T,U>::walk_fn_contents(ptr &dp) {
|
||||
dp += sizeof(void *); // Skip over the code pointer.
|
||||
|
||||
uint8_t *box_ptr = bump_dp<uint8_t *>(dp);
|
||||
@ -926,12 +929,13 @@ data<T,U>::walk_fn_contents(bool align, ptr &dp) {
|
||||
closure_dp += sizeof(void *);
|
||||
T sub(*static_cast<T *>(this), subtydesc->shape, params,
|
||||
subtydesc->shape_tables, closure_dp);
|
||||
sub.walk(true);
|
||||
sub.align = true;
|
||||
sub.walk();
|
||||
}
|
||||
|
||||
template<typename T,typename U>
|
||||
void
|
||||
data<T,U>::walk_obj_contents(bool align, ptr &dp) {
|
||||
data<T,U>::walk_obj_contents(ptr &dp) {
|
||||
dp += sizeof(void *); // Skip over the vtable.
|
||||
|
||||
uint8_t *box_ptr = bump_dp<uint8_t *>(dp);
|
||||
@ -946,7 +950,8 @@ data<T,U>::walk_obj_contents(bool align, ptr &dp) {
|
||||
obj_closure_dp, arena);
|
||||
T sub(*static_cast<T *>(this), subtydesc->shape, params,
|
||||
subtydesc->shape_tables, obj_closure_dp);
|
||||
sub.walk(true);
|
||||
sub.align = true;
|
||||
sub.walk();
|
||||
}
|
||||
|
||||
|
||||
@ -964,6 +969,7 @@ private:
|
||||
const type_param *in_params,
|
||||
const rust_shape_tables *in_tables = NULL)
|
||||
: data<log,ptr>(other.task,
|
||||
other.align,
|
||||
in_sp,
|
||||
in_params,
|
||||
in_tables ? in_tables : other.tables,
|
||||
@ -975,61 +981,69 @@ private:
|
||||
const type_param *in_params,
|
||||
const rust_shape_tables *in_tables,
|
||||
ptr in_dp)
|
||||
: data<log,ptr>(other.task, in_sp, in_params, in_tables, in_dp),
|
||||
: data<log,ptr>(other.task,
|
||||
other.align,
|
||||
in_sp,
|
||||
in_params,
|
||||
in_tables,
|
||||
in_dp),
|
||||
out(other.out) {}
|
||||
|
||||
log(log &other, ptr in_dp)
|
||||
: data<log,ptr>(other.task, other.sp, other.params, other.tables, in_dp),
|
||||
: data<log,ptr>(other.task,
|
||||
other.align,
|
||||
other.sp,
|
||||
other.params,
|
||||
other.tables,
|
||||
in_dp),
|
||||
out(other.out) {}
|
||||
|
||||
void walk_evec(bool align, bool is_pod, uint16_t sp_size) {
|
||||
walk_vec(align, is_pod, get_evec_data_range(dp));
|
||||
void walk_evec(bool is_pod, uint16_t sp_size) {
|
||||
walk_vec(is_pod, get_evec_data_range(dp));
|
||||
}
|
||||
|
||||
void walk_vec(bool align, bool is_pod, uint16_t sp_size) {
|
||||
walk_vec(align, is_pod, get_vec_data_range(dp));
|
||||
void walk_vec(bool is_pod, uint16_t sp_size) {
|
||||
walk_vec(is_pod, get_vec_data_range(dp));
|
||||
}
|
||||
|
||||
void walk_tag(bool align, tag_info &tinfo, uint32_t tag_variant) {
|
||||
void walk_tag(tag_info &tinfo, uint32_t tag_variant) {
|
||||
out << "tag" << tag_variant;
|
||||
data<log,ptr>::walk_variant(align, tinfo, tag_variant);
|
||||
data<log,ptr>::walk_variant(tinfo, tag_variant);
|
||||
}
|
||||
|
||||
void walk_box(bool align) {
|
||||
void walk_box() {
|
||||
out << "@";
|
||||
data<log,ptr>::walk_box_contents(align);
|
||||
data<log,ptr>::walk_box_contents();
|
||||
}
|
||||
|
||||
void walk_fn(bool align) {
|
||||
void walk_fn() {
|
||||
out << "fn";
|
||||
data<log,ptr>::walk_fn_contents(align, dp);
|
||||
data<log,ptr>::walk_fn_contents(dp);
|
||||
}
|
||||
|
||||
void walk_obj(bool align) {
|
||||
void walk_obj() {
|
||||
out << "obj";
|
||||
data<log,ptr>::walk_obj_contents(align, dp);
|
||||
data<log,ptr>::walk_obj_contents(dp);
|
||||
}
|
||||
|
||||
void walk_port(bool align) { out << "port"; }
|
||||
void walk_chan(bool align) { out << "chan"; }
|
||||
void walk_task(bool align) { out << "task"; }
|
||||
void walk_subcontext(log &sub) { sub.walk(); }
|
||||
|
||||
void walk_subcontext(bool align, log &sub) { sub.walk(align); }
|
||||
|
||||
void walk_box_contents(bool align, log &sub, ptr &ref_count_dp) {
|
||||
if (ref_count_dp == 0)
|
||||
void walk_box_contents(log &sub, ptr &ref_count_dp) {
|
||||
if (ref_count_dp == 0) {
|
||||
out << "(null)";
|
||||
else
|
||||
sub.walk(true);
|
||||
} else {
|
||||
sub.align = true;
|
||||
sub.walk();
|
||||
}
|
||||
}
|
||||
|
||||
void walk_struct(bool align, const uint8_t *end_sp);
|
||||
void walk_vec(bool align, bool is_pod, const std::pair<ptr,ptr> &data);
|
||||
void walk_variant(bool align, tag_info &tinfo, uint32_t variant_id,
|
||||
void walk_struct(const uint8_t *end_sp);
|
||||
void walk_vec(bool is_pod, const std::pair<ptr,ptr> &data);
|
||||
void walk_variant(tag_info &tinfo, uint32_t variant_id,
|
||||
const std::pair<const uint8_t *,const uint8_t *>
|
||||
variant_ptr_and_end);
|
||||
void walk_string(const std::pair<ptr,ptr> &data);
|
||||
void walk_res(bool align, const rust_fn *dtor, unsigned n_params,
|
||||
void walk_res(const rust_fn *dtor, unsigned n_params,
|
||||
const type_param *params, const uint8_t *end_sp, bool live);
|
||||
|
||||
template<typename T>
|
||||
@ -1037,12 +1051,13 @@ private:
|
||||
|
||||
public:
|
||||
log(rust_task *in_task,
|
||||
bool in_align,
|
||||
const uint8_t *in_sp,
|
||||
const type_param *in_params,
|
||||
const rust_shape_tables *in_tables,
|
||||
uint8_t *in_data,
|
||||
std::ostream &in_out)
|
||||
: data<log,ptr>(in_task, in_sp, in_params, in_tables, in_data),
|
||||
: data<log,ptr>(in_task, in_align, in_sp, in_params, in_tables, in_data),
|
||||
out(in_out) {}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user