diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-09-19 19:02:14 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-09-19 19:02:14 -0300 |
commit | ddfa1fbccfe4c1ec69f7396a4f5842abe70927ba (patch) | |
tree | df467dc5dc5c64a21bb976ec661796d17d37f791 /llimits.h | |
parent | b443145ff3415fcaee903a7d95fa7212df5a77db (diff) | |
download | lua-ddfa1fbccfe4c1ec69f7396a4f5842abe70927ba.tar.gz lua-ddfa1fbccfe4c1ec69f7396a4f5842abe70927ba.tar.bz2 lua-ddfa1fbccfe4c1ec69f7396a4f5842abe70927ba.zip |
GC back to controling pace counting bytes
Memory is the resource we want to save. Still to be reviewed again.
Diffstat (limited to 'llimits.h')
-rw-r--r-- | llimits.h | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -16,25 +16,24 @@ | |||
16 | 16 | ||
17 | 17 | ||
18 | /* | 18 | /* |
19 | ** 'lu_mem' is an unsigned integer big enough to count the total memory | 19 | ** 'l_mem' is a signed integer big enough to count the total memory |
20 | ** used by Lua (in bytes). 'l_obj' is a signed integer big enough to | 20 | ** used by Lua. (It is signed due to the use of debt in several |
21 | ** count the total number of objects used by Lua. (It is signed due | 21 | ** computations.) Usually, 'ptrdiff_t' should work, but we use 'long' |
22 | ** to the use of debt in several computations.) Usually, 'size_t' and | 22 | ** for 16-bit machines. |
23 | ** 'ptrdiff_t' should work, but we use 'long' for 16-bit machines. | ||
24 | */ | 23 | */ |
25 | #if defined(LUAI_MEM) /* { external definitions? */ | 24 | #if defined(LUAI_MEM) /* { external definitions? */ |
25 | typedef LUAI_MEM l_mem; | ||
26 | typedef LUAI_UMEM lu_mem; | 26 | typedef LUAI_UMEM lu_mem; |
27 | typedef LUAI_MEM l_obj; | ||
28 | #elif LUAI_IS32INT /* }{ */ | 27 | #elif LUAI_IS32INT /* }{ */ |
28 | typedef ptrdiff_t l_mem; | ||
29 | typedef size_t lu_mem; | 29 | typedef size_t lu_mem; |
30 | typedef ptrdiff_t l_obj; | ||
31 | #else /* 16-bit ints */ /* }{ */ | 30 | #else /* 16-bit ints */ /* }{ */ |
31 | typedef long l_mem; | ||
32 | typedef unsigned long lu_mem; | 32 | typedef unsigned long lu_mem; |
33 | typedef long l_obj; | ||
34 | #endif /* } */ | 33 | #endif /* } */ |
35 | 34 | ||
36 | #define MAX_LOBJ \ | 35 | #define MAX_LMEM \ |
37 | cast(l_obj, (cast(lu_mem, 1) << (sizeof(l_obj) * CHAR_BIT - 1)) - 1) | 36 | cast(l_mem, (cast(lu_mem, 1) << (sizeof(l_mem) * 8 - 1)) - 1) |
38 | 37 | ||
39 | 38 | ||
40 | /* chars used as small naturals (so that 'char' is reserved for characters) */ | 39 | /* chars used as small naturals (so that 'char' is reserved for characters) */ |