shithub: sl

Download patch

ref: a7cdfe48fc0fb232ba0d394767ea90434d6e9d02
parent: 9ae4696420288f200086fdd239e4b48c2fc662df
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Dec 18 21:12:07 EST 2024

apply_cl: simpler

--- a/flisp.c
+++ b/flisp.c
@@ -876,7 +876,8 @@
 	USED(n);
 	USED(v);
 apply_cl_top:
-	func = FL(stack)[FL(sp)-nargs-1];
+	bp = FL(sp)-nargs;
+	func = FL(stack)[bp-1];
 	ip = cvalue_data(fn_bcode(func));
 	assert(!ismanaged((uintptr_t)ip));
 	i = FL(sp)+GET_INT32(ip);
@@ -884,7 +885,6 @@
 		grow_stack();
 	ip += 4;
 
-	bp = FL(sp)-nargs;
 	PUSH(fn_env(func));
 	PUSH(FL(curr_frame));
 	PUSH(nargs);
@@ -1086,10 +1086,10 @@
 					}
 				}
 			}else if(__likely(iscbuiltin(func))){
-				s = FL(sp);
-				v = (((builtin_t*)ptr(func))[3])(&FL(stack)[FL(sp)-n], n);
-				FL(sp) = s-n;
-				FL(stack)[FL(sp)-1] = v;
+				s = FL(sp) - n;
+				v = (((builtin_t*)ptr(func))[3])(&FL(stack)[s], n);
+				FL(sp) = s;
+				FL(stack)[s-1] = v;
 				NEXT_OP;
 			}
 			type_error("function", func);