@@ -241,32 +241,26 @@ debug_opaque(type_desc *t, uint8_t *front) {
241
241
rust_task *task = rust_get_current_task ();
242
242
LOG (task, stdlib, " debug_opaque" );
243
243
debug_tydesc_helper (t);
244
- // FIXME (#2667) may want to actually account for alignment.
245
- // `front` may not indeed be the front byte of the passed-in
246
- // argument.
244
+ // Account for alignment. `front` may not indeed be the
245
+ // front byte of the passed-in argument
246
+ if (((uintptr_t )front % t->align ) != 0 ) {
247
+ front = (uint8_t *)align_to ((uintptr_t )front, (size_t )t->align );
248
+ }
247
249
for (uintptr_t i = 0 ; i < t->size ; ++front, ++i) {
248
250
LOG (task, stdlib, " byte %" PRIdPTR " : 0x%" PRIx8, i, *front);
249
251
}
250
252
}
251
253
252
- // FIXME (#2667) this no longer reflects the actual structure of boxes!
253
- struct rust_box {
254
- RUST_REFCOUNTED (rust_box)
255
-
256
- // FIXME (#2667) `data` could be aligned differently from the actual
257
- // box body data
258
- uint8_t data[];
259
- };
260
-
261
254
extern " C" CDECL void
262
- debug_box (type_desc *t, rust_box *box) {
255
+ debug_box (type_desc *t, rust_opaque_box *box) {
263
256
rust_task *task = rust_get_current_task ();
264
257
LOG (task, stdlib, " debug_box(0x%" PRIxPTR " )" , box);
265
258
debug_tydesc_helper (t);
266
259
LOG (task, stdlib, " refcount %" PRIdPTR,
267
260
box->ref_count - 1 ); // -1 because we ref'ed for this call
261
+ uint8_t *data = (uint8_t *)box_body (box);
268
262
for (uintptr_t i = 0 ; i < t->size ; ++i) {
269
- LOG (task, stdlib, " byte %" PRIdPTR " : 0x%" PRIx8, i, box-> data [i]);
263
+ LOG (task, stdlib, " byte %" PRIdPTR " : 0x%" PRIx8, i, data[i]);
270
264
}
271
265
}
272
266
@@ -288,20 +282,15 @@ debug_tag(type_desc *t, rust_tag *tag) {
288
282
tag->variant [i]);
289
283
}
290
284
291
- struct rust_fn {
292
- uintptr_t *thunk;
293
- rust_box *closure;
294
- };
295
-
296
285
extern " C" CDECL void
297
- debug_fn (type_desc *t, rust_fn *fn) {
286
+ debug_fn (type_desc *t, fn_env_pair *fn) {
298
287
rust_task *task = rust_get_current_task ();
299
288
LOG (task, stdlib, " debug_fn" );
300
289
debug_tydesc_helper (t);
301
- LOG (task, stdlib, " thunk at 0x%" PRIxPTR, fn->thunk );
302
- LOG (task, stdlib, " closure at 0x%" PRIxPTR, fn->closure );
303
- if (fn->closure ) {
304
- LOG (task, stdlib, " refcount %" PRIdPTR, fn->closure ->ref_count );
290
+ LOG (task, stdlib, " fn at 0x%" PRIxPTR, fn->f );
291
+ LOG (task, stdlib, " env at 0x%" PRIxPTR, fn->env );
292
+ if (fn->env ) {
293
+ LOG (task, stdlib, " refcount %" PRIdPTR, fn->env ->ref_count );
305
294
}
306
295
}
307
296
@@ -389,11 +378,6 @@ extern "C" CDECL FILE* rust_get_stdin() {return stdin;}
389
378
extern " C" CDECL FILE* rust_get_stdout () {return stdout;}
390
379
extern " C" CDECL FILE* rust_get_stderr () {return stderr;}
391
380
392
- extern " C" CDECL int
393
- rust_ptr_eq (type_desc *t, rust_box *a, rust_box *b) {
394
- return a == b;
395
- }
396
-
397
381
#if defined(__WIN32__)
398
382
extern " C" CDECL void
399
383
get_time (int64_t *sec, int32_t *nsec) {
0 commit comments