Переглянути джерело

[jit] Make sure `ctx->currentPos > 0` before any register allocation can happen. (#789)

Zeta 3 місяців тому
батько
коміт
533baa5639
1 змінених файлів з 3 додано та 0 видалено
  1. 3 0
      src/jit.c

+ 3 - 0
src/jit.c

@@ -2935,6 +2935,9 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) {
 	ctx->totalRegsSize = size;
 	jit_buf(ctx);
 	ctx->functionPos = BUF_POS();
+	// make sure currentPos is > 0 before any reg allocations happen
+	// otherwise `alloc_reg` thinks that all registers are locked
+	ctx->currentPos = 1;
 	op_enter(ctx);
 #	ifdef HL_64
 	{