Skip to content

Commit 1413243

Browse files
committed
Relocate try_gc
1 parent f8dfcf6 commit 1413243

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
lines changed

src/libponyrt/actor/actor.c

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,52 @@ static bool well_formed_msg_chain(pony_msg_t* first, pony_msg_t* last)
241241
}
242242
#endif
243243

244+
static void try_gc(pony_ctx_t* ctx, pony_actor_t* actor)
245+
{
246+
if(!ponyint_heap_startgc(&actor->heap
247+
#ifdef USE_RUNTIMESTATS
248+
, actor))
249+
#else
250+
))
251+
#endif
252+
return;
253+
254+
#ifdef USE_RUNTIMESTATS
255+
uint64_t used_cpu = ponyint_sched_cpu_used(ctx);
256+
ctx->schedulerstats.misc_cpu += used_cpu;
257+
#endif
258+
259+
DTRACE1(GC_START, (uintptr_t)ctx->scheduler);
260+
261+
ponyint_gc_mark(ctx);
262+
263+
if(actor->type->trace != NULL)
264+
actor->type->trace(ctx, actor);
265+
266+
ponyint_mark_done(ctx);
267+
268+
#ifdef USE_RUNTIMESTATS
269+
used_cpu = ponyint_sched_cpu_used(ctx);
270+
ctx->schedulerstats.actor_gc_mark_cpu += used_cpu;
271+
actor->actorstats.gc_mark_cpu += used_cpu;
272+
#endif
273+
274+
ponyint_heap_endgc(&actor->heap
275+
#ifdef USE_RUNTIMESTATS
276+
, actor);
277+
#else
278+
);
279+
#endif
280+
281+
DTRACE1(GC_END, (uintptr_t)ctx->scheduler);
282+
283+
#ifdef USE_RUNTIMESTATS
284+
used_cpu = ponyint_sched_cpu_used(ctx);
285+
ctx->schedulerstats.actor_gc_sweep_cpu += used_cpu;
286+
actor->actorstats.gc_sweep_cpu += used_cpu;
287+
#endif
288+
}
289+
244290
static void send_unblock(pony_actor_t* actor)
245291
{
246292
// Send unblock before continuing.
@@ -462,52 +508,6 @@ static bool handle_message(pony_ctx_t* ctx, pony_actor_t* actor,
462508
}
463509
}
464510

465-
static void try_gc(pony_ctx_t* ctx, pony_actor_t* actor)
466-
{
467-
if(!ponyint_heap_startgc(&actor->heap
468-
#ifdef USE_RUNTIMESTATS
469-
, actor))
470-
#else
471-
))
472-
#endif
473-
return;
474-
475-
#ifdef USE_RUNTIMESTATS
476-
uint64_t used_cpu = ponyint_sched_cpu_used(ctx);
477-
ctx->schedulerstats.misc_cpu += used_cpu;
478-
#endif
479-
480-
DTRACE1(GC_START, (uintptr_t)ctx->scheduler);
481-
482-
ponyint_gc_mark(ctx);
483-
484-
if(actor->type->trace != NULL)
485-
actor->type->trace(ctx, actor);
486-
487-
ponyint_mark_done(ctx);
488-
489-
#ifdef USE_RUNTIMESTATS
490-
used_cpu = ponyint_sched_cpu_used(ctx);
491-
ctx->schedulerstats.actor_gc_mark_cpu += used_cpu;
492-
actor->actorstats.gc_mark_cpu += used_cpu;
493-
#endif
494-
495-
ponyint_heap_endgc(&actor->heap
496-
#ifdef USE_RUNTIMESTATS
497-
, actor);
498-
#else
499-
);
500-
#endif
501-
502-
DTRACE1(GC_END, (uintptr_t)ctx->scheduler);
503-
504-
#ifdef USE_RUNTIMESTATS
505-
used_cpu = ponyint_sched_cpu_used(ctx);
506-
ctx->schedulerstats.actor_gc_sweep_cpu += used_cpu;
507-
actor->actorstats.gc_sweep_cpu += used_cpu;
508-
#endif
509-
}
510-
511511
// return true if mute occurs
512512
static bool maybe_should_mute(pony_actor_t* actor)
513513
{

0 commit comments

Comments
 (0)