Don't use jit_State during build with JIT disabled.

This commit is contained in:
Mike Pall 2022-06-08 11:20:28 +02:00
parent 68bb11405c
commit b32e94856b
3 changed files with 19 additions and 0 deletions

View File

@ -18,8 +18,10 @@
#include "lj_obj.h" #include "lj_obj.h"
#include "lj_gc.h" #include "lj_gc.h"
#include "lj_bc.h" #include "lj_bc.h"
#if LJ_HASJIT
#include "lj_ir.h" #include "lj_ir.h"
#include "lj_ircall.h" #include "lj_ircall.h"
#endif
#include "lj_frame.h" #include "lj_frame.h"
#include "lj_dispatch.h" #include "lj_dispatch.h"
#if LJ_HASFFI #if LJ_HASFFI
@ -250,6 +252,7 @@ BCDEF(BCNAME)
NULL NULL
}; };
#if LJ_HASJIT
const char *const ir_names[] = { const char *const ir_names[] = {
#define IRNAME(name, m, m1, m2) #name, #define IRNAME(name, m, m1, m2) #name,
IRDEF(IRNAME) IRDEF(IRNAME)
@ -290,7 +293,9 @@ static const char *const trace_errors[] = {
#include "lj_traceerr.h" #include "lj_traceerr.h"
NULL NULL
}; };
#endif
#if LJ_HASJIT
static const char *lower(char *buf, const char *s) static const char *lower(char *buf, const char *s)
{ {
char *p = buf; char *p = buf;
@ -301,6 +306,7 @@ static const char *lower(char *buf, const char *s)
*p = '\0'; *p = '\0';
return buf; return buf;
} }
#endif
/* Emit C source code for bytecode-related definitions. */ /* Emit C source code for bytecode-related definitions. */
static void emit_bcdef(BuildCtx *ctx) 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. */ /* Emit VM definitions as Lua code for debug modules. */
static void emit_vmdef(BuildCtx *ctx) static void emit_vmdef(BuildCtx *ctx)
{ {
#if LJ_HASJIT
char buf[80]; char buf[80];
#endif
int i; int i;
fprintf(ctx->fp, "-- This is a generated file. DO NOT EDIT!\n\n"); fprintf(ctx->fp, "-- This is a generated file. DO NOT EDIT!\n\n");
fprintf(ctx->fp, "return {\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]); for (i = 0; bc_names[i]; i++) fprintf(ctx->fp, "%-6s", bc_names[i]);
fprintf(ctx->fp, "\",\n\n"); fprintf(ctx->fp, "\",\n\n");
#if LJ_HASJIT
fprintf(ctx->fp, "irnames = \""); fprintf(ctx->fp, "irnames = \"");
for (i = 0; ir_names[i]; i++) fprintf(ctx->fp, "%-6s", ir_names[i]); for (i = 0; ir_names[i]; i++) fprintf(ctx->fp, "%-6s", ir_names[i]);
fprintf(ctx->fp, "\",\n\n"); fprintf(ctx->fp, "\",\n\n");
@ -355,6 +364,7 @@ static void emit_vmdef(BuildCtx *ctx)
for (i = 0; trace_errors[i]; i++) for (i = 0; trace_errors[i]; i++)
fprintf(ctx->fp, "\"%s\",\n", trace_errors[i]); fprintf(ctx->fp, "\"%s\",\n", trace_errors[i]);
fprintf(ctx->fp, "},\n\n"); fprintf(ctx->fp, "},\n\n");
#endif
} }
/* -- Argument parsing ---------------------------------------------------- */ /* -- Argument parsing ---------------------------------------------------- */

View File

@ -5,6 +5,7 @@
#include "buildvm.h" #include "buildvm.h"
#include "lj_obj.h" #include "lj_obj.h"
#if LJ_HASJIT
#include "lj_ir.h" #include "lj_ir.h"
/* Context for the folding hash table generator. */ /* Context for the folding hash table generator. */
@ -226,4 +227,10 @@ void emit_fold(BuildCtx *ctx)
makehash(ctx); makehash(ctx);
} }
#else
void emit_fold(BuildCtx *ctx)
{
UNUSED(ctx);
}
#endif

View File

@ -7,6 +7,7 @@
#define _LJ_JIT_H #define _LJ_JIT_H
#include "lj_obj.h" #include "lj_obj.h"
#if LJ_HASJIT
#include "lj_ir.h" #include "lj_ir.h"
/* -- JIT engine flags ---------------------------------------------------- */ /* -- JIT engine flags ---------------------------------------------------- */
@ -516,5 +517,6 @@ typedef struct jit_State {
#else #else
#define lj_assertJ(c, ...) ((void)J) #define lj_assertJ(c, ...) ((void)J)
#endif #endif
#endif
#endif #endif