Skip to content

Commit 895f0b7

Browse files
authored
Remove code related to ACTORMSG_DESTROYED and ctx for ponyint_destroy (#4615)
code referring to ACTORMSG_DESTROYED, ACTORMSG_CREATED and the ctx argument to ponyint_destroy are no longer used as the logic has evolved over time and can be removed.
1 parent 9c95489 commit 895f0b7

File tree

9 files changed

+17
-88
lines changed

9 files changed

+17
-88
lines changed

examples/dtrace/mbox-size-all-actor-messages.d

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
*/
1212

1313
inline unsigned int UINT32_MAX = 4294967295;
14-
inline unsigned int ACTORMSG_APPLICATION_START = (UINT32_MAX - 11); /* -12 */
15-
inline unsigned int ACTORMSG_CHECKBLOCKED = (UINT32_MAX - 10); /* -11 */
16-
inline unsigned int ACTORMSG_DESTROYED = (UINT32_MAX - 9); /* -10 */
14+
inline unsigned int ACTORMSG_APPLICATION_START = (UINT32_MAX - 9); /* -10 */
15+
inline unsigned int ACTORMSG_CHECKBLOCKED = (UINT32_MAX - 8); /* -9 */
1716
inline unsigned int ACTORMSG_ISBLOCKED = (UINT32_MAX - 7); /* -8 */
1817
inline unsigned int ACTORMSG_BLOCK = (UINT32_MAX - 6); /* -7 */
1918
inline unsigned int ACTORMSG_UNBLOCK = (UINT32_MAX - 5); /* -6 */

examples/dtrace/telemetry.d

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
#pragma D option quiet
44

5-
inline unsigned int UINT32_MAX = -1;
6-
inline unsigned int ACTORMSG_APPLICATION_START = (UINT32_MAX - 11);
7-
inline unsigned int ACTORMSG_CHECKBLOCKED = (UINT32_MAX - 10);
8-
inline unsigned int ACTORMSG_DESTROYED = (UINT32_MAX - 9);
9-
inline unsigned int ACTORMSG_CREATED = (UINT32_MAX - 8);
5+
inline unsigned int UINT32_MAX = 4294967295;
6+
inline unsigned int ACTORMSG_APPLICATION_START = (UINT32_MAX - 9);
7+
inline unsigned int ACTORMSG_CHECKBLOCKED = (UINT32_MAX - 8);
108
inline unsigned int ACTORMSG_ISBLOCKED = (UINT32_MAX - 7);
119
inline unsigned int ACTORMSG_BLOCK = (UINT32_MAX - 6);
1210
inline unsigned int ACTORMSG_UNBLOCK = (UINT32_MAX - 5);
@@ -27,12 +25,6 @@ pony$target:::actor-msg-send
2725
@counts[arg0, "Check Blocked Messages Sent"] = count();
2826
}
2927

