Use EXT() macro instead of extend_get()

This commit is contained in:
Rodrigo Arias 2023-02-01 16:14:19 +01:00 committed by Rodrigo Arias Mallo
parent 2a12af8e56
commit c94a786c1e
4 changed files with 21 additions and 21 deletions

View File

@ -30,7 +30,7 @@ static const int *cpu_type = th_type;
static int static int
connect_thread_mux(struct emu *emu, struct thread *thread) connect_thread_mux(struct emu *emu, struct thread *thread)
{ {
struct nanos6_thread *th = extend_get(&thread->ext, '6'); struct nanos6_thread *th = EXT(thread, '6');
for (int i = 0; i < CH_MAX; i++) { for (int i = 0; i < CH_MAX; i++) {
/* TODO: Let the thread take the select channel /* TODO: Let the thread take the select channel
@ -82,7 +82,7 @@ connect_thread_mux(struct emu *emu, struct thread *thread)
static int static int
connect_thread_prv(struct emu *emu, struct thread *thread, struct prv *prv) connect_thread_prv(struct emu *emu, struct thread *thread, struct prv *prv)
{ {
struct nanos6_thread *th = extend_get(&thread->ext, '6'); struct nanos6_thread *th = EXT(thread, '6');
for (int i = 0; i < CH_MAX; i++) { for (int i = 0; i < CH_MAX; i++) {
struct chan *out = th->ch_out[i]; struct chan *out = th->ch_out[i];
long type = th_type[i]; long type = th_type[i];
@ -100,7 +100,7 @@ static int
add_inputs_cpu_mux(struct emu *emu, struct mux *mux, int i) add_inputs_cpu_mux(struct emu *emu, struct mux *mux, int i)
{ {
for (struct thread *t = emu->system.threads; t; t = t->gnext) { for (struct thread *t = emu->system.threads; t; t = t->gnext) {
struct nanos6_thread *th = extend_get(&t->ext, '6'); struct nanos6_thread *th = EXT(t, '6');
/* Choose input thread channel based on tracking mode */ /* Choose input thread channel based on tracking mode */
struct chan *inp = NULL; struct chan *inp = NULL;
@ -123,7 +123,7 @@ add_inputs_cpu_mux(struct emu *emu, struct mux *mux, int i)
static int static int
connect_cpu_mux(struct emu *emu, struct cpu *scpu) connect_cpu_mux(struct emu *emu, struct cpu *scpu)
{ {
struct nanos6_cpu *cpu = extend_get(&scpu->ext, '6'); struct nanos6_cpu *cpu = EXT(scpu, '6');
for (int i = 0; i < CH_MAX; i++) { for (int i = 0; i < CH_MAX; i++) {
struct mux *mux = &cpu->mux[i]; struct mux *mux = &cpu->mux[i];
struct chan *out = &cpu->ch[i]; struct chan *out = &cpu->ch[i];
@ -185,7 +185,7 @@ connect_threads(struct emu *emu)
static int static int
connect_cpu_prv(struct emu *emu, struct cpu *scpu, struct prv *prv) connect_cpu_prv(struct emu *emu, struct cpu *scpu, struct prv *prv)
{ {
struct nanos6_cpu *cpu = extend_get(&scpu->ext, '6'); struct nanos6_cpu *cpu = EXT(scpu, '6');
for (int i = 0; i < CH_MAX; i++) { for (int i = 0; i < CH_MAX; i++) {
struct chan *out = &cpu->ch[i]; struct chan *out = &cpu->ch[i];
long type = cpu_type[i]; long type = cpu_type[i];

View File

@ -94,7 +94,7 @@ simple(struct emu *emu)
int action = entry[1]; int action = entry[1];
int st = entry[2]; int st = entry[2];
struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); struct nanos6_thread *th = EXT(emu->thread, '6');
struct chan *ch = &th->ch[chind]; struct chan *ch = &th->ch[chind];
if (action == PUSH) { if (action == PUSH) {
@ -114,7 +114,7 @@ simple(struct emu *emu)
static int static int
chan_task_stopped(struct emu *emu) chan_task_stopped(struct emu *emu)
{ {
struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); struct nanos6_thread *th = EXT(emu->thread, '6');
struct value null = value_null(); struct value null = value_null();
if (chan_set(&th->ch[CH_TASKID], null) != 0) { if (chan_set(&th->ch[CH_TASKID], null) != 0) {
@ -141,7 +141,7 @@ chan_task_stopped(struct emu *emu)
static int static int
chan_task_running(struct emu *emu, struct task *task) chan_task_running(struct emu *emu, struct task *task)
{ {
struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); struct nanos6_thread *th = EXT(emu->thread, '6');
struct proc *proc = emu->proc; struct proc *proc = emu->proc;
if (task->id == 0) { if (task->id == 0) {
@ -176,7 +176,7 @@ static int
chan_task_switch(struct emu *emu, chan_task_switch(struct emu *emu,
struct task *prev, struct task *next) struct task *prev, struct task *next)
{ {
struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); struct nanos6_thread *th = EXT(emu->thread, '6');
if (!prev || !next) { if (!prev || !next) {
err("cannot switch to or from a NULL task"); err("cannot switch to or from a NULL task");
@ -230,8 +230,8 @@ update_task_state(struct emu *emu)
uint32_t task_id = emu->ev->payload->u32[0]; uint32_t task_id = emu->ev->payload->u32[0];
struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); struct nanos6_thread *th = EXT(emu->thread, '6');
struct nanos6_proc *proc = extend_get(&emu->proc->ext, '6'); struct nanos6_proc *proc = EXT(emu->proc, '6');
struct task_info *info = &proc->task_info; struct task_info *info = &proc->task_info;
struct task_stack *stack = &th->task_stack; struct task_stack *stack = &th->task_stack;
@ -337,7 +337,7 @@ enforce_task_rules(struct emu *emu, char tr, struct task *next)
return -1; return -1;
} }
struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); struct nanos6_thread *th = EXT(emu->thread, '6');
struct value ss; struct value ss;
if (chan_read(&th->ch[CH_SUBSYSTEM], &ss) != 0) { if (chan_read(&th->ch[CH_SUBSYSTEM], &ss) != 0) {
err("chan_read failed"); err("chan_read failed");
@ -356,7 +356,7 @@ enforce_task_rules(struct emu *emu, char tr, struct task *next)
static int static int
update_task(struct emu *emu) update_task(struct emu *emu)
{ {
struct nanos6_thread *th = extend_get(&emu->thread->ext, '6'); struct nanos6_thread *th = EXT(emu->thread, '6');
struct task_stack *stack = &th->task_stack; struct task_stack *stack = &th->task_stack;
struct task *prev = task_get_running(stack); struct task *prev = task_get_running(stack);
@ -399,7 +399,7 @@ create_task(struct emu *emu)
uint32_t task_id = emu->ev->payload->u32[0]; uint32_t task_id = emu->ev->payload->u32[0];
uint32_t type_id = emu->ev->payload->u32[1]; uint32_t type_id = emu->ev->payload->u32[1];
struct nanos6_proc *proc = extend_get(&emu->proc->ext, '6'); struct nanos6_proc *proc = EXT(emu->proc, '6');
struct task_info *info = &proc->task_info; struct task_info *info = &proc->task_info;
if (task_create(info, type_id, task_id) != 0) { if (task_create(info, type_id, task_id) != 0) {
@ -461,7 +461,7 @@ pre_type(struct emu *emu)
const char *label = (const char *) data; const char *label = (const char *) data;
struct nanos6_proc *proc = extend_get(&emu->proc->ext, '6'); struct nanos6_proc *proc = EXT(emu->proc, '6');
struct task_info *info = &proc->task_info; struct task_info *info = &proc->task_info;
if (task_type_create(info, typeid, label) != 0) { if (task_type_create(info, typeid, label) != 0) {

View File

@ -10,7 +10,7 @@ static const int *cpu_type = th_type;
static int static int
connect_thread_mux(struct emu *emu, struct thread *thread) connect_thread_mux(struct emu *emu, struct thread *thread)
{ {
struct ovni_thread *th = extend_get(&thread->ext, 'O'); struct ovni_thread *th = EXT(thread, 'O');
for (int i = 0; i < CH_MAX; i++) { for (int i = 0; i < CH_MAX; i++) {
struct chan *inp = &th->ch[i]; struct chan *inp = &th->ch[i];
struct chan *sel = &thread->chan[TH_CHAN_STATE]; struct chan *sel = &thread->chan[TH_CHAN_STATE];
@ -33,7 +33,7 @@ connect_thread_mux(struct emu *emu, struct thread *thread)
static int static int
connect_thread_prv(struct emu *emu, struct thread *thread, struct prv *prv) connect_thread_prv(struct emu *emu, struct thread *thread, struct prv *prv)
{ {
struct ovni_thread *th = extend_get(&thread->ext, 'O'); struct ovni_thread *th = EXT(thread, 'O');
for (int i = 0; i < CH_MAX; i++) { for (int i = 0; i < CH_MAX; i++) {
struct chan *out = th->ch_out[i]; struct chan *out = th->ch_out[i];
long type = th_type[i]; long type = th_type[i];
@ -51,7 +51,7 @@ static int
add_inputs_cpu_mux(struct emu *emu, struct mux *mux, int i) add_inputs_cpu_mux(struct emu *emu, struct mux *mux, int i)
{ {
for (struct thread *t = emu->system.threads; t; t = t->gnext) { for (struct thread *t = emu->system.threads; t; t = t->gnext) {
struct ovni_thread *th = extend_get(&t->ext, 'O'); struct ovni_thread *th = EXT(t, 'O');
struct chan *inp = &th->ch_run[i]; struct chan *inp = &th->ch_run[i];
if (mux_add_input(mux, value_int64(t->gindex), inp) != 0) { if (mux_add_input(mux, value_int64(t->gindex), inp) != 0) {
err("mux_add_input failed"); err("mux_add_input failed");
@ -65,7 +65,7 @@ add_inputs_cpu_mux(struct emu *emu, struct mux *mux, int i)
static int static int
connect_cpu_mux(struct emu *emu, struct cpu *scpu) connect_cpu_mux(struct emu *emu, struct cpu *scpu)
{ {
struct ovni_cpu *cpu = extend_get(&scpu->ext, 'O'); struct ovni_cpu *cpu = EXT(scpu, 'O');
for (int i = 0; i < CH_MAX; i++) { for (int i = 0; i < CH_MAX; i++) {
struct mux *mux = &cpu->mux[i]; struct mux *mux = &cpu->mux[i];
struct chan *out = &cpu->ch[i]; struct chan *out = &cpu->ch[i];
@ -119,7 +119,7 @@ connect_threads(struct emu *emu)
static int static int
connect_cpu_prv(struct emu *emu, struct cpu *scpu, struct prv *prv) connect_cpu_prv(struct emu *emu, struct cpu *scpu, struct prv *prv)
{ {
struct ovni_cpu *cpu = extend_get(&scpu->ext, 'O'); struct ovni_cpu *cpu = EXT(scpu, 'O');
for (int i = 0; i < CH_MAX; i++) { for (int i = 0; i < CH_MAX; i++) {
struct chan *out = &cpu->ch[i]; struct chan *out = &cpu->ch[i];
long type = cpu_type[i]; long type = cpu_type[i];

View File

@ -365,7 +365,7 @@ pre_burst(struct emu *emu)
static int static int
pre_flush(struct emu *emu) pre_flush(struct emu *emu)
{ {
struct ovni_thread *th = extend_get(&emu->thread->ext, 'O'); struct ovni_thread *th = EXT(emu->thread, 'O');
struct chan *flush = &th->ch[CH_FLUSH]; struct chan *flush = &th->ch[CH_FLUSH];
switch (emu->ev->v) { switch (emu->ev->v) {