ソースを参照

[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;
 	ctx->totalRegsSize = size;
 	jit_buf(ctx);
 	jit_buf(ctx);
 	ctx->functionPos = BUF_POS();
 	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);
 	op_enter(ctx);
 #	ifdef HL_64
 #	ifdef HL_64
 	{
 	{