6
6
extern " C" CDECL rust_str*
7
7
last_os_error (rust_task *task) {
8
8
rust_dom *dom = task->dom ;
9
- LOG (task, rust_log::TASK , " last_os_error()" );
9
+ LOG (task, task , " last_os_error()" );
10
10
11
11
#if defined(__WIN32__)
12
12
LPTSTR buf;
@@ -91,9 +91,8 @@ extern "C" CDECL rust_vec*
91
91
vec_alloc (rust_task *task, type_desc *t, type_desc *elem_t , size_t n_elts)
92
92
{
93
93
rust_dom *dom = task->dom ;
94
- LOG (task, rust_log::MEM | rust_log::STDLIB,
95
- " vec_alloc %" PRIdPTR " elements of size %" PRIdPTR,
96
- n_elts, elem_t ->size );
94
+ LOG (task, mem, " vec_alloc %" PRIdPTR " elements of size %" PRIdPTR,
95
+ n_elts, elem_t ->size );
97
96
size_t fill = n_elts * elem_t ->size ;
98
97
size_t alloc = next_power_of_two (sizeof (rust_vec) + fill);
99
98
void *mem = task->malloc (alloc, t->is_stateful ? t : NULL );
@@ -126,37 +125,34 @@ vec_len(rust_task *task, type_desc *ty, rust_vec *v)
126
125
extern " C" CDECL void
127
126
vec_len_set (rust_task *task, type_desc *ty, rust_vec *v, size_t len)
128
127
{
129
- LOG (task, rust_log::STDLIB,
130
- " vec_len_set(0x%" PRIxPTR " , %" PRIdPTR " ) on vec with "
131
- " alloc = %" PRIdPTR
132
- " , fill = %" PRIdPTR
133
- " , len = %" PRIdPTR
134
- " . New fill is %" PRIdPTR,
135
- v, len, v->alloc , v->fill , v->fill / ty->size , len * ty->size );
128
+ LOG (task, stdlib, " vec_len_set(0x%" PRIxPTR " , %" PRIdPTR " ) on vec with "
129
+ " alloc = %" PRIdPTR
130
+ " , fill = %" PRIdPTR
131
+ " , len = %" PRIdPTR
132
+ " . New fill is %" PRIdPTR,
133
+ v, len, v->alloc , v->fill , v->fill / ty->size , len * ty->size );
136
134
v->fill = len * ty->size ;
137
135
}
138
136
139
137
extern " C" CDECL void
140
138
vec_print_debug_info (rust_task *task, type_desc *ty, rust_vec *v)
141
139
{
142
- LOG (task, rust_log::STDLIB ,
143
- " vec_print_debug_info(0x%" PRIxPTR " )"
144
- " with tydesc 0x%" PRIxPTR
145
- " (size = %" PRIdPTR " , align = %" PRIdPTR " )"
146
- " alloc = %" PRIdPTR " , fill = %" PRIdPTR " , len = %" PRIdPTR
147
- " , data = ..." ,
148
- v,
149
- ty,
150
- ty->size ,
151
- ty->align ,
152
- v->alloc ,
153
- v->fill ,
154
- v->fill / ty->size );
140
+ LOG (task, stdlib ,
141
+ " vec_print_debug_info(0x%" PRIxPTR " )"
142
+ " with tydesc 0x%" PRIxPTR
143
+ " (size = %" PRIdPTR " , align = %" PRIdPTR " )"
144
+ " alloc = %" PRIdPTR " , fill = %" PRIdPTR " , len = %" PRIdPTR
145
+ " , data = ..." ,
146
+ v,
147
+ ty,
148
+ ty->size ,
149
+ ty->align ,
150
+ v->alloc ,
151
+ v->fill ,
152
+ v->fill / ty->size );
155
153
156
154
for (size_t i = 0 ; i < v->fill ; ++i) {
157
- LOG (task, rust_log::STDLIB,
158
- " %" PRIdPTR " : 0x%" PRIxPTR,
159
- i, v->data [i]);
155
+ LOG (task, stdlib, " %" PRIdPTR " : 0x%" PRIxPTR, i, v->data [i]);
160
156
}
161
157
}
162
158
@@ -306,29 +302,27 @@ task_sleep(rust_task *task, size_t time_in_us) {
306
302
static void
307
303
debug_tydesc_helper (rust_task *task, type_desc *t)
308
304
{
309
- LOG (task, rust_log::STDLIB,
310
- " size %" PRIdPTR " , align %" PRIdPTR
311
- " , stateful %" PRIdPTR " , first_param 0x%" PRIxPTR,
312
- t->size , t->align , t->is_stateful , t->first_param );
305
+ LOG (task, stdlib, " size %" PRIdPTR " , align %" PRIdPTR
306
+ " , stateful %" PRIdPTR " , first_param 0x%" PRIxPTR,
307
+ t->size , t->align , t->is_stateful , t->first_param );
313
308
}
314
309
315
310
extern " C" CDECL void
316
311
debug_tydesc (rust_task *task, type_desc *t)
317
312
{
318
- LOG (task, rust_log::STDLIB , " debug_tydesc" );
313
+ LOG (task, stdlib , " debug_tydesc" );
319
314
debug_tydesc_helper (task, t);
320
315
}
321
316
322
317
extern " C" CDECL void
323
318
debug_opaque (rust_task *task, type_desc *t, uint8_t *front)
324
319
{
325
- LOG (task, rust_log::STDLIB , " debug_opaque" );
320
+ LOG (task, stdlib , " debug_opaque" );
326
321
debug_tydesc_helper (task, t);
327
322
// FIXME may want to actually account for alignment. `front` may not
328
323
// indeed be the front byte of the passed-in argument.
329
324
for (uintptr_t i = 0 ; i < t->size ; ++front, ++i) {
330
- LOG (task, rust_log::STDLIB,
331
- " byte %" PRIdPTR " : 0x%" PRIx8, i, *front);
325
+ LOG (task, stdlib, " byte %" PRIdPTR " : 0x%" PRIx8, i, *front);
332
326
}
333
327
}
334
328
@@ -340,15 +334,14 @@ struct rust_box : rc_base<rust_box> {
340
334
extern " C" CDECL void
341
335
debug_box (rust_task *task, type_desc *t, rust_box *box)
342
336
{
343
- LOG (task, rust_log::STDLIB , " debug_box(0x%" PRIxPTR " )" , box);
337
+ LOG (task, stdlib , " debug_box(0x%" PRIxPTR " )" , box);
344
338
debug_tydesc_helper (task, t);
345
- LOG (task, rust_log::STDLIB , " refcount %" PRIdPTR,
346
- box->ref_count == CONST_REFCOUNT
347
- ? CONST_REFCOUNT
348
- : box->ref_count - 1 ); // -1 because we ref'ed for this call
339
+ LOG (task, stdlib , " refcount %" PRIdPTR,
340
+ box->ref_count == CONST_REFCOUNT
341
+ ? CONST_REFCOUNT
342
+ : box->ref_count - 1 ); // -1 because we ref'ed for this call
349
343
for (uintptr_t i = 0 ; i < t->size ; ++i) {
350
- LOG (task, rust_log::STDLIB,
351
- " byte %" PRIdPTR " : 0x%" PRIx8, i, box->data [i]);
344
+ LOG (task, stdlib, " byte %" PRIdPTR " : 0x%" PRIx8, i, box->data [i]);
352
345
}
353
346
}
354
347
@@ -360,14 +353,13 @@ struct rust_tag {
360
353
extern " C" CDECL void
361
354
debug_tag (rust_task *task, type_desc *t, rust_tag *tag)
362
355
{
363
- LOG (task, rust_log::STDLIB , " debug_tag" );
356
+ LOG (task, stdlib , " debug_tag" );
364
357
debug_tydesc_helper (task, t);
365
- LOG (task, rust_log::STDLIB,
366
- " discriminant %" PRIdPTR, tag->discriminant );
358
+ LOG (task, stdlib, " discriminant %" PRIdPTR, tag->discriminant );
367
359
368
360
for (uintptr_t i = 0 ; i < t->size - sizeof (tag->discriminant ); ++i)
369
- LOG (task, rust_log::STDLIB ,
370
- " byte % " PRIdPTR " : 0x% " PRIx8, i, tag->variant [i]);
361
+ LOG (task, stdlib, " byte % " PRIdPTR " : 0x% " PRIx8, i ,
362
+ tag->variant [i]);
371
363
}
372
364
373
365
struct rust_obj {
@@ -379,19 +371,17 @@ extern "C" CDECL void
379
371
debug_obj (rust_task *task, type_desc *t, rust_obj *obj,
380
372
size_t nmethods, size_t nbytes)
381
373
{
382
- LOG (task, rust_log::STDLIB,
383
- " debug_obj with %" PRIdPTR " methods" , nmethods);
374
+ LOG (task, stdlib, " debug_obj with %" PRIdPTR " methods" , nmethods);
384
375
debug_tydesc_helper (task, t);
385
- LOG (task, rust_log::STDLIB , " vtbl at 0x%" PRIxPTR, obj->vtbl );
386
- LOG (task, rust_log::STDLIB , " body at 0x%" PRIxPTR, obj->body );
376
+ LOG (task, stdlib , " vtbl at 0x%" PRIxPTR, obj->vtbl );
377
+ LOG (task, stdlib , " body at 0x%" PRIxPTR, obj->body );
387
378
388
379
for (uintptr_t *p = obj->vtbl ; p < obj->vtbl + nmethods; ++p)
389
- LOG (task, rust_log::STDLIB , " vtbl word: 0x%" PRIxPTR, *p);
380
+ LOG (task, stdlib , " vtbl word: 0x%" PRIxPTR, *p);
390
381
391
382
for (uintptr_t i = 0 ; i < nbytes; ++i)
392
- LOG (task, rust_log::STDLIB,
393
- " body byte %" PRIdPTR " : 0x%" PRIxPTR,
394
- i, obj->body ->data [i]);
383
+ LOG (task, stdlib, " body byte %" PRIdPTR " : 0x%" PRIxPTR,
384
+ i, obj->body ->data [i]);
395
385
}
396
386
397
387
struct rust_fn {
@@ -402,13 +392,12 @@ struct rust_fn {
402
392
extern " C" CDECL void
403
393
debug_fn (rust_task *task, type_desc *t, rust_fn *fn)
404
394
{
405
- LOG (task, rust_log::STDLIB , " debug_fn" );
395
+ LOG (task, stdlib , " debug_fn" );
406
396
debug_tydesc_helper (task, t);
407
- LOG (task, rust_log::STDLIB , " thunk at 0x%" PRIxPTR, fn->thunk );
408
- LOG (task, rust_log::STDLIB , " closure at 0x%" PRIxPTR, fn->closure );
397
+ LOG (task, stdlib , " thunk at 0x%" PRIxPTR, fn->thunk );
398
+ LOG (task, stdlib , " closure at 0x%" PRIxPTR, fn->closure );
409
399
if (fn->closure ) {
410
- LOG (task, rust_log::STDLIB, " refcount %" PRIdPTR,
411
- fn->closure ->ref_count );
400
+ LOG (task, stdlib, " refcount %" PRIdPTR, fn->closure ->ref_count );
412
401
}
413
402
}
414
403
@@ -418,17 +407,17 @@ debug_ptrcast(rust_task *task,
418
407
type_desc *to_ty,
419
408
void *ptr)
420
409
{
421
- LOG (task, rust_log::STDLIB , " debug_ptrcast from" );
410
+ LOG (task, stdlib , " debug_ptrcast from" );
422
411
debug_tydesc_helper (task, from_ty);
423
- LOG (task, rust_log::STDLIB , " to" );
412
+ LOG (task, stdlib , " to" );
424
413
debug_tydesc_helper (task, to_ty);
425
414
return ptr;
426
415
}
427
416
428
417
extern " C" CDECL void
429
418
debug_trap (rust_task *task, rust_str *s)
430
419
{
431
- LOG (task, rust_log::STDLIB , " trapping: %s" , s->data );
420
+ LOG (task, stdlib , " trapping: %s" , s->data );
432
421
// FIXME: x86-ism.
433
422
__asm__ (" int3" );
434
423
}
0 commit comments