[Tarantool-patches] [PATCH luajit v3 1/5] core: add const to lj_debug_line proto parameter

Mikhail Shishatskiy m.shishatskiy at tarantool.org
Fri Aug 20 10:05:42 MSK 2021


As `lj_debug_line` function does not change data under `pt`
pointer argument neither by designation nor in fact, it is
more correct to mark this pointer const.

Part of tarantool/tarantool#5814
---

Issue: https://github.com/tarantool/tarantool/issues/5814
Luajit branch: https://github.com/tarantool/luajit/tree/shishqa/gh-5814-group-allocations-on-trace-by-trace-number
tarantool branch: https://github.com/tarantool/tarantool/tree/shishqa/gh-5814-group-allocations-on-trace-by-trace-number

 src/lj_debug.c | 2 +-
 src/lj_debug.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lj_debug.c b/src/lj_debug.c
index bb9ab288..58b75dae 100644
--- a/src/lj_debug.c
+++ b/src/lj_debug.c
@@ -110,7 +110,7 @@ static BCPos debug_framepc(lua_State *L, GCfunc *fn, cTValue *nextframe)
 /* -- Line numbers -------------------------------------------------------- */
 
 /* Get line number for a bytecode position. */
-BCLine LJ_FASTCALL lj_debug_line(GCproto *pt, BCPos pc)
+BCLine LJ_FASTCALL lj_debug_line(const GCproto *pt, BCPos pc)
 {
   const void *lineinfo = proto_lineinfo(pt);
   if (pc <= pt->sizebc && lineinfo) {
diff --git a/src/lj_debug.h b/src/lj_debug.h
index a157d284..7814c588 100644
--- a/src/lj_debug.h
+++ b/src/lj_debug.h
@@ -27,7 +27,7 @@ typedef struct lj_Debug {
 } lj_Debug;
 
 LJ_FUNC cTValue *lj_debug_frame(lua_State *L, int level, int *size);
-LJ_FUNC BCLine LJ_FASTCALL lj_debug_line(GCproto *pt, BCPos pc);
+LJ_FUNC BCLine LJ_FASTCALL lj_debug_line(const GCproto *pt, BCPos pc);
 LJ_FUNC const char *lj_debug_uvname(GCproto *pt, uint32_t idx);
 LJ_FUNC const char *lj_debug_uvnamev(cTValue *o, uint32_t idx, TValue **tvp);
 LJ_FUNC const char *lj_debug_slotname(GCproto *pt, const BCIns *pc,
-- 
2.32.0



More information about the Tarantool-patches mailing list