30-
pony$target:::actor-msg-send
31-
/ (unsigned int)arg1 == (unsigned int)ACTORMSG_DESTROYED /
32-
{
33-
@counts[arg0, "Destroyed Messages Sent"] = count();
34-
}
35-
3628
pony$target:::actor-msg-send
3729
/ (unsigned int)arg1 == (unsigned int)ACTORMSG_ISBLOCKED /
3830
{

examples/systemtap/telemetry.stp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ probe process.mark("actor-msg-send")
77
size of unsigned integer in SystemTap. This is needed since
88
the message type is calculated from that value. UINT32_MAX
99
must be changed on different types of machines */
10-
UINT32_MAX = 4294967296;
11-
ACTORMSG_APPLICATION_START = (UINT32_MAX - 11);
12-
ACTORMSG_CHECKBLOCKED = (UINT32_MAX - 10);
13-
ACTORMSG_DESTROYED = (UINT32_MAX - 9);
14-
ACTORMSG_CREATED = (UINT32_MAX - 8);
10+
UINT32_MAX = 4294967295;
11+
ACTORMSG_APPLICATION_START = (UINT32_MAX - 9);
12+
ACTORMSG_CHECKBLOCKED = (UINT32_MAX - 8);
1513
ACTORMSG_ISBLOCKED = (UINT32_MAX - 7);
1614
ACTORMSG_BLOCK = (UINT32_MAX - 6);
1715
ACTORMSG_UNBLOCK = (UINT32_MAX - 5);
@@ -26,12 +24,6 @@ probe process.mark("actor-msg-send")
2624
if ($arg2 == ACTORMSG_CHECKBLOCKED) {
2725
messages[$arg1, "count_msg_checkblocked"] ++;
2826
}
29-
if ($arg2 == ACTORMSG_DESTROYED) {
30-
messages[$arg1, "count_msg_destroyed"] ++;
31-
}
32-
if ($arg2 == ACTORMSG_CREATED) {
33-
messages[$arg1, "count_msg_created"] ++;
34-
}
3527
if ($arg2 == ACTORMSG_ISBLOCKED) {
3628
messages[$arg1, "count_msg_isblocked"] ++;
3729
}

src/libponyc/codegen/codegen.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,9 @@ static void init_runtime(compile_t* c)
304304
LLVMAddAttributeAtIndex(value, LLVMAttributeReturnIndex, deref_actor_attr);
305305
LLVMAddAttributeAtIndex(value, LLVMAttributeReturnIndex, align_attr);
306306

307-
// void ponyint_destroy(i8*, __object*)
307+
// void ponyint_destroy(__object*)
308308
params[0] = c->ptr;
309-
params[1] = c->ptr;
310-
type = LLVMFunctionType(c->void_type, params, 2, false);
309+
type = LLVMFunctionType(c->void_type, params, 1, false);
311310
value = LLVMAddFunction(c->module, "ponyint_destroy", type);
312311
LLVMAddAttributeAtIndex(value, LLVMAttributeFunctionIndex, nounwind_attr);
313312
LLVMAddAttributeAtIndex(value, LLVMAttributeFunctionIndex,

src/libponyc/codegen/genexe.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,8 @@ LLVMValueRef gen_main(compile_t* c, reach_type_t* t_main, reach_type_t* t_env)
217217
LLVMValueRef final_actor = create_main(c, t_main, ctx);
218218
LLVMBuildCall2(c->builder, LLVMGlobalGetValueType(c->primitives_final),
219219
c->primitives_final, NULL, 0, "");
220-
args[0] = ctx;
221-
args[1] = final_actor;
222-
gencall_runtime(c, "ponyint_destroy", args, 2, "");
220+
args[0] = final_actor;
221+
gencall_runtime(c, "ponyint_destroy", args, 1, "");
223222
}
224223

225224
args[0] = ctx;

src/libponyrt/actor/actor.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -468,19 +468,6 @@ static bool handle_message(pony_ctx_t* ctx, pony_actor_t* actor,
468468
return false;
469469
}
470470

471-
case ACTORMSG_DESTROYED:
472-
{
473-
#ifdef USE_RUNTIMESTATS_MESSAGES
474-
ctx->schedulerstats.mem_used_inflight_messages -= sizeof(pony_msgp_t);
475-
ctx->schedulerstats.mem_allocated_inflight_messages -= POOL_ALLOC_SIZE(pony_msgp_t);
476-
#endif
477-
478-
pony_assert(ponyint_is_cycle(actor));
479-
DTRACE3(ACTOR_MSG_RUN, (uintptr_t)ctx->scheduler, (uintptr_t)actor, msg->id);
480-
actor->type->dispatch(ctx, actor, msg);
481-
return false;
482-
}
483-
484471
case ACTORMSG_CHECKBLOCKED:
485472
{
486473
#ifdef USE_RUNTIMESTATS_MESSAGES
@@ -896,9 +883,8 @@ PONY_API pony_actor_t* pony_create(pony_ctx_t* ctx, pony_type_t* type,
896883
//
897884
// as a result, this does not need to be concurrency safe
898885
// or tell the cycle detector of what it is doing
899-
PONY_API void ponyint_destroy(pony_ctx_t* ctx, pony_actor_t* actor)
886+
PONY_API void ponyint_destroy(pony_actor_t* actor)
900887
{
901-
(void)ctx;
902888
// This destroys an actor immediately.
903889
// The finaliser is not called.
904890

src/libponyrt/actor/actor.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ PONY_EXTERN_C_BEGIN
1717
// Reminder: When adding new types, please also update
1818
// examples/dtrace/telemetry.d
1919

20-
#define ACTORMSG_APPLICATION_START (UINT32_MAX - 11)
21-
#define ACTORMSG_CHECKBLOCKED (UINT32_MAX - 10)
22-
#define ACTORMSG_DESTROYED (UINT32_MAX - 9)
20+
#define ACTORMSG_APPLICATION_START (UINT32_MAX - 9)
21+
#define ACTORMSG_CHECKBLOCKED (UINT32_MAX - 8)
2322
#define ACTORMSG_ISBLOCKED (UINT32_MAX - 7)
2423
#define ACTORMSG_BLOCK (UINT32_MAX - 6)
2524
#define ACTORMSG_UNBLOCK (UINT32_MAX - 5)
@@ -156,7 +155,7 @@ PONY_API actorstats_t* pony_actor_stats();
156155

157156
void ponyint_unmute_actor(pony_actor_t* actor);
158157

159-
PONY_API void ponyint_destroy(pony_ctx_t* ctx, pony_actor_t* actor);
158+
PONY_API void ponyint_destroy(pony_actor_t* actor);
160159

161160
#ifdef USE_RUNTIMESTATS
162161
size_t ponyint_actor_mem_size(pony_actor_t* actor);

src/libponyrt/gc/cycle.c

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -815,24 +815,6 @@ static void check_blocked(pony_ctx_t* ctx, detector_t* d)
815815
deferred(ctx, d);
816816
}
817817

818-
static void actor_destroyed(detector_t* d, pony_actor_t* actor)
819-
{
820-
// this would only called by a manual destroy of an actor
821-
// if that was possible. It is currently unused.
822-
// used to clean up the dangling reference to this actor
823-
// in the cycle detector to avoid a crash
824-
825-
// get view for actor
826-
view_t* view = get_view(d, actor, false);
827-
828-
if(view)
829-
{
830-
// remove and free view
831-
ponyint_viewmap_remove(&d->views, view);
832-
view_free(view);
833-
}
834-
}
835-
836818
static void block(detector_t* d, pony_ctx_t* ctx, pony_actor_t* actor,
837819
size_t rc, deltamap_t* map)
838820
{
@@ -1162,13 +1144,6 @@ static void cycle_dispatch(pony_ctx_t* ctx, pony_actor_t* self,
11621144
break;
11631145
}
11641146

1165-
case ACTORMSG_DESTROYED:
1166-
{
1167-
pony_msgp_t* m = (pony_msgp_t*)msg;
1168-
actor_destroyed(d, (pony_actor_t*)m->p);
1169-
break;
1170-
}
1171-
11721147
case ACTORMSG_BLOCK:
11731148
{
11741149
#ifdef USE_RUNTIMESTATS_MESSAGES
@@ -1269,16 +1244,6 @@ bool ponyint_cycle_check_blocked(uint64_t tsc, uint64_t tsc2)
12691244
return false;
12701245
}
12711246

1272-
void ponyint_cycle_actor_destroyed(pony_actor_t* actor)
1273-
{
1274-
// this will only be false during the creation of the cycle detector
1275-
// and after the runtime has been shut down or if the cycle detector
1276-
// is being destroyed
1277-
if(cycle_detector && !ponyint_is_cycle(actor)) {
1278-
ponyint_sendp_inject(cycle_detector, ACTORMSG_DESTROYED, actor);
1279-
}
1280-
}
1281-
12821247
void ponyint_cycle_block(pony_actor_t* actor, gc_t* gc)
12831248
{
12841249
pony_assert(&actor->gc == gc);
@@ -1308,7 +1273,7 @@ void ponyint_cycle_terminate(pony_ctx_t* ctx)
13081273
{
13091274
ponyint_become(ctx, cycle_detector);
13101275
final(ctx, cycle_detector);
1311-
ponyint_destroy(ctx, cycle_detector);
1276+
ponyint_destroy(cycle_detector);
13121277
ponyint_become(ctx, NULL);
13131278
cycle_detector = NULL;
13141279
}

src/libponyrt/gc/cycle.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ void ponyint_cycle_create(pony_ctx_t* ctx, uint32_t detect_interval);
1313

1414
bool ponyint_cycle_check_blocked(uint64_t tsc, uint64_t tsc2);
1515

16-
void ponyint_cycle_actor_destroyed(pony_actor_t* actor);
17-
1816
void ponyint_cycle_block(pony_actor_t* actor, gc_t* gc);
1917

2018
void ponyint_cycle_unblock(pony_actor_t* actor);

0 commit comments

Comments
 (0)