@@ -175,6 +175,11 @@ class ptr_pair {
175
175
ptr_pair self (fst, snd);
176
176
return self;
177
177
}
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
+ }
178
183
};
179
184
180
185
inline ptr_pair
@@ -812,11 +817,7 @@ class data : public ctxt< data<T,U> > {
812
817
void walk_ivec (bool align, bool is_pod, size_align &elem_sa);
813
818
814
819
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);
820
821
}
821
822
822
823
void walk_evec (bool align, bool is_pod, uint16_t sp_size) {
@@ -921,8 +922,16 @@ class cmp : public data<cmp,ptr_pair> {
921
922
uint8_t *in_data_0,
922
923
uint8_t *in_data_1)
923
924
: 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 ) {}
925
927
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);
926
935
void walk_tag (bool align, tag_info &tinfo,
927
936
data_pair<uint32_t > &tag_variants);
928
937
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> {
932
941
void walk_number () { result = cmp_number<T>(dp); }
933
942
};
934
943
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
+
935
961
void
936
962
cmp::walk_tag (bool align, tag_info &tinfo,
937
963
data_pair<uint32_t > &tag_variants) {
0 commit comments