@@ -910,7 +910,9 @@ class copy : public data<copy,uint8_t *> {
910
910
class cmp : public data <cmp,ptr_pair> {
911
911
private:
912
912
template <typename T>
913
- int cmp_number (ptr_pair &ptrs);
913
+ void cmp_number (const data_pair<T> &nums) {
914
+ result = (nums.fst < nums.snd ) ? -1 : (nums.fst == nums.snd ) ? 0 : 1 ;
915
+ }
914
916
915
917
public:
916
918
int result;
@@ -933,20 +935,20 @@ class cmp : public data<cmp,ptr_pair> {
933
935
void walk_box (bool align);
934
936
void walk_struct (bool align, const uint8_t *end_sp);
935
937
void walk_tag (bool align, tag_info &tinfo,
936
- data_pair<uint32_t > &tag_variants);
938
+ const data_pair<uint32_t > &tag_variants);
937
939
void walk_res (bool align, const rust_fn *dtor, uint16_t n_ty_params,
938
940
const uint8_t *ty_params_sp);
939
941
940
942
template <typename T>
941
- void walk_number () { result = cmp_number<T>(dp); }
943
+ void walk_number () { cmp_number (bump_dp <T>(dp) ); }
942
944
};
943
945
944
946
void
945
947
cmp::walk_box (bool align) {
946
948
data_pair<uint8_t *> subdp = bump_dp<uint8_t *>(dp);
947
949
cmp subcx (*this , ptr_pair::make (subdp));
948
950
subcx.dp += sizeof (uint32_t ); // Skip over the reference count.
949
- subcx.walk (false );
951
+ subcx.walk (true );
950
952
result = subcx.result ;
951
953
}
952
954
@@ -960,7 +962,10 @@ cmp::walk_struct(bool align, const uint8_t *end_sp) {
960
962
961
963
void
962
964
cmp::walk_tag (bool align, tag_info &tinfo,
963
- data_pair<uint32_t > &tag_variants) {
965
+ const data_pair<uint32_t > &tag_variants) {
966
+ cmp_number (tag_variants);
967
+ if (result != 0 )
968
+ return ;
964
969
abort (); // TODO
965
970
}
966
971
@@ -970,14 +975,6 @@ cmp::walk_res(bool align, const rust_fn *dtor, uint16_t n_ty_params,
970
975
abort (); // TODO
971
976
}
972
977
973
- template <typename T>
974
- int
975
- cmp::cmp_number (ptr_pair &ptrs) {
976
- T a = *(reinterpret_cast <T *>(dp.fst ));
977
- T b = *(reinterpret_cast <T *>(dp.snd ));
978
- return (a < b) ? -1 : (a == b) ? 0 : 1 ;
979
- }
980
-
981
978
} // end namespace shape
982
979
983
980
extern " C" void
0 commit comments