aboutsummaryrefslogtreecommitdiff
path: root/src/lj_api.c
diff options
context:
space:
mode:
authorMike Pall <mike>2020-03-20 13:35:49 +0100
committerMike Pall <mike>2020-03-20 13:35:49 +0100
commite613105ca92fe25e7bd63031b409faa8c908ac35 (patch)
tree98ba088a848a608d02aea34f5359d708bf2160e5 /src/lj_api.c
parent522d2073da4be2af79db4728cbb375db0fbdfc48 (diff)
downloadluajit-e613105ca92fe25e7bd63031b409faa8c908ac35.tar.gz
luajit-e613105ca92fe25e7bd63031b409faa8c908ac35.tar.bz2
luajit-e613105ca92fe25e7bd63031b409faa8c908ac35.zip
Fix write barrier for lua_setupvalue() and debug.setupvalue().
Diffstat (limited to 'src/lj_api.c')
-rw-r--r--src/lj_api.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lj_api.c b/src/lj_api.c
index e2d7e533..1a34a774 100644
--- a/src/lj_api.c
+++ b/src/lj_api.c
@@ -841,7 +841,8 @@ LUA_API int lua_next(lua_State *L, int idx)
841LUA_API const char *lua_getupvalue(lua_State *L, int idx, int n) 841LUA_API const char *lua_getupvalue(lua_State *L, int idx, int n)
842{ 842{
843 TValue *val; 843 TValue *val;
844 const char *name = lj_debug_uvnamev(index2adr(L, idx), (uint32_t)(n-1), &val); 844 GCobj *o;
845 const char *name = lj_debug_uvnamev(index2adr(L, idx), (uint32_t)(n-1), &val, &o);
845 if (name) { 846 if (name) {
846 copyTV(L, L->top, val); 847 copyTV(L, L->top, val);
847 incr_top(L); 848 incr_top(L);
@@ -1014,13 +1015,14 @@ LUA_API const char *lua_setupvalue(lua_State *L, int idx, int n)
1014{ 1015{
1015 cTValue *f = index2adr(L, idx); 1016 cTValue *f = index2adr(L, idx);
1016 TValue *val; 1017 TValue *val;
1018 GCobj *o;
1017 const char *name; 1019 const char *name;
1018 api_checknelems(L, 1); 1020 api_checknelems(L, 1);
1019 name = lj_debug_uvnamev(f, (uint32_t)(n-1), &val); 1021 name = lj_debug_uvnamev(f, (uint32_t)(n-1), &val, &o);
1020 if (name) { 1022 if (name) {
1021 L->top--; 1023 L->top--;
1022 copyTV(L, val, L->top); 1024 copyTV(L, val, L->top);
1023 lj_gc_barrier(L, funcV(f), L->top); 1025 lj_gc_barrier(L, o, L->top);
1024 } 1026 }
1025 return name; 1027 return name;
1026} 1028}