From c846e03899658ba3b426bbf4f18e8514ec1db45e Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Thu, 23 Sep 2021 15:12:55 +0200 Subject: [PATCH] Add allocation subsystem --- emu.h | 1 + emu_nosv_ss.c | 16 ++++++++++++++++ pcf.c | 1 + 3 files changed, 18 insertions(+) diff --git a/emu.h b/emu.h index 5362f28..8de0dd1 100644 --- a/emu.h +++ b/emu.h @@ -36,6 +36,7 @@ enum nosv_thread_ss_state { ST_SCHED_HUNGRY = 6, ST_SCHED_SERVING = 7, ST_SCHED_SUBMITTING = 8, + ST_MEM_ALLOCATING = 9, }; enum nosv_thread_ss_event { diff --git a/emu_nosv_ss.c b/emu_nosv_ss.c index 79a7c2c..d29910b 100644 --- a/emu_nosv_ss.c +++ b/emu_nosv_ss.c @@ -111,6 +111,21 @@ pre_submit(struct ovni_emu *emu) } } +static void +pre_memory(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + + th = emu->cur_thread; + switch(emu->cur_ev->header.value) + { + case '[': ss_push(th, ST_MEM_ALLOCATING); break; + case ']': ss_pop(th); break; + default: + break; + } +} + void hook_pre_nosv_ss(struct ovni_emu *emu) { @@ -118,6 +133,7 @@ hook_pre_nosv_ss(struct ovni_emu *emu) { case 'S': pre_sched(emu); break; case 'U': pre_submit(emu); break; + case 'M': pre_memory(emu); break; default: break; } diff --git a/pcf.c b/pcf.c index 536d561..48c7930 100644 --- a/pcf.c +++ b/pcf.c @@ -122,6 +122,7 @@ struct event_value thread_ss_values[] = { { EV_SCHED_SEND, "EV Scheduler: Send task" }, { EV_SCHED_RECV, "EV Scheduler: Recv task" }, { EV_SCHED_SELF, "EV Scheduler: Self-assign task" }, + { ST_MEM_ALLOCATING, "Memory: Allocating" }, { -1, NULL }, };