Skip to content

Commit b226206

Browse files
committed
Get rid of a bunch of dead shape code. Closes #2552.
1 parent 70b79d1 commit b226206

File tree

5 files changed

+69
-310
lines changed

5 files changed

+69
-310
lines changed

src/rt/rust_box_annihilator.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,36 @@ class annihilator : public shape::data<annihilator,shape::ptr> {
88

99
annihilator(const annihilator &other, const shape::ptr &in_dp)
1010
: shape::data<annihilator,shape::ptr>(other.task, other.align,
11-
other.sp, other.params,
11+
other.sp,
1212
other.tables, in_dp) {}
1313

1414
annihilator(const annihilator &other,
1515
const uint8_t *in_sp,
16-
const shape::type_param *in_params,
1716
const rust_shape_tables *in_tables = NULL)
1817
: shape::data<annihilator,shape::ptr>(other.task,
1918
other.align,
2019
in_sp,
21-
in_params,
2220
in_tables ? in_tables : other.tables,
2321
other.dp) {}
2422

2523
annihilator(const annihilator &other,
2624
const uint8_t *in_sp,
27-
const shape::type_param *in_params,
2825
const rust_shape_tables *in_tables,
2926
shape::ptr in_dp)
3027
: shape::data<annihilator,shape::ptr>(other.task,
3128
other.align,
3229
in_sp,
33-
in_params,
3430
in_tables,
3531
in_dp) {}
3632

3733
annihilator(rust_task *in_task,
3834
bool in_align,
3935
const uint8_t *in_sp,
40-
const shape::type_param *in_params,
4136
const rust_shape_tables *in_tables,
4237
uint8_t *in_data)
4338
: shape::data<annihilator,shape::ptr>(in_task, in_align, in_sp,
44-
in_params, in_tables, in_data) {}
39+
in_tables,
40+
shape::ptr(in_data)) {}
4541

