shithub: femtolisp

Download patch

ref: 7fcae265252c0a29cf2a4b0c1474b35e7ad39619
parent: 18e53e22e72b527843fa60e4063ef42fbc9fa569
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Wed Dec 25 01:09:57 EST 2024

compute_maxstack: add missing case for boxl

--- a/maxstack.inc
+++ b/maxstack.inc
@@ -2,14 +2,12 @@
 compute_maxstack(uint8_t *code, size_t len)
 {
 	uint8_t *ip = code+4, *end = code+len;
-	uint8_t op;
 	uint32_t i, n, sp = 0, maxsp = 0;
 
 	while(ip < end){
 		if((int32_t)sp > (int32_t)maxsp)
 			maxsp = sp;
-		op = *ip++;
-		switch(op){
+		switch(*ip++){
 		case OP_LOADA: case OP_LOADI8: case OP_LOADV: case OP_LOADG:
 			ip++; // fallthrough
 		case OP_LOADA0: case OP_LOADA1:
@@ -50,7 +48,7 @@
 
 		case OP_LOADVL: case OP_LOADGL: case OP_LOADAL:
 			sp++; // fallthrough
-		case OP_SETGL: case OP_SETAL: case OP_LARGC:
+		case OP_SETGL: case OP_SETAL: case OP_LARGC: case OP_BOXL:
 			SWAP_INT32(ip);
 			ip += 4;
 			break;