ref: da693f9c4feb666a83285b7b54d5938a59b6d733
parent: 5666cf949d500e9832c6bd08c381497775eb253f
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Feb 10 12:39:56 EST 2025
call ops: simplify for better indentation
--- a/src/vm.inc
+++ b/src/vm.inc
@@ -50,39 +50,37 @@
}
nargs = n;
goto apply_cl_top;
- }else{
- i = uintval(v);
- if(isbuiltin(v)){
- s = builtins[i].nargs;
- if(s >= 0)
- argcount(n, (unsigned)s);
- else if(s != ANYARGS && (signed)n < -s)
- argcount(n, (unsigned)-s);
- // remove function arg
- for(s = FL(sp)-n-1; s < (int)FL(sp)-1; s++)
- FL(stack)[s] = FL(stack)[s+1];
- FL(sp)--;
- switch(i){
- case OP_LIST: goto LABEL(apply_list);
- case OP_VECTOR: goto LABEL(apply_vector);
- case OP_APPLY: goto LABEL(apply_apply);
- case OP_ADD: goto LABEL(apply_add);
- case OP_SUB: goto LABEL(apply_sub);
- case OP_MUL: goto LABEL(apply_mul);
- case OP_DIV: goto LABEL(apply_div);
- case OP_AREF: goto LABEL(apply_aref);
- case OP_ASET: goto LABEL(apply_aset);
- case OP_LT: goto LABEL(apply_lt);
- case OP_NUMEQ: goto LABEL(apply_numeq);
- default:
+ }
+ i = uintval(v);
+ assert(isbuiltin(v));
+ s = builtins[i].nargs;
+ if(s >= 0)
+ argcount(n, (unsigned)s);
+ else if(s != ANYARGS && (signed)n < -s)
+ argcount(n, (unsigned)-s);
+ // remove function arg
+ for(s = FL(sp)-n-1; s < (int)FL(sp)-1; s++)
+ FL(stack)[s] = FL(stack)[s+1];
+ FL(sp)--;
+ switch(i){
+ case OP_LIST: goto LABEL(apply_list);
+ case OP_VECTOR: goto LABEL(apply_vector);
+ case OP_APPLY: goto LABEL(apply_apply);
+ case OP_ADD: goto LABEL(apply_add);
+ case OP_SUB: goto LABEL(apply_sub);
+ case OP_MUL: goto LABEL(apply_mul);
+ case OP_DIV: goto LABEL(apply_div);
+ case OP_AREF: goto LABEL(apply_aref);
+ case OP_ASET: goto LABEL(apply_aset);
+ case OP_LT: goto LABEL(apply_lt);
+ case OP_NUMEQ: goto LABEL(apply_numeq);
+ default:
#if defined(COMPUTED_GOTO)
- goto *ops[i];
+ goto *ops[i];
#else
- op = i;
- continue;
+ op = i;
+ continue;
#endif
- }
- }
}
}else if(fl_likely(iscbuiltin(v))){
s = FL(sp) - n;