Simplify use of local variables, eliminating the redundant symbol from the

bytecodes.
This commit is contained in:
jjgarcia 2002-10-13 17:05:40 +00:00
parent cd6d1e61ef
commit 0912497863
3 changed files with 10 additions and 18 deletions

View file

@ -1807,7 +1807,6 @@ compile_form(cl_object stmt, bool push) {
index = c_var_ref(stmt);
if (index >= 0) {
asm_op2(push? OP_PUSHV : OP_VAR, index);
asm1(stmt);
} else {
asm_op(push? OP_PUSHVS : OP_VARS);
asm1(stmt);

View file

@ -464,14 +464,12 @@ disassemble(cl_object *vector) {
s = next_code(vector);
goto ARG;
/* OP_VAR n{arg}, var{symbol}
/* OP_VAR n{arg}
Sets NValues=1 and VALUES(0) to the value of the n-th local.
VAR is the name of the variable for readability purposes.
*/
case OP_VAR: string = "VAR\t";
n = get_oparg(s);
s = next_code(vector);
goto OPARG_ARG;
goto OPARG;
/* OP_VARS var{symbol}
Sets NValues=1 and VALUES(0) to the value of the symbol VAR.
@ -487,14 +485,12 @@ disassemble(cl_object *vector) {
case OP_PUSH: string = "PUSH\tVALUES(0)";
goto NOARG;
/* OP_PUSHV n{arg}, var{symbol}
/* OP_PUSHV n{arg}
Pushes the value of the n-th local onto the stack.
VAR is the name of the variable for readability purposes.
*/
case OP_PUSHV: string = "PUSHV\t";
n = get_oparg(s);
s = next_code(vector);
goto OPARG_ARG;
goto OPARG;
/* OP_PUSHVS var{symbol}
Pushes the value of the symbol VAR onto the stack.

View file

@ -139,10 +139,10 @@ bind_special(register cl_object var, register cl_object val)
}
static cl_object
search_local(register cl_object name, register int s) {
search_local(register int s) {
cl_object x;
for (x = lex_env; s-- > 0 && !Null(x); x = CDDR(x));
if (Null(x) || CAR(x) != name)
if (Null(x))
FEerror("Internal error: local not found.", 0);
return CADR(x);
}
@ -939,8 +939,7 @@ interpret(cl_object *vector) {
*/
case OP_VAR: {
int lex_env_index = get_oparg(s);
cl_object var_name = next_code(vector);
VALUES(0) = search_local(var_name, lex_env_index);
VALUES(0) = search_local(lex_env_index);
NValues = 1;
break;
}
@ -963,14 +962,12 @@ interpret(cl_object *vector) {
cl_stack_push(VALUES(0));
break;
/* OP_PUSHV n{arg}, var{symbol}
/* OP_PUSHV n{arg}
Pushes the value of the n-th local onto the stack.
VAR is the name of the variable for readability purposes.
*/
case OP_PUSHV: {
int lex_env_index = get_oparg(s);
cl_object var_name = next_code(vector);
cl_stack_push(search_local(var_name, lex_env_index));
cl_stack_push(search_local(lex_env_index));
break;
}
@ -1137,7 +1134,7 @@ interpret(cl_object *vector) {
*/
case OP_GO: {
cl_object tag_name = next_code(vector);
cl_object id = search_local(@':tag',get_oparg(s));
cl_object id = search_local(get_oparg(s));
VALUES(0) = Cnil;
NValues = 0;
cl_go(id, tag_name);