parent
42fd2a9d89
commit
a993621e43
4 changed files with 60 additions and 0 deletions
|
|
@ -279,6 +279,12 @@ private:
|
|||
result = sub.result;
|
||||
}
|
||||
|
||||
inline void walk_uniq_contents(cmp &sub) {
|
||||
sub.align = true;
|
||||
sub.walk();
|
||||
result = sub.result;
|
||||
}
|
||||
|
||||
inline void cmp_two_pointers() {
|
||||
ALIGN_TO(alignof<void *>() * 2);
|
||||
data_pair<uint8_t *> fst = bump_dp<uint8_t *>(dp);
|
||||
|
|
@ -341,6 +347,10 @@ public:
|
|||
data<cmp,ptr_pair>::walk_box_contents();
|
||||
}
|
||||
|
||||
void walk_uniq() {
|
||||
data<cmp,ptr_pair>::walk_uniq_contents();
|
||||
}
|
||||
|
||||
void walk_fn() { return cmp_two_pointers(); }
|
||||
void walk_obj() { return cmp_two_pointers(); }
|
||||
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ const uint8_t SHAPE_FN = 18u;
|
|||
const uint8_t SHAPE_OBJ = 19u;
|
||||
const uint8_t SHAPE_RES = 20u;
|
||||
const uint8_t SHAPE_VAR = 21u;
|
||||
const uint8_t SHAPE_UNIQ = 22u;
|
||||
|
||||
#ifdef _LP64
|
||||
const uint8_t SHAPE_PTR = SHAPE_U64;
|
||||
|
|
@ -244,6 +245,7 @@ private:
|
|||
void walk_vec();
|
||||
void walk_tag();
|
||||
void walk_box();
|
||||
void walk_uniq();
|
||||
void walk_struct();
|
||||
void walk_res();
|
||||
void walk_var();
|
||||
|
|
@ -346,6 +348,7 @@ ctxt<T>::walk() {
|
|||
case SHAPE_OBJ: WALK_SIMPLE(walk_obj); break;
|
||||
case SHAPE_RES: walk_res(); break;
|
||||
case SHAPE_VAR: walk_var(); break;
|
||||
case SHAPE_UNIQ: walk_uniq(); break;
|
||||
default: abort();
|
||||
}
|
||||
}
|
||||
|
|
@ -441,6 +444,17 @@ ctxt<T>::walk_box() {
|
|||
sp = end_sp;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ctxt<T>::walk_uniq() {
|
||||
uint16_t sp_size = get_u16_bump(sp);
|
||||
const uint8_t *end_sp = sp + sp_size;
|
||||
|
||||
static_cast<T *>(this)->walk_uniq();
|
||||
|
||||
sp = end_sp;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
ctxt<T>::walk_struct() {
|
||||
|
|
@ -760,6 +774,7 @@ protected:
|
|||
U end_dp;
|
||||
|
||||
void walk_box_contents();
|
||||
void walk_uniq_contents();
|
||||
void walk_fn_contents(ptr &dp);
|
||||
void walk_obj_contents(ptr &dp);
|
||||
void walk_variant(tag_info &tinfo, uint32_t variant);
|
||||
|
|
@ -790,6 +805,8 @@ public:
|
|||
|
||||
void walk_box() { DATA_SIMPLE(void *, walk_box()); }
|
||||
|
||||
void walk_uniq() { DATA_SIMPLE(void *, walk_uniq()); }
|
||||
|
||||
void walk_fn() {
|
||||
ALIGN_TO(alignof<void *>());
|
||||
U next_dp = dp + sizeof(void *) * 2;
|
||||
|
|
@ -834,6 +851,15 @@ data<T,U>::walk_box_contents() {
|
|||
static_cast<T *>(this)->walk_box_contents(sub, ref_count_dp);
|
||||
}
|
||||
|
||||
template<typename T,typename U>
|
||||
void
|
||||
data<T,U>::walk_uniq_contents() {
|
||||
typename U::template data<uint8_t *>::t box_ptr = bump_dp<uint8_t *>(dp);
|
||||
U data_ptr(box_ptr);
|
||||
T sub(*static_cast<T *>(this), data_ptr);
|
||||
static_cast<T *>(this)->walk_uniq_contents(sub);
|
||||
}
|
||||
|
||||
template<typename T,typename U>
|
||||
void
|
||||
data<T,U>::walk_variant(tag_info &tinfo, uint32_t variant_id) {
|
||||
|
|
@ -993,6 +1019,12 @@ private:
|
|||
data<log,ptr>::walk_box_contents();
|
||||
}
|
||||
|
||||
void walk_uniq() {
|
||||
out << prefix << "~";
|
||||
prefix = "";
|
||||
data<log,ptr>::walk_uniq_contents();
|
||||
}
|
||||
|
||||
void walk_fn() {
|
||||
out << prefix << "fn";
|
||||
prefix = "";
|
||||
|
|
@ -1017,6 +1049,12 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void walk_uniq_contents(log &sub) {
|
||||
out << prefix;
|
||||
sub.align = true;
|
||||
sub.walk();
|
||||
}
|
||||
|
||||
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,
|
||||
|
|
|
|||
8
src/test/run-pass/unique-cmp.rs
Normal file
8
src/test/run-pass/unique-cmp.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fn main() {
|
||||
let i = ~100;
|
||||
assert i == ~100;
|
||||
assert i < ~101;
|
||||
assert i <= ~100;
|
||||
assert i > ~99;
|
||||
assert i >= ~99;
|
||||
}
|
||||
4
src/test/run-pass/unique-log.rs
Normal file
4
src/test/run-pass/unique-log.rs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
fn main() {
|
||||
let i = ~100;
|
||||
log_err i;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue