Skip to content

Commit 192d31b

Browse files
committed
---
yaml --- r: 4475 b: refs/heads/master c: f4f057c h: refs/heads/master i: 4473: 38c6bb5 4471: c83af2f v: v3
1 parent 7e940df commit 192d31b

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 72fdb1a3bfcf1017a14cb606c8c145bf3355e2db
2+
refs/heads/master: f4f057ced1f4152575571a6e5116e1ad5bb38beb

trunk/src/rt/rust_shape.cpp

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@ class ptr_pair {
175175
ptr_pair self(fst, snd);
176176
return self;
177177
}
178+
179+
static inline ptr_pair make(const data_pair<uint8_t *> &pair) {
180+
ptr_pair self(pair.fst, pair.snd);
181+
return self;
182+
}
178183
};
179184

180185
inline ptr_pair
@@ -812,11 +817,7 @@ class data : public ctxt< data<T,U> > {
812817
void walk_ivec(bool align, bool is_pod, size_align &elem_sa);
813818

814819
void walk_struct(bool align, const uint8_t *end_sp) {
815-
while (this->sp != end_sp) {
816-
// TODO: Allow subclasses to optimize for POD if they want to.
817-
this->walk(align);
818-
align = true;
819-
}
820+
static_cast<T *>(this)->walk_struct(align, end_sp);
820821
}
821822

822823
void walk_evec(bool align, bool is_pod, uint16_t sp_size) {
@@ -921,8 +922,16 @@ class cmp : public data<cmp,ptr_pair> {
921922
uint8_t *in_data_0,
922923
uint8_t *in_data_1)
923924
: data<cmp,ptr_pair>(in_task, in_sp, in_params, in_tables,
924-
ptr_pair::make(in_data_0, in_data_1)) {}
925+
ptr_pair::make(in_data_0, in_data_1)),
926+
result(0) {}
925927

928+
cmp(const cmp &other, const ptr_pair &in_dp)
929+
: data<cmp,ptr_pair>(other.task, other.sp, other.params, other.tables,
930+
in_dp),
931+
result(0) {}
932+
933+
void walk_box(bool align);
934+
void walk_struct(bool align, const uint8_t *end_sp);
926935
void walk_tag(bool align, tag_info &tinfo,
927936
data_pair<uint32_t> &tag_variants);
928937
void walk_res(bool align, const rust_fn *dtor, uint16_t n_ty_params,
@@ -932,6 +941,23 @@ class cmp : public data<cmp,ptr_pair> {
932941
void walk_number() { result = cmp_number<T>(dp); }
933942
};
934943

944+
void
945+
cmp::walk_box(bool align) {
946+
data_pair<uint8_t *> subdp = bump_dp<uint8_t *>(dp);
947+
cmp subcx(*this, ptr_pair::make(subdp));
948+
subcx.dp += sizeof(uint32_t); // Skip over the reference count.
949+
subcx.walk(false);
950+
result = subcx.result;
951+
}
952+
953+
void
954+
cmp::walk_struct(bool align, const uint8_t *end_sp) {
955+
while (!result && this->sp != end_sp) {
956+
this->walk(align);
957+
align = true;
958+
}
959+
}
960+
935961
void
936962
cmp::walk_tag(bool align, tag_info &tinfo,
937963
data_pair<uint32_t> &tag_variants) {

0 commit comments

Comments
 (0)