@@ -37,32 +37,38 @@ log_task_state(rust_task *task, maybe_proxy<rust_task> *target) {
37
37
}
38
38
}
39
39
40
- extern " C" CDECL char const *str_buf (rust_task *task, rust_str *s);
40
+ extern " C" CDECL char const *
41
+ str_buf (rust_task *task, rust_str *s);
41
42
42
- extern " C" void upcall_grow_task (rust_task *task, size_t n_frame_bytes) {
43
+ extern " C" void
44
+ upcall_grow_task (rust_task *task, size_t n_frame_bytes) {
43
45
LOG_UPCALL_ENTRY (task);
44
46
task->grow (n_frame_bytes);
45
47
}
46
48
47
- extern " C" CDECL void upcall_log_int (rust_task *task, int32_t i) {
49
+ extern " C" CDECL
50
+ void upcall_log_int (rust_task *task, int32_t i) {
48
51
LOG_UPCALL_ENTRY (task);
49
52
task->log (rust_log::UPCALL | rust_log::ULOG,
50
53
" rust: %" PRId32 " (0x%" PRIx32 " )" , i, i);
51
54
}
52
55
53
- extern " C" CDECL void upcall_log_str (rust_task *task, rust_str *str) {
56
+ extern " C" CDECL void
57
+ upcall_log_str (rust_task *task, rust_str *str) {
54
58
LOG_UPCALL_ENTRY (task);
55
59
const char *c = str_buf (task, str);
56
60
task->log (rust_log::UPCALL | rust_log::ULOG, " rust: %s" , c);
57
61
}
58
62
59
- extern " C" CDECL void upcall_trace_word (rust_task *task, uintptr_t i) {
63
+ extern " C" CDECL void
64
+ upcall_trace_word (rust_task *task, uintptr_t i) {
60
65
LOG_UPCALL_ENTRY (task);
61
66
task->log (rust_log::UPCALL | rust_log::TRACE, " trace: 0x%" PRIxPTR " " , i,
62
67
i, (char ) i);
63
68
}
64
69
65
- extern " C" CDECL void upcall_trace_str (rust_task *task, char const *c) {
70
+ extern " C" CDECL void
71
+ upcall_trace_str (rust_task *task, char const *c) {
66
72
LOG_UPCALL_ENTRY (task);
67
73
task->log (rust_log::UPCALL | rust_log::TRACE, " trace: %s" , c);
68
74
}
@@ -77,7 +83,8 @@ upcall_new_port(rust_task *task, size_t unit_sz) {
77
83
return new (dom) rust_port (task, unit_sz);
78
84
}
79
85
80
- extern " C" CDECL void upcall_del_port (rust_task *task, rust_port *port) {
86
+ extern " C" CDECL void
87
+ upcall_del_port (rust_task *task, rust_port *port) {
81
88
LOG_UPCALL_ENTRY (task);
82
89
task->log (rust_log::UPCALL | rust_log::MEM | rust_log::COMM,
83
90
" upcall del_port(0x%" PRIxPTR " )" , (uintptr_t ) port);
@@ -117,7 +124,8 @@ upcall_flush_chan(rust_task *task, rust_chan *chan) {
117
124
* Cannot Yield: If the task were to unwind, the dropped ref would still
118
125
* appear to be live, causing modify-after-free errors.
119
126
*/
120
- extern " C" CDECL void upcall_del_chan (rust_task *task, rust_chan *chan) {
127
+ extern " C" CDECL
128
+ void upcall_del_chan (rust_task *task, rust_chan *chan) {
121
129
LOG_UPCALL_ENTRY (task);
122
130
123
131
task->log (rust_log::UPCALL | rust_log::MEM | rust_log::COMM,
@@ -166,13 +174,15 @@ upcall_clone_chan(rust_task *task,
166
174
return new (target_task->dom ) rust_chan (target_task, port);
167
175
}
168
176
169
- extern " C" CDECL void upcall_yield (rust_task *task) {
177
+ extern " C" CDECL void
178
+ upcall_yield (rust_task *task) {
170
179
LOG_UPCALL_ENTRY (task);
171
180
task->log (rust_log::UPCALL | rust_log::COMM, " upcall yield()" );
172
181
task->yield (1 );
173
182
}
174
183
175
- extern " C" CDECL void upcall_sleep (rust_task *task, size_t time_in_us) {
184
+ extern " C" CDECL void
185
+ upcall_sleep (rust_task *task, size_t time_in_us) {
176
186
LOG_UPCALL_ENTRY (task);
177
187
task->log (rust_log::UPCALL | rust_log::TASK, " elapsed %d" ,
178
188
task->yield_timer .get_elapsed_time ());
@@ -242,8 +252,11 @@ upcall_recv(rust_task *task, uintptr_t *dptr, rust_port *port) {
242
252
task->yield (3 );
243
253
}
244
254
245
- extern " C" CDECL void upcall_fail (rust_task *task, char const *expr,
246
- char const *file, size_t line) {
255
+ extern " C" CDECL void
256
+ upcall_fail (rust_task *task,
257
+ char const *expr,
258
+ char const *file,
259
+ size_t line) {
247
260
LOG_UPCALL_ENTRY (task);
248
261
task->log (rust_log::UPCALL | rust_log::ERR,
249
262
" upcall fail '%s', %s:%" PRIdPTR, expr, file, line);
@@ -290,8 +303,7 @@ upcall_exit(rust_task *task) {
290
303
}
291
304
292
305
extern " C" CDECL uintptr_t
293
- upcall_malloc (rust_task *task, size_t nbytes, type_desc *td)
294
- {
306
+ upcall_malloc (rust_task *task, size_t nbytes, type_desc *td) {
295
307
LOG_UPCALL_ENTRY (task);
296
308
297
309
task->dom ->log (rust_log::UPCALL|rust_log::MEM,
@@ -311,8 +323,7 @@ upcall_malloc(rust_task *task, size_t nbytes, type_desc *td)
311
323
* Called whenever an object's ref count drops to zero.
312
324
*/
313
325
extern " C" CDECL void
314
- upcall_free (rust_task *task, void * ptr, uintptr_t is_gc)
315
- {
326
+ upcall_free (rust_task *task, void * ptr, uintptr_t is_gc) {
316
327
LOG_UPCALL_ENTRY (task);
317
328
rust_dom *dom = task->dom ;
318
329
dom->log (rust_log::UPCALL|rust_log::MEM,
@@ -322,8 +333,7 @@ upcall_free(rust_task *task, void* ptr, uintptr_t is_gc)
322
333
}
323
334
324
335
extern " C" CDECL uintptr_t
325
- upcall_mark (rust_task *task, void * ptr)
326
- {
336
+ upcall_mark (rust_task *task, void * ptr) {
327
337
LOG_UPCALL_ENTRY (task);
328
338
329
339
rust_dom *dom = task->dom ;
@@ -356,8 +366,7 @@ upcall_new_str(rust_task *task, char const *s, size_t fill) {
356
366
}
357
367
358
368
extern " C" CDECL rust_vec *
359
- upcall_new_vec (rust_task *task, size_t fill, type_desc *td)
360
- {
369
+ upcall_new_vec (rust_task *task, size_t fill, type_desc *td) {
361
370
LOG_UPCALL_ENTRY (task);
362
371
rust_dom *dom = task->dom ;
363
372
dom->log (rust_log::UPCALL|rust_log::MEM,
@@ -376,8 +385,10 @@ upcall_new_vec(rust_task *task, size_t fill, type_desc *td)
376
385
}
377
386
378
387
extern " C" CDECL rust_str *
379
- upcall_vec_grow (rust_task *task, rust_vec *v, size_t n_bytes, uintptr_t is_gc)
380
- {
388
+ upcall_vec_grow (rust_task *task,
389
+ rust_vec *v,
390
+ size_t n_bytes,
391
+ uintptr_t is_gc) {
381
392
LOG_UPCALL_ENTRY (task);
382
393
rust_dom *dom = task->dom ;
383
394
task->log (rust_log::UPCALL|rust_log::MEM,
@@ -419,18 +430,25 @@ upcall_vec_grow(rust_task *task, rust_vec *v, size_t n_bytes, uintptr_t is_gc)
419
430
}
420
431
421
432
static rust_crate_cache::c_sym *
422
- fetch_c_sym (rust_task *task, rust_crate const *curr_crate, size_t lib_num,
423
- size_t c_sym_num, char const *library, char const *symbol) {
433
+ fetch_c_sym (rust_task *task,
434
+ rust_crate const *curr_crate,
435
+ size_t lib_num,
436
+ size_t c_sym_num,
437
+ char const *library,
438
+ char const *symbol) {
424
439
rust_crate_cache *cache = task->get_crate_cache (curr_crate);
425
440
rust_crate_cache::lib *l = cache->get_lib (lib_num, library);
426
441
return cache->get_c_sym (c_sym_num, l, symbol);
427
442
}
428
443
429
- extern " C" CDECL uintptr_t upcall_require_rust_sym (rust_task *task,
430
- rust_crate const *curr_crate, size_t lib_num, // # of lib
431
- size_t c_sym_num, // # of C sym "rust_crate" in lib
432
- size_t rust_sym_num, // # of rust sym
433
- char const *library, char const **path) {
444
+ extern " C" CDECL uintptr_t
445
+ upcall_require_rust_sym (rust_task *task,
446
+ rust_crate const *curr_crate,
447
+ size_t lib_num, // # of lib
448
+ size_t c_sym_num, // # of C sym "rust_crate" in lib
449
+ size_t rust_sym_num, // # of rust sym
450
+ char const *library,
451
+ char const **path) {
434
452
LOG_UPCALL_ENTRY (task);
435
453
rust_dom *dom = task->dom ;
436
454
@@ -469,10 +487,13 @@ extern "C" CDECL uintptr_t upcall_require_rust_sym(rust_task *task,
469
487
return addr;
470
488
}
471
489
472
- extern " C" CDECL uintptr_t upcall_require_c_sym (rust_task *task,
473
- rust_crate const *curr_crate, size_t lib_num, // # of lib
474
- size_t c_sym_num, // # of C sym
475
- char const *library, char const *symbol) {
490
+ extern " C" CDECL uintptr_t
491
+ upcall_require_c_sym (rust_task *task,
492
+ rust_crate const *curr_crate,
493
+ size_t lib_num, // # of lib
494
+ size_t c_sym_num, // # of C sym
495
+ char const *library,
496
+ char const *symbol) {
476
497
LOG_UPCALL_ENTRY (task);
477
498
478
499
task->log (rust_log::UPCALL | rust_log::CACHE,
@@ -503,8 +524,7 @@ upcall_get_type_desc(rust_task *task,
503
524
size_t size,
504
525
size_t align,
505
526
size_t n_descs,
506
- type_desc const **descs)
507
- {
527
+ type_desc const **descs) {
508
528
LOG_UPCALL_ENTRY (task);
509
529
task->log (rust_log::UPCALL | rust_log::CACHE,
510
530
" upcall get_type_desc with size=%" PRIdPTR
@@ -551,8 +571,11 @@ upcall_new_task(rust_task *spawner, const char *name) {
551
571
}
552
572
553
573
extern " C" CDECL rust_task *
554
- upcall_start_task (rust_task *spawner, rust_task *task,
555
- uintptr_t exit_task_glue, uintptr_t spawnee_fn, size_t callsz) {
574
+ upcall_start_task (rust_task *spawner,
575
+ rust_task *task,
576
+ uintptr_t exit_task_glue,
577
+ uintptr_t spawnee_fn,
578
+ size_t callsz) {
556
579
LOG_UPCALL_ENTRY (spawner);
557
580
558
581
rust_dom *dom = spawner->dom ;
@@ -590,7 +613,9 @@ upcall_new_thread(rust_task *task, const char *name) {
590
613
extern " C" CDECL maybe_proxy<rust_task> *
591
614
upcall_start_thread (rust_task *spawner,
592
615
maybe_proxy<rust_task> *root_task_proxy,
593
- uintptr_t exit_task_glue, uintptr_t spawnee_fn, size_t callsz) {
616
+ uintptr_t exit_task_glue,
617
+ uintptr_t spawnee_fn,
618
+ size_t callsz) {
594
619
LOG_UPCALL_ENTRY (spawner);
595
620
596
621
rust_dom *dom = spawner->dom ;
0 commit comments