ref: 916bf9059194beb6d9a347b1c0638d9f64b4b0df
parent: ac53908936973028f1d8dd5d97043dbf8443c633
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Feb 17 01:18:22 EST 2025
vm: setg(l): simplify
--- a/src/vm.inc
+++ b/src/vm.inc
@@ -747,7 +747,7 @@
if(n == 1){
FL(stack)[FL(sp)-1] = fl_div2(fixnum(1), FL(stack)[i]);
}else{
- if(n > 2){
+ if(fl_unlikely(n > 2)){
PUSH(FL(stack)[i]);
FL(stack)[i] = fixnum(1);
FL(stack)[i+1] = fl_mul_any(&FL(stack)[i], n);
@@ -794,17 +794,16 @@
NEXT_OP;
}
-OP(OP_SETGL) {
- value_t v = fn_vals(FL(stack)[bp-1]);
- v = vector_elt(v, GET_INT32(ip));
- ip += 4;
+OP(OP_SETG) {
+ int i = *ip++;
if(0){
-OP(OP_SETG)
- v = fn_vals(FL(stack)[bp-1]);
- assert(*ip < vector_size(v));
- v = vector_elt(v, *ip);
- ip++;
+OP(OP_SETGL)
+ i = GET_INT32(ip);
+ ip += 4;
}
+ value_t v = fn_vals(FL(stack)[bp-1]);
+ assert(i < vector_size(v));
+ v = vector_elt(v, i);
assert(issymbol(v));
symbol_t *sym = ptr(v);
v = FL(stack)[FL(sp)-1];