Skip to content

Commit 5d0101f

Browse files
committed
---
yaml --- r: 15734 b: refs/heads/try c: 11a5d10 h: refs/heads/master v: v3
1 parent 0fc9c12 commit 5d0101f

File tree

8 files changed

+337
-47
lines changed

8 files changed

+337
-47
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: e1fc7d5f0126e4c213cac589bf301814e0327b9e
5+
refs/heads/try: 11a5d10bf2958c642ae6a7c4afff8e181aa2167d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rt/rust_box_annihilator.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,16 @@ class annihilator : public shape::data<annihilator,shape::ptr> {
4949
task->kernel->free(vec);
5050
}
5151

52+
void walk_fixedvec2(uint16_t sz, bool is_pod) {
53+
walk_vec2(is_pod, get_fixedvec_data_range(sz, dp));
54+
}
55+
5256
void walk_vec2(bool is_pod,
5357
const std::pair<shape::ptr,shape::ptr> &data_range) {
58+
59+
if (is_pod)
60+
return;
61+
5462
annihilator sub(*this, data_range.first);
5563
shape::ptr data_end = sub.end_dp = data_range.second;
5664
while (sub.dp < data_end) {
@@ -64,6 +72,10 @@ class annihilator : public shape::data<annihilator,shape::ptr> {
6472
::walk_variant1(tinfo, tag_variant);
6573
}
6674

75+
void walk_rptr2() { }
76+
77+
void walk_slice2(bool, bool) { }
78+
6779
void walk_uniq2() {
6880
void *x = *((void **)dp);
6981
// free contents first:

branches/try/src/rt/rust_cc.cpp

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,37 @@ class irc : public shape::data<irc,shape::ptr> {
7373
in_tables, in_data),
7474
ircs(in_ircs) {}
7575

76-
void walk_vec2(bool is_pod) {
77-
if (is_pod || shape::get_dp<void *>(dp) == NULL)
78-
return; // There can't be any outbound pointers from this.
7976

80-
std::pair<uint8_t *,uint8_t *> data_range(get_vec_data_range(dp));
77+
void walk_vec2(bool is_pod, std::pair<uint8_t *,uint8_t *> data_range) {
78+
79+
// There can't be any outbound pointers from pod.
80+
if (is_pod)
81+
return;
82+
8183
irc sub(*this, data_range.first);
8284
shape::ptr data_end = sub.end_dp = data_range.second;
8385
while (sub.dp < data_end) {
8486
sub.walk_reset();
87+
// FIXME: shouldn't this be 'sub.align = true;'?
8588
align = true;
8689
}
8790
}
8891

92+
void walk_vec2(bool is_pod) {
93+
if (shape::get_dp<void *>(dp) == NULL)
94+
return;
95+
96+
walk_vec2(is_pod, get_vec_data_range(dp));
97+
}
98+
99+
void walk_slice2(bool is_pod, bool is_str) {
100+
walk_vec2(is_pod, get_slice_data_range(is_str, dp));
101+
}
102+
103+
void walk_fixedvec2(uint16_t sz, bool is_pod) {
104+
walk_vec2(is_pod, get_fixedvec_data_range(sz, dp));
105+
}
106+
89107
void walk_tag2(shape::tag_info &tinfo, uint32_t tag_variant) {
90108
shape::data<irc,shape::ptr>::walk_variant1(tinfo, tag_variant);
91109
}
@@ -102,6 +120,10 @@ class irc : public shape::data<irc,shape::ptr> {
102120
shape::data<irc,shape::ptr>::walk_uniq_contents1();
103121
}
104122

123+
void walk_rptr2() {
124+
shape::data<irc,shape::ptr>::walk_rptr_contents1();
125+
}
126+
105127
void walk_fn2(char code) {
106128
switch (code) {
107129
case shape::SHAPE_BOX_FN: {
@@ -137,6 +159,8 @@ class irc : public shape::data<irc,shape::ptr> {
137159

138160
void walk_uniq_contents2(irc &sub) { sub.walk(); }
139161

162+
void walk_rptr_contents2(irc &sub) { sub.walk(); }
163+
140164
void walk_box_contents2(irc &sub) {
141165
maybe_record_irc();
142166

@@ -305,11 +329,12 @@ class mark : public shape::data<mark,shape::ptr> {
305329
in_tables, in_data),
306330
marked(in_marked) {}
307331

308-
void walk_vec2(bool is_pod) {
309-
if (is_pod || shape::get_dp<void *>(dp) == NULL)
310-
return; // There can't be any outbound pointers from this.
332+
void walk_vec2(bool is_pod, std::pair<uint8_t *,uint8_t *> data_range) {
333+
334+
// There can't be any outbound pointers from pod.
335+
if (is_pod)
336+
return;
311337

312-
std::pair<uint8_t *,uint8_t *> data_range(get_vec_data_range(dp));
313338
if (data_range.second - data_range.first > 100000)
314339
abort(); // FIXME: Temporary sanity check.
315340

@@ -321,6 +346,20 @@ class mark : public shape::data<mark,shape::ptr> {
321346
}
322347
}
323348

349+
void walk_vec2(bool is_pod) {
350+
if (shape::get_dp<void *>(dp) == NULL)
351+
return;
352+
walk_vec2(is_pod, get_vec_data_range(dp));
353+
}
354+
355+
void walk_slice2(bool is_pod, bool is_str) {
356+
walk_vec2(is_pod, get_slice_data_range(is_str, dp));
357+
}
358+
359+
void walk_fixedvec2(uint16_t sz, bool is_pod) {
360+
walk_vec2(is_pod, get_fixedvec_data_range(sz, dp));
361+
}
362+
324363
void walk_tag2(shape::tag_info &tinfo, uint32_t tag_variant) {
325364
shape::data<mark,shape::ptr>::walk_variant1(tinfo, tag_variant);
326365
}
@@ -337,6 +376,10 @@ class mark : public shape::data<mark,shape::ptr> {
337376
shape::data<mark,shape::ptr>::walk_uniq_contents1();
338377
}
339378

379+
void walk_rptr2() {
380+
shape::data<mark,shape::ptr>::walk_rptr_contents1();
381+
}
382+
340383
void walk_fn2(char code) {
341384
switch (code) {
342385
case shape::SHAPE_BOX_FN: {
@@ -372,6 +415,8 @@ class mark : public shape::data<mark,shape::ptr> {
372415

373416
void walk_uniq_contents2(mark &sub) { sub.walk(); }
374417

418+
void walk_rptr_contents2(mark &sub) { sub.walk(); }
419+
375420
void walk_box_contents2(mark &sub) {
376421
rust_opaque_box *box_ptr = *(rust_opaque_box **) dp;
377422

branches/try/src/rt/rust_shape.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,9 @@ class cmp : public data<cmp,ptr_pair> {
254254
friend class data<cmp,ptr_pair>;
255255

256256
private:
257+
void walk_slice2(bool is_pod,
258+
const std::pair<ptr_pair,ptr_pair> &data_range);
259+
257260
void walk_vec2(bool is_pod,
258261
const std::pair<ptr_pair,ptr_pair> &data_range);
259262

@@ -274,6 +277,12 @@ class cmp : public data<cmp,ptr_pair> {
274277
result = sub.result;
275278
}
276279

280+
inline void walk_rptr_contents2(cmp &sub) {
281+
sub.align = true;
282+
sub.walk();
283+
result = sub.result;
284+
}
285+
277286
inline void cmp_two_pointers() {
278287
ALIGN_TO(rust_alignof<void *>());
279288
data_pair<uint8_t *> fst = bump_dp<uint8_t *>(dp);
@@ -341,6 +350,16 @@ class cmp : public data<cmp,ptr_pair> {
341350
walk_vec2(is_pod, get_vec_data_range(dp));
342351
}
343352

353+
void walk_slice2(bool is_pod, bool is_str) {
354+
// Slices compare just like vecs.
355+
walk_vec2(is_pod, get_slice_data_range(is_str, dp));
356+
}
357+
358+
void walk_fixedvec2(uint16_t sz, bool is_pod) {
359+
// Fixedvecs compare just like vecs.
360+
walk_vec2(is_pod, get_fixedvec_data_range(sz, dp));
361+
}
362+
344363
void walk_box2() {
345364
data<cmp,ptr_pair>::walk_box_contents1();
346365
}
@@ -349,6 +368,10 @@ class cmp : public data<cmp,ptr_pair> {
349368
data<cmp,ptr_pair>::walk_uniq_contents1();
350369
}
351370

371+
void walk_rptr2() {
372+
data<cmp,ptr_pair>::walk_rptr_contents1();
373+
}
374+
352375
void walk_iface2() {
353376
data<cmp,ptr_pair>::walk_box_contents1();
354377
}

0 commit comments

Comments
 (0)