From 81c6021fb40a254d9a586b0cb53453bba8973d80 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 10 Mar 2021 10:27:19 -0300 Subject: New implementation for 'tbclist' - Fixes a bug, by removing dummy nodes together with the node itself. (The previous implementation could leave dummy nodes in frames which otherwise had no tbc variables, and therefore would not close variables; that could leave 'tbclist' pointing higher than 'top', which could dangle if the stack shrank.) - Computes MAXDELTA based on the type of delta, to ease changing its type if needed. - Instead of 'isdummy', uses 'delta==0' to signal dummy nodes. (Dummy nodes always have MAXDELTA for their real delta.) --- lobject.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lobject.h') diff --git a/lobject.h b/lobject.h index 1a7a7372..950bebbd 100644 --- a/lobject.h +++ b/lobject.h @@ -139,13 +139,14 @@ typedef struct TValue { ** Entries in a Lua stack. Field 'tbclist' forms a list of all ** to-be-closed variables active in this stack. Dummy entries are ** used when the distance between two tbc variables does not fit -** in an unsigned short. +** in an unsigned short. They are represented by delta==0, and +** their real delta is always the maximum value that fits in +** that field. */ typedef union StackValue { TValue val; struct { TValuefields; - lu_byte isdummy; unsigned short delta; } tbclist; } StackValue; -- cgit v1.2.3-55-g6feb