[Tarantool-patches] [PATCH luajit 2/7] build: fix build with JIT disabled

Igor Munkin imun at tarantool.org
Mon Feb 13 20:02:44 MSK 2023


struct GCtrace is defined only if LJ_HASJIT is set. Hence all spots
where GCtrace is used should be also moved under LJ_HASJIT define.

Relates to tarantool/tarantool#8252

Signed-off-by: Igor Munkin <imun at tarantool.org>
---
 src/lj_memprof.c |  9 ++++-----
 src/lj_symtab.c  | 13 +++----------
 src/lj_symtab.h  |  2 ++
 3 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/src/lj_memprof.c b/src/lj_memprof.c
index d4a639fd..8cab8204 100644
--- a/src/lj_memprof.c
+++ b/src/lj_memprof.c
@@ -369,6 +369,8 @@ void lj_memprof_add_proto(const struct GCproto *pt)
   lj_symtab_dump_proto(&mp->out, pt);
 }
 
+#if LJ_HASJIT
+
 void lj_memprof_add_trace(const struct GCtrace *tr)
 {
   struct memprof *mp = &memprof;
@@ -380,6 +382,8 @@ void lj_memprof_add_trace(const struct GCtrace *tr)
   lj_symtab_dump_trace(&mp->out, tr);
 }
 
+#endif /* LJ_HASJIT */
+
 #else /* LJ_HASMEMPROF */
 
 int lj_memprof_start(struct lua_State *L, const struct lj_memprof_options *opt)
@@ -401,9 +405,4 @@ void lj_memprof_add_proto(const struct GCproto *pt)
   UNUSED(pt);
 }
 
-void lj_memprof_add_trace(const struct GCtrace *tr)
-{
-  UNUSED(tr);
-}
-
 #endif /* LJ_HASMEMPROF */
diff --git a/src/lj_symtab.c b/src/lj_symtab.c
index 91ee9a72..54984c05 100644
--- a/src/lj_symtab.c
+++ b/src/lj_symtab.c
@@ -53,16 +53,7 @@ void lj_symtab_dump_trace(struct lj_wbuf *out, const GCtrace *trace)
   lj_wbuf_addu64(out, (uint64_t)lineno);
 }
 
-#else
-
-static void lj_symtab_dump_trace(struct lj_wbuf *out, const GCtrace *trace)
-{
-  UNUSED(out);
-  UNUSED(trace);
-  lua_assert(0);
-}
-
-#endif
+#endif /* LJ_HASJIT */
 
 void lj_symtab_dump_proto(struct lj_wbuf *out, const GCproto *pt)
 {
@@ -491,11 +482,13 @@ void lj_symtab_dump(struct lj_wbuf *out, const struct global_State *g,
       lj_symtab_dump_proto(out, pt);
       break;
     }
+#if LJ_HASJIT
     case (~LJ_TTRACE): {
       lj_wbuf_addbyte(out, SYMTAB_TRACE);
       lj_symtab_dump_trace(out, gco2trace(o));
       break;
     }
+#endif /* LJ_HASJIT */
     default:
       break;
     }
diff --git a/src/lj_symtab.h b/src/lj_symtab.h
index 6faa5cb1..6ec0cd7c 100644
--- a/src/lj_symtab.h
+++ b/src/lj_symtab.h
@@ -60,10 +60,12 @@
 #define SYMTAB_TRACE ((uint8_t)2)
 #define SYMTAB_FINAL ((uint8_t)0x80)
 
+#if LJ_HASJIT
 /*
 ** Dumps traceinfo into the symbol table.
 */
 void lj_symtab_dump_trace(struct lj_wbuf *out, const GCtrace *trace);
+#endif /* LJ_HASJIT */
 
 /*
 ** Dumps function prototype.
-- 
2.30.2



More information about the Tarantool-patches mailing list