]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Avoid zero-sized arrays in jit_State.
authorMike Pall <mike>
Wed, 8 Jun 2022 09:26:50 +0000 (11:26 +0200)
committerMike Pall <mike>
Wed, 8 Jun 2022 09:26:50 +0000 (11:26 +0200)
src/lj_jit.h

index f3c2a561816587004d03a4d09d9ffe5e08f27eb6..32b3861a11928f96eb830c5d286b653dba26d555 100644 (file)
@@ -372,6 +372,7 @@ enum {
 #endif
   LJ_K64__MAX,
 };
+#define LJ_K64__USED   (LJ_TARGET_X86ORX64 || LJ_TARGET_MIPS)
 
 enum {
 #if LJ_TARGET_X86ORX64
@@ -390,6 +391,7 @@ enum {
 #endif
   LJ_K32__MAX
 };
+#define LJ_K32__USED   (LJ_TARGET_X86ORX64 || LJ_TARGET_PPC || LJ_TARGET_MIPS)
 
 /* Get 16 byte aligned pointer to SIMD constant. */
 #define LJ_KSIMD(J, n) \
@@ -444,9 +446,13 @@ typedef struct jit_State {
   int32_t framedepth;  /* Current frame depth. */
   int32_t retdepth;    /* Return frame depth (count of RETF). */
 
+#if LJ_K32__USED
   uint32_t k32[LJ_K32__MAX];  /* Common 4 byte constants used by backends. */
+#endif
   TValue ksimd[LJ_KSIMD__MAX*2+1];  /* 16 byte aligned SIMD constants. */
+#if LJ_K64__USED
   TValue k64[LJ_K64__MAX];  /* Common 8 byte constants. */
+#endif
 
   IRIns *irbuf;                /* Temp. IR instruction buffer. Biased with REF_BIAS. */
   IRRef irtoplim;      /* Upper limit of instuction buffer (biased). */