From 5dc195a037ace73bdab6a4518f11c73994c923d2 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Fri, 29 Oct 2021 18:27:49 +0200 Subject: [PATCH] Remove nosv code in favor of the thread type --- doc/emu_events.txt | 8 ++++++-- emu.h | 4 +++- emu_nosv.c | 23 ++++++++++++++++++++++- pcf.c | 4 +++- 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/doc/emu_events.txt b/doc/emu_events.txt index 614481d..863c3f3 100644 --- a/doc/emu_events.txt +++ b/doc/emu_events.txt @@ -63,8 +63,12 @@ VAW Exits nosv_waitfor() VAc Enters nosv_schedpoint() VAC Exits nosv_schedpoint() -VC[ Begins executing nosv code -VC] Ends executing nosv code +VHa Enters nosv_attach() +VHA Exits nosv_detach() +VHw Begins the execution as a worker +VHW Ends the execution as a worker +VHd Begins the execution as the delegate +VHD Ends the execution as the delegate -------------------- TAMPI (model=T) ---------------------- diff --git a/emu.h b/emu.h index 47dfcc6..97935ea 100644 --- a/emu.h +++ b/emu.h @@ -72,12 +72,14 @@ enum nosv_ss_values { ST_NOSV_MEM_ALLOCATING, ST_NOSV_MEM_FREEING, ST_NOSV_TASK_RUNNING, - ST_NOSV_CODE, ST_NOSV_API_SUBMIT, ST_NOSV_API_PAUSE, ST_NOSV_API_YIELD, ST_NOSV_API_WAITFOR, ST_NOSV_API_SCHEDPOINT, + ST_NOSV_ATTACH, + ST_NOSV_WORKER, + ST_NOSV_DELEGATE, EV_NOSV_SCHED_RECV, EV_NOSV_SCHED_SEND, diff --git a/emu_nosv.c b/emu_nosv.c index bb76989..765a9d7 100644 --- a/emu_nosv.c +++ b/emu_nosv.c @@ -411,6 +411,27 @@ pre_mem(struct ovni_emu *emu) } } +static void +pre_thread_type(struct ovni_emu *emu) +{ + struct ovni_ethread *th; + struct ovni_chan *chan_th; + + th = emu->cur_thread; + chan_th = &th->chan[CHAN_NOSV_SUBSYSTEM]; + + switch(emu->cur_ev->header.value) + { + case 'a': chan_push(chan_th, ST_NOSV_ATTACH); break; + case 'A': chan_pop (chan_th, ST_NOSV_ATTACH); break; + case 'w': chan_push(chan_th, ST_NOSV_WORKER); break; + case 'W': chan_pop (chan_th, ST_NOSV_WORKER); break; + case 'd': chan_push(chan_th, ST_NOSV_DELEGATE); break; + case 'D': chan_pop (chan_th, ST_NOSV_DELEGATE); break; + default: break; + } +} + static void pre_ss(struct ovni_emu *emu, int st) { @@ -453,7 +474,7 @@ hook_pre_nosv(struct ovni_emu *emu) case 'S': pre_sched(emu); break; case 'U': pre_ss(emu, ST_NOSV_SCHED_SUBMITTING); break; case 'M': pre_mem(emu); break; - case 'C': pre_ss(emu, ST_NOSV_CODE); break; + case 'H': pre_thread_type(emu); break; case 'A': pre_api(emu); break; default: break; diff --git a/pcf.c b/pcf.c index 275ab49..a4fe4d2 100644 --- a/pcf.c +++ b/pcf.c @@ -286,7 +286,6 @@ struct event_value nosv_ss_values[] = { { ST_NOSV_SCHED_SERVING, "Scheduler: Serving" }, { ST_NOSV_SCHED_SUBMITTING, "Scheduler: Submitting" }, { ST_NOSV_TASK_RUNNING, "Task: Running" }, - { ST_NOSV_CODE, "nOS-V code" }, { ST_NOSV_MEM_ALLOCATING, "Memory: Allocating" }, { ST_NOSV_MEM_FREEING, "Memory: Freeing" }, { ST_NOSV_API_SUBMIT, "API: Submit" }, @@ -294,6 +293,9 @@ struct event_value nosv_ss_values[] = { { ST_NOSV_API_YIELD, "API: Yield" }, { ST_NOSV_API_WAITFOR, "API: Waitfor" }, { ST_NOSV_API_SCHEDPOINT, "API: Scheduling point" }, + { ST_NOSV_ATTACH, "Thread: Attached" }, + { ST_NOSV_WORKER, "Thread: Worker" }, + { ST_NOSV_DELEGATE, "Thread: Delegate" }, { EV_NOSV_SCHED_SEND, "EV Scheduler: Send task" }, { EV_NOSV_SCHED_RECV, "EV Scheduler: Recv task" }, { EV_NOSV_SCHED_SELF, "EV Scheduler: Self-assign task" },