}
}
-// FIXME (#2667) this no longer reflects the actual structure of boxes!
-struct rust_box {
- RUST_REFCOUNTED(rust_box)
-
- // FIXME (#2667) `data` could be aligned differently from the actual
- // box body data
- uint8_t data[];
-};
-
extern "C" CDECL void
-debug_box(type_desc *t, rust_box *box) {
+debug_box(type_desc *t, rust_opaque_box *box) {
rust_task *task = rust_get_current_task();
LOG(task, stdlib, "debug_box(0x%" PRIxPTR ")", box);
debug_tydesc_helper(t);
LOG(task, stdlib, " refcount %" PRIdPTR,
box->ref_count - 1); // -1 because we ref'ed for this call
+ uint8_t *data = (uint8_t *)box_body(box);
for (uintptr_t i = 0; i < t->size; ++i) {
- LOG(task, stdlib, " byte %" PRIdPTR ": 0x%" PRIx8, i, box->data[i]);
+ LOG(task, stdlib, " byte %" PRIdPTR ": 0x%" PRIx8, i, data[i]);
}
}
tag->variant[i]);
}
-struct rust_fn {
- uintptr_t *thunk;
- rust_box *closure;
-};
-
extern "C" CDECL void
-debug_fn(type_desc *t, rust_fn *fn) {
+debug_fn(type_desc *t, fn_env_pair *fn) {
rust_task *task = rust_get_current_task();
LOG(task, stdlib, "debug_fn");
debug_tydesc_helper(t);
- LOG(task, stdlib, " thunk at 0x%" PRIxPTR, fn->thunk);
- LOG(task, stdlib, " closure at 0x%" PRIxPTR, fn->closure);
- if (fn->closure) {
- LOG(task, stdlib, " refcount %" PRIdPTR, fn->closure->ref_count);
+ LOG(task, stdlib, " fn at 0x%" PRIxPTR, fn->f);
+ LOG(task, stdlib, " env at 0x%" PRIxPTR, fn->env);
+ if (fn->env) {
+ LOG(task, stdlib, " refcount %" PRIdPTR, fn->env->ref_count);
}
}
extern "C" CDECL FILE* rust_get_stdout() {return stdout;}
extern "C" CDECL FILE* rust_get_stderr() {return stderr;}
-extern "C" CDECL int
-rust_ptr_eq(type_desc *t, rust_box *a, rust_box *b) {
- return a == b;
-}
-
#if defined(__WIN32__)
extern "C" CDECL void
get_time(int64_t *sec, int32_t *nsec) {