From b32e94856bf4970261e4d9d925133ba802a62d16 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Wed, 8 Jun 2022 11:20:28 +0200 Subject: [PATCH] Don't use jit_State during build with JIT disabled. --- src/host/buildvm.c | 10 ++++++++++ src/host/buildvm_fold.c | 7 +++++++ src/lj_jit.h | 2 ++ 3 files changed, 19 insertions(+) diff --git a/src/host/buildvm.c b/src/host/buildvm.c index 7348bd5b..9ee47ada 100644 --- a/src/host/buildvm.c +++ b/src/host/buildvm.c @@ -18,8 +18,10 @@ #include "lj_obj.h" #include "lj_gc.h" #include "lj_bc.h" +#if LJ_HASJIT #include "lj_ir.h" #include "lj_ircall.h" +#endif #include "lj_frame.h" #include "lj_dispatch.h" #if LJ_HASFFI @@ -250,6 +252,7 @@ BCDEF(BCNAME) NULL }; +#if LJ_HASJIT const char *const ir_names[] = { #define IRNAME(name, m, m1, m2) #name, IRDEF(IRNAME) @@ -290,7 +293,9 @@ static const char *const trace_errors[] = { #include "lj_traceerr.h" NULL }; +#endif +#if LJ_HASJIT static const char *lower(char *buf, const char *s) { char *p = buf; @@ -301,6 +306,7 @@ static const char *lower(char *buf, const char *s) *p = '\0'; return buf; } +#endif /* Emit C source code for bytecode-related definitions. */ static void emit_bcdef(BuildCtx *ctx) @@ -318,7 +324,9 @@ static void emit_bcdef(BuildCtx *ctx) /* Emit VM definitions as Lua code for debug modules. */ static void emit_vmdef(BuildCtx *ctx) { +#if LJ_HASJIT char buf[80]; +#endif int i; fprintf(ctx->fp, "-- This is a generated file. DO NOT EDIT!\n\n"); fprintf(ctx->fp, "return {\n\n"); @@ -327,6 +335,7 @@ static void emit_vmdef(BuildCtx *ctx) for (i = 0; bc_names[i]; i++) fprintf(ctx->fp, "%-6s", bc_names[i]); fprintf(ctx->fp, "\",\n\n"); +#if LJ_HASJIT fprintf(ctx->fp, "irnames = \""); for (i = 0; ir_names[i]; i++) fprintf(ctx->fp, "%-6s", ir_names[i]); fprintf(ctx->fp, "\",\n\n"); @@ -355,6 +364,7 @@ static void emit_vmdef(BuildCtx *ctx) for (i = 0; trace_errors[i]; i++) fprintf(ctx->fp, "\"%s\",\n", trace_errors[i]); fprintf(ctx->fp, "},\n\n"); +#endif } /* -- Argument parsing ---------------------------------------------------- */ diff --git a/src/host/buildvm_fold.c b/src/host/buildvm_fold.c index 7f9ac058..edb55768 100644 --- a/src/host/buildvm_fold.c +++ b/src/host/buildvm_fold.c @@ -5,6 +5,7 @@ #include "buildvm.h" #include "lj_obj.h" +#if LJ_HASJIT #include "lj_ir.h" /* Context for the folding hash table generator. */ @@ -226,4 +227,10 @@ void emit_fold(BuildCtx *ctx) makehash(ctx); } +#else +void emit_fold(BuildCtx *ctx) +{ + UNUSED(ctx); +} +#endif diff --git a/src/lj_jit.h b/src/lj_jit.h index 0b5ad4d6..f3c2a561 100644 --- a/src/lj_jit.h +++ b/src/lj_jit.h @@ -7,6 +7,7 @@ #define _LJ_JIT_H #include "lj_obj.h" +#if LJ_HASJIT #include "lj_ir.h" /* -- JIT engine flags ---------------------------------------------------- */ @@ -516,5 +517,6 @@ typedef struct jit_State { #else #define lj_assertJ(c, ...) ((void)J) #endif +#endif #endif