From 8aca1ebc9665f67d1ef86af309b446fbf9e3f369 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Mon, 4 Nov 2013 21:32:09 -0500 Subject: [PATCH] rename pic_code.u.c -> pic_code.u.r --- include/picrin/irep.h | 2 +- src/codegen.c | 28 ++++++++++++++-------------- src/vm.c | 8 ++++---- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/picrin/irep.h b/include/picrin/irep.h index bac30636..f5ce8c35 100644 --- a/include/picrin/irep.h +++ b/include/picrin/irep.h @@ -43,7 +43,7 @@ struct pic_code { struct { short depth; short idx; - } c; + } r; } u; }; diff --git a/src/codegen.c b/src/codegen.c index e1d41aec..fd49a624 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -199,8 +199,8 @@ codegen(codegen_state *state, pic_value obj, bool tailpos) FALLTHROUGH; case 0: /* local */ irep->code[irep->clen].insn = OP_CREF; - irep->code[irep->clen].u.c.depth = depth; - irep->code[irep->clen].u.c.idx = idx; + irep->code[irep->clen].u.r.depth = depth; + irep->code[irep->clen].u.r.idx = idx; irep->clen++; break; } @@ -347,8 +347,8 @@ codegen(codegen_state *state, pic_value obj, bool tailpos) FALLTHROUGH; case 0: /* local */ irep->code[irep->clen].insn = OP_CSET; - irep->code[irep->clen].u.c.depth = depth; - irep->code[irep->clen].u.c.idx = idx; + irep->code[irep->clen].u.r.depth = depth; + irep->code[irep->clen].u.r.idx = idx; irep->clen++; break; } @@ -588,7 +588,7 @@ lift_cv(pic_state *pic, struct pic_irep *irep) break; case OP_CREF: case OP_CSET: - irep->code[i].u.c.depth--; + irep->code[i].u.r.depth--; break; } } @@ -616,11 +616,11 @@ slide_cv(pic_state *pic, unsigned *cv_tbl, unsigned cv_num, struct pic_irep *ire break; case OP_CREF: case OP_CSET: - if (d != c.u.c.depth) + if (d != c.u.r.depth) break; for (j = 0; j < cv_num; ++j) { - if (c.u.c.idx == cv_tbl[j]) { - irep->code[i].u.c.idx = j; + if (c.u.r.idx == cv_tbl[j]) { + irep->code[i].u.r.idx = j; break; } } @@ -680,15 +680,15 @@ codegen_lambda(codegen_state *state, pic_value obj) /* pass */ break; case OP_CREF: - if (c.u.c.depth == 0 && ! state->scope->dirty_flags[c.u.c.idx]) { + if (c.u.r.depth == 0 && ! state->scope->dirty_flags[c.u.r.idx]) { irep->code[i].insn = OP_LREF; - irep->code[i].u.i = irep->code[i].u.c.idx; + irep->code[i].u.i = irep->code[i].u.r.idx; } break; case OP_CSET: - if (c.u.c.depth == 0 && ! state->scope->dirty_flags[c.u.c.idx]) { + if (c.u.r.depth == 0 && ! state->scope->dirty_flags[c.u.r.idx]) { irep->code[i].insn = OP_LSET; - irep->code[i].u.i = irep->code[i].u.c.idx; + irep->code[i].u.i = irep->code[i].u.r.idx; } break; } @@ -828,10 +828,10 @@ print_irep(pic_state *pic, struct pic_irep *irep) printf("OP_LSET\t%d\n", irep->code[i].u.i); break; case OP_CREF: - printf("OP_CREF\t%d\t%d\n", irep->code[i].u.c.depth, irep->code[i].u.c.idx); + printf("OP_CREF\t%d\t%d\n", irep->code[i].u.r.depth, irep->code[i].u.r.idx); break; case OP_CSET: - printf("OP_CSET\t%d\t%d\n", irep->code[i].u.c.depth, irep->code[i].u.c.idx); + printf("OP_CSET\t%d\t%d\n", irep->code[i].u.r.depth, irep->code[i].u.r.idx); break; case OP_JMP: printf("OP_JMP\t%d\n", irep->code[i].u.i); diff --git a/src/vm.c b/src/vm.c index 9aeed7eb..fa4c10e9 100644 --- a/src/vm.c +++ b/src/vm.c @@ -327,25 +327,25 @@ pic_apply(pic_state *pic, struct pic_proc *proc, pic_value argv) NEXT; } CASE(OP_CREF) { - int depth = c.u.c.depth; + int depth = c.u.r.depth; struct pic_env *env; env = pic->ci->env; while (depth--) { env = env->up; } - PUSH(env->values[c.u.c.idx]); + PUSH(env->values[c.u.r.idx]); NEXT; } CASE(OP_CSET) { - int depth = c.u.c.depth; + int depth = c.u.r.depth; struct pic_env *env; env = pic->ci->env; while (depth--) { env = env->up; } - env->values[c.u.c.idx] = POP(); + env->values[c.u.r.idx] = POP(); NEXT; } CASE(OP_JMP) {