shithub: femtolisp

Download patch

ref: 065e6150c3b727a3dc15647609e6a4904c79ee18
parent: 994d01dff2f65cbabc5abbd56ff12428e29490b8
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Dec 26 16:41:38 EST 2024

vm: ditto, fixup

--- a/vm.inc
+++ b/vm.inc
@@ -37,7 +37,7 @@
 		}
 		n = *ip++;  // nargs
 	}
-do_call:
+LABEL(do_call):
 	FL(stack)[ipd] = (uintptr_t)ip;
 	func = FL(stack)[FL(sp)-n-1];
 	if(tag(func) == TAG_FUNCTION){
@@ -63,15 +63,15 @@
 					FL(stack)[s] = FL(stack)[s+1];
 				FL(sp)--;
 				switch(i){
-				case OP_LIST:   goto apply_list;
-				case OP_VECTOR: goto apply_vector;
-				case OP_APPLY:  goto apply_apply;
-				case OP_ADD:	goto apply_add;
-				case OP_SUB:	goto apply_sub;
-				case OP_MUL:	goto apply_mul;
-				case OP_DIV:	goto apply_div;
-				case OP_AREF:	goto apply_aref;
-				case OP_ASET:	goto apply_aset;
+				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);
 				default:
 #if defined(COMPUTED_GOTO)
 					goto *ops[i];
@@ -261,7 +261,7 @@
 	FL(stack)[ipd] = (uintptr_t)ip;
 	n = 3 + *ip++;
 	}
-apply_aref:
+LABEL(apply_aref):
 	v = FL(stack)[FL(sp)-n];
 	for(i = n-1; i > 0; i--){
 		if(isarray(v)){
@@ -325,11 +325,11 @@
 	NEXT_OP;
 
 OP(OP_ADD2)
-do_add2:
+LABEL(do_add2):
 	FL(stack)[ipd] = (uintptr_t)ip;
 	if(0){
 OP(OP_SUB2)
-do_sub2:
+LABEL(do_sub2):
 		FL(stack)[ipd] = (uintptr_t)ip;
 		FL(stack)[FL(sp)-1] = fl_neg(FL(stack)[FL(sp)-1]);
 	}
@@ -392,9 +392,9 @@
 		if(__likely(iscons(v)))
 			v = car_(v);
 		else
-			goto cadr_nil;
+			goto LABEL(cadr_nil);
 	}else{
-	cadr_nil:
+LABEL(cadr_nil):
 		if(__unlikely(v != FL_nil)){
 			FL(stack)[ipd] = (uintptr_t)ip;
 			type_error("cons", v);
@@ -404,7 +404,7 @@
 	NEXT_OP;
 
 OP(OP_NEG)
-do_neg:
+LABEL(do_neg):
 	FL(stack)[ipd] = (uintptr_t)ip;
 	FL(stack)[FL(sp)-1] = fl_neg(FL(stack)[FL(sp)-1]);
 	NEXT_OP;
@@ -511,7 +511,7 @@
 
 OP(OP_LIST)
 	n = *ip++;
-apply_list:
+LABEL(apply_list):
 	if(n > 0){
 		v = list(&FL(stack)[FL(sp)-n], n, 0);
 		POPN(n);
@@ -528,7 +528,7 @@
 		tail = false;
 	}
 	n = *ip++;
-apply_apply:
+LABEL(apply_apply):
 	v = POP();	 // arglist
 	n = FL(sp)-(n-2);  // n-2 == # leading arguments not in the list
 	while(iscons(v)){
@@ -542,13 +542,13 @@
 		lerrorf(FL(ArgError), "apply: last argument: not a list");
 	}
 	n = FL(sp)-n;
-	goto do_call;
+	goto LABEL(do_call);
 
 OP(OP_ADD)
 	n = *ip++;
 	if(n == 2)
-		goto do_add2;
-apply_add:
+		goto LABEL(do_add2);
+LABEL(apply_add):
 	FL(stack)[ipd] = (uintptr_t)ip;
 	v = fl_add_any(&FL(stack)[FL(sp)-n], n);
 	POPN(n);
@@ -557,11 +557,11 @@
 
 OP(OP_SUB)
 	n = *ip++;
-apply_sub:
+LABEL(apply_sub):
 	if(n == 2)
-		goto do_sub2;
+		goto LABEL(do_sub2);
 	if(n == 1)
-		goto do_neg;
+		goto LABEL(do_neg);
 	FL(stack)[ipd] = (uintptr_t)ip;
 	i = FL(sp)-n;
 	// we need to pass the full arglist on to fl_add_any
@@ -577,7 +577,7 @@
 
 OP(OP_MUL)
 	n = *ip++;
-apply_mul:
+LABEL(apply_mul):
 	FL(stack)[ipd] = (uintptr_t)ip;
 	v = fl_mul_any(&FL(stack)[FL(sp)-n], n);
 	POPN(n);
@@ -586,7 +586,7 @@
 
 OP(OP_DIV)
 	n = *ip++;
-apply_div:
+LABEL(apply_div):
 	FL(stack)[ipd] = (uintptr_t)ip;
 	i = FL(sp)-n;
 	if(n == 1){
@@ -649,7 +649,7 @@
 
 OP(OP_VECTOR)
 	n = *ip++;
-apply_vector:
+LABEL(apply_vector):
 	v = alloc_vector(n, 0);
 	if(n){
 		memcpy(&vector_elt(v, 0), &FL(stack)[FL(sp)-n], n*sizeof(value_t));
@@ -663,7 +663,7 @@
 	v = FL(stack)[FL(sp)-3];
 	n = 3;
 	if(0){
-apply_aset:
+LABEL(apply_aset):
 		v = FL(stack)[FL(sp)-n];
 		for(i = n-1; i >= 3; i--){
 			if(isarray(v)){