Przeglądaj źródła

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

Zeta 2 miesięcy temu
rodzic
commit
533baa5639
1 zmienionych plików z 3 dodań i 0 usunięć
  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
 	{