Add allocation subsystem

This commit is contained in:
Rodrigo Arias 2021-09-23 15:12:55 +02:00 committed by Rodrigo Arias Mallo
parent b60c6da764
commit c846e03899
3 changed files with 18 additions and 0 deletions

1
emu.h
View File

@ -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 {

View File

@ -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;
}

1
pcf.c
View File

@ -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 },
};