4642
void walk_vec2(bool is_pod) {
4743
void *vec = shape::get_dp<void *>(dp);
@@ -145,8 +141,7 @@ class annihilator : public shape::data<annihilator,shape::ptr> {
145141
f(NULL, args->dtor->env, args->data);
146142
}
147143

148-
void walk_res2(const shape::rust_fn *dtor, unsigned n_params,
149-
const shape::type_param *params, const uint8_t *end_sp,
144+
void walk_res2(const shape::rust_fn *dtor, const uint8_t *end_sp,
150145
bool live) {
151146
void *data = (void*)(uintptr_t)dp;
152147
// Switch back to the Rust stack to run the destructor
@@ -173,7 +168,7 @@ class annihilator : public shape::data<annihilator,shape::ptr> {
173168
void walk_variant2(shape::tag_info &tinfo, uint32_t variant_id,
174169
const std::pair<const uint8_t *,const uint8_t *>
175170
variant_ptr_and_end) {
176-
annihilator sub(*this, variant_ptr_and_end.first, tinfo.params);
171+
annihilator sub(*this, variant_ptr_and_end.first);
177172

178173
const uint8_t *variant_end = variant_ptr_and_end.second;
179174
while (sub.sp < variant_end) {
@@ -194,11 +189,9 @@ annihilator::do_annihilate(rust_task *task, rust_opaque_box *box) {
194189
const type_desc *tydesc = box->td;
195190
uint8_t *p = (uint8_t*) box_body(box);
196191
shape::arena arena;
197-
shape::type_param *params =
198-
shape::type_param::from_tydesc_and_data(tydesc, p, arena);
199192

200193
annihilator annihilator(task, true, tydesc->shape,
201-
params, tydesc->shape_tables, p);
194+
tydesc->shape_tables, p);
202195
annihilator.walk();
203196
task->boxed.free(box);
204197
}

src/rt/rust_cc.cpp

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -34,44 +34,39 @@ class irc : public shape::data<irc,shape::ptr> {
3434

3535
irc(const irc &other, const shape::ptr &in_dp)
3636
: shape::data<irc,shape::ptr>(other.task, other.align, other.sp,
37-
other.params, other.tables, in_dp),
37+
other.tables, in_dp),
3838
ircs(other.ircs) {}
3939

4040
irc(const irc &other,
4141
const uint8_t *in_sp,
42-
const shape::type_param *in_params,
4342
const rust_shape_tables *in_tables = NULL)
4443
: shape::data<irc,shape::ptr>(other.task,
4544
other.align,
4645
in_sp,
47-
in_params,
4846
in_tables ? in_tables : other.tables,
4947
other.dp),
5048
ircs(other.ircs) {}
5149

5250
irc(const irc &other,
5351
const uint8_t *in_sp,
54-
const shape::type_param *in_params,
5552
const rust_shape_tables *in_tables,
5653
shape::ptr in_dp)
5754
: shape::data<irc,shape::ptr>(other.task,
5855
other.align,
5956
in_sp,
60-
in_params,
6157
in_tables,
6258
in_dp),
6359
ircs(other.ircs) {}
6460

6561
irc(rust_task *in_task,
6662
bool in_align,
6763
const uint8_t *in_sp,
68-
const shape::type_param *in_params,
6964
const rust_shape_tables *in_tables,
7065
uint8_t *in_data,
7166
irc_map &in_ircs)
72-
: shape::data<irc,shape::ptr>(in_task, in_align, in_sp, in_params,
73-
in_tables, in_data),
74-
ircs(in_ircs) {}
67+
: shape::data<irc,shape::ptr>(in_task, in_align, in_sp,
68+
in_tables, shape::ptr(in_data)),
69+
ircs(in_ircs) {}
7570

7671

7772
void walk_vec2(bool is_pod, std::pair<uint8_t *,uint8_t *> data_range) {
@@ -80,8 +75,8 @@ class irc : public shape::data<irc,shape::ptr> {
8075
if (is_pod)
8176
return;
8277

83-
irc sub(*this, data_range.first);
84-
shape::ptr data_end = sub.end_dp = data_range.second;
78+
irc sub(*this, shape::ptr(data_range.first));
79+
shape::ptr data_end = sub.end_dp = shape::ptr(data_range.second);
8580
while (sub.dp < data_end) {
8681
sub.walk_reset();
8782
// FIXME: shouldn't this be 'sub.align = true;'?
@@ -148,8 +143,7 @@ class irc : public shape::data<irc,shape::ptr> {
148143
void walk_tydesc2(char) {
149144
}
150145

151-
void walk_res2(const shape::rust_fn *dtor, unsigned n_params,
152-
const shape::type_param *params, const uint8_t *end_sp,
146+
void walk_res2(const shape::rust_fn *dtor, const uint8_t *end_sp,
153147
bool live) {
154148
while (this->sp != end_sp) {
155149
this->walk();
@@ -214,7 +208,7 @@ void
214208
irc::walk_variant2(shape::tag_info &tinfo, uint32_t variant_id,
215209
const std::pair<const uint8_t *,const uint8_t *>
216210
variant_ptr_and_end) {
217-
irc sub(*this, variant_ptr_and_end.first, tinfo.params);
211+
irc sub(*this, variant_ptr_and_end.first);
218212

219213
assert(variant_id < 256); // FIXME: Temporary sanity check.
220214

@@ -240,10 +234,8 @@ irc::compute_ircs(rust_task *task, irc_map &ircs) {
240234
box, tydesc, body);
241235

242236
shape::arena arena;
243-
shape::type_param *params =
244-
shape::type_param::from_tydesc_and_data(tydesc, body, arena);
245237

246-
irc irc(task, true, tydesc->shape, params, tydesc->shape_tables,
238+
irc irc(task, true, tydesc->shape, tydesc->shape_tables,
247239
body, ircs);
248240
irc.walk();
249241
}
@@ -292,43 +284,38 @@ class mark : public shape::data<mark,shape::ptr> {
292284

293285
mark(const mark &other, const shape::ptr &in_dp)
294286
: shape::data<mark,shape::ptr>(other.task, other.align, other.sp,
295-
other.params, other.tables, in_dp),
287+
other.tables, in_dp),
296288
marked(other.marked) {}
297289

298290
mark(const mark &other,
299291
const uint8_t *in_sp,
300-
const shape::type_param *in_params,
301292
const rust_shape_tables *in_tables = NULL)
302293
: shape::data<mark,shape::ptr>(other.task,
303294
other.align,
304295
in_sp,
305-
in_params,
306296
in_tables ? in_tables : other.tables,
307297
other.dp),
308298
marked(other.marked) {}
309299

310300
mark(const mark &other,
311301
const uint8_t *in_sp,
312-
const shape::type_param *in_params,
313302
const rust_shape_tables *in_tables,
314303
shape::ptr in_dp)
315304
: shape::data<mark,shape::ptr>(other.task,
316305
other.align,
317306
in_sp,
318-
in_params,
319307
in_tables,
320308
in_dp),
321309
marked(other.marked) {}
322310

323311
mark(rust_task *in_task,
324312
bool in_align,
325313
const uint8_t *in_sp,
326-
const shape::type_param *in_params,
327314
const rust_shape_tables *in_tables,
328315
uint8_t *in_data,
329316
std::set<rust_opaque_box*> &in_marked)
330-
: shape::data<mark,shape::ptr>(in_task, in_align, in_sp, in_params,
331-
in_tables, in_data),
317+
: shape::data<mark,shape::ptr>(in_task, in_align, in_sp,
318+
in_tables, shape::ptr(in_data)),
332319
marked(in_marked) {}
333320

334321
void walk_vec2(bool is_pod, std::pair<uint8_t *,uint8_t *> data_range) {
@@ -340,8 +327,8 @@ class mark : public shape::data<mark,shape::ptr> {
340327
if (data_range.second - data_range.first > 100000)
341328
abort(); // FIXME: Temporary sanity check.
342329

343-
mark sub(*this, data_range.first);
344-
shape::ptr data_end = sub.end_dp = data_range.second;
330+
mark sub(*this, shape::ptr(data_range.first));
331+
shape::ptr data_end = sub.end_dp = shape::ptr(data_range.second);
345332
while (sub.dp < data_end) {
346333
sub.walk_reset();
347334
align = true;
@@ -399,9 +386,8 @@ class mark : public shape::data<mark,shape::ptr> {
399386
}
400387
}
401388

402-
void walk_res2(const shape::rust_fn *dtor, unsigned n_params,
403-
const shape::type_param *params, const uint8_t *end_sp,
404-
bool live) {
389+
void walk_res2(const shape::rust_fn *dtor, const uint8_t *end_sp,
390+
bool live) {
405391
while (this->sp != end_sp) {
406392
this->walk();
407393
align = true;
@@ -458,7 +444,7 @@ void
458444
mark::walk_variant2(shape::tag_info &tinfo, uint32_t variant_id,
459445
const std::pair<const uint8_t *,const uint8_t *>
460446
variant_ptr_and_end) {
461-
mark sub(*this, variant_ptr_and_end.first, tinfo.params);
447+
mark sub(*this, variant_ptr_and_end.first);
462448

463449
assert(variant_id < 256); // FIXME: Temporary sanity check.
464450

@@ -487,10 +473,8 @@ mark::do_mark(rust_task *task,
487473

488474
uint8_t *p = (uint8_t*) box_body(box);
489475
shape::arena arena;
490-
shape::type_param *params =
491-
shape::type_param::from_tydesc_and_data(tydesc, p, arena);
492476

493-
mark mark(task, true, tydesc->shape, params, tydesc->shape_tables,
477+
mark mark(task, true, tydesc->shape, tydesc->shape_tables,
494478
p, marked);
495479
mark.walk();
496480
}
@@ -543,8 +527,7 @@ do_final_cc(rust_task *task) {
543527
cerr << "Unreclaimed object found at " << (void*) box << ": ";
544528
const type_desc *td = box->td;
545529
shape::arena arena;
546-
shape::type_param *params = shape::type_param::from_tydesc(td, arena);
547-
shape::log log(task, true, td->shape, params, td->shape_tables,
530+
shape::log log(task, true, td->shape, td->shape_tables,
548531
(uint8_t*)box_body(box), cerr);
549532
log.walk();
550533
cerr << "\n";

0 commit comments

Comments
 (0)