Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make actor pad automagically calculated #4528

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 6 additions & 20 deletions src/libponyrt/actor/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,17 @@ typedef struct pony_actor_t
actorstats_t actorstats; // 64/128 bytes
#endif
gc_t gc; // 48/88 bytes
// if you add more members here, you need to update the PONY_ACTOR_PAD_SIZE
// calculation below and the pony_static_assert at the top of actor.c, to
// reference the final member, its offset, and size
} pony_actor_t;

/** Padding for actor types.
*
* 56 bytes: initial header, not including the type descriptor
* 52/104 bytes: heap
* 4/8 bytes: muted counter
* 4/8 bytes: internal flags (after alignment)
* 64/128 bytes: actorstats (if enabled)
* 48/88 bytes: gc
* 24/56 bytes: padding to 64 bytes, ignored
* Size of pony_actor_t minus the padding at the end and the pony_type_t* at the beginning.
*
*/
#if INTPTR_MAX == INT64_MAX
#ifdef USE_RUNTIMESTATS
# define PONY_ACTOR_PAD_SIZE 392
#else
# define PONY_ACTOR_PAD_SIZE 264
#endif
#elif INTPTR_MAX == INT32_MAX
#ifdef USE_RUNTIMESTATS
# define PONY_ACTOR_PAD_SIZE 232
#else
# define PONY_ACTOR_PAD_SIZE 168
#endif
#endif
#define PONY_ACTOR_PAD_SIZE (offsetof(pony_actor_t, gc) + sizeof(gc_t) - sizeof(pony_type_t*))

typedef struct pony_actor_pad_t
{
Expand Down
Loading