Browse code

Fix OP_BC_GEPZ/OP_BC_GEP1 in interpreter.

It helps if the interpreter actually increments the variable by a non-zero
amount.

Török Edvin authored on 2010/03/30 04:33:20
Showing 1 changed files
... ...
@@ -1052,8 +1052,10 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
1052 1052
 		    WRITE64(inst->dest, ptr_compose(stackid,
1053 1053
 						    inst->u.three[1]+off));
1054 1054
 		} else {
1055
+		    int32_t off;
1056
+		    READ32(off, inst->u.three[2]);
1055 1057
 		    READ64(ptr, inst->u.three[1]);
1056
-		    WRITE64(inst->dest, ptr);
1058
+		    WRITE64(inst->dest, ptr+off);
1057 1059
 		}
1058 1060
 		break;
1059 1061
 	    }
... ...
@@ -1151,10 +1153,12 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
1151 1151
 		    int32_t off;
1152 1152
 		    READ32(off, inst->u.three[2]);
1153 1153
 		    WRITE64(inst->dest, ptr_compose(stackid,
1154
-						    inst->u.three[1]+off));
1154
+						    inst->u.three[1]+off*inst->u.three[0]));
1155 1155
 		} else {
1156
+		    int32_t off;
1157
+		    READ32(off, inst->u.three[2]);
1156 1158
 		    READ64(ptr, inst->u.three[1]);
1157
-		    WRITE64(inst->dest, ptr);
1159
+		    WRITE64(inst->dest, ptr+off*inst->u.three[0]);
1158 1160
 		}
1159 1161
 		break;
1160 1162
 	    }