Commit Graph

113 Commits

Author SHA1 Message Date
Roberto Ierusalimschy
a04e0ffdb9 Rename of fields in global state that control GC
All fields in the global state that control the pace of the garbage
collector prefixed with 'GC'.
2024-09-06 14:38:39 -03:00
Roberto Ierusalimschy
f2206b2abe '-Wconversion' extended to all options of Lua numbers 2024-07-27 15:13:21 -03:00
Roberto Ierusalimschy
0acd55898d Added gcc option '-Wconversion'
No warnings for standard numerical types. Still pending alternative
numerical types.
2024-07-27 13:32:59 -03:00
Roberto Ierusalimschy
88e5c6b80b Merge branch 'master' into nextversion 2022-12-15 10:51:04 -03:00
Roberto Ierusalimschy
35e01ed21d Small improvements in 'lmem.c'
Added some auxiliary macros + fixed a bug in compilation option
EMERGENCYGCTESTS. (It should not try to force an emergency collection
when it cannot run one.)
2022-12-15 10:44:55 -03:00
Roberto Ierusalimschy
f356d5acdd First version of GC counting objects for control
Still needs to review generational mode.
2022-11-23 17:17:20 -03:00
Roberto Ierusalimschy
1537d6680b New control for reentrancy of emergency collections
Instead of assuming that shrinking a block may be an emergency
collection, use an explicit field ('gcstopem') to stop emergency
collections while GC is working.
2021-02-26 11:41:02 -03:00
Roberto Ierusalimschy
59c88f846d Broadening the use of branch hints
More uses of macros 'likely'/'unlikely' (renamed to
'l_likely'/'l_unlikely'), both in range (extended to the
libraries) and in scope (extended to hooks, stack growth).
2021-02-24 11:14:44 -03:00
Roberto Ierusalimschy
c63e5d212b New macro 'completestate' 2021-02-05 17:51:25 -03:00
Roberto Ierusalimschy
56ec432281 Change in macro HARDMEMTESTS for testing GC
Macro HARDMEMTESTS broke in two: HARDMEMTESTS forces a full GC cycle
at every point where the GC can run. New macro EMERGENCYGCTESTS
forces an emergency collection at every memory allocation.
2020-07-08 15:36:48 -03:00
Roberto Ierusalimschy
bd1b87c579 Comments (mosty typos) 2019-12-30 11:45:08 -03:00
Roberto Ierusalimschy
9cdf6b7082 Some details in 'lmem.c' and 'lgc.c'
- Several new comments in 'lmem.c'.
- Both 'luaM_growaux_' and 'luaM_shrinkvector_' use 'luaM_saferealloc_'
  to check for errors. Moreover, the use of 'luaM_saferealloc_' makes
  'luaM_shrinkvector_' try again if shrink fails (which can happen now).
- In 'checkSizes', save old debt only when needed.
2019-07-19 09:43:35 -03:00
Roberto Ierusalimschy
d36a31e673 Reviving HARDMEMTESTS
This commit brings a new implementation for HARDMEMTESTS, which forces
an emergency GC whenever possible. It also fixes some issues detected
with this option:
  - A small bug in lvm.c: a closure could be collected by an emergency
  GC while being initialized.
  - Some tests: a memory address can be immediatly reused after a GC;
  for instance, two consecutive '{}' expressions can return exactly the
  same address, if the first one is not anchored.
2019-07-18 14:58:15 -03:00
Roberto Ierusalimschy
ea1322ef54 Detail: bad assertion in 'luaM_free_' 2018-10-23 12:58:38 -03:00
Roberto Ierusalimschy
f99509581e Removed extra information from RCS keyword strings
Version numbers and dates (mostly wrong) from RCS keyword strings
removed from all source files; only the file name are kept.
2018-08-23 14:26:12 -03:00
Roberto Ierusalimschy
af70905246 no need to check whether libraries and host use the same kernel;
Lua should work correctly with several copies of the kernel
2018-06-18 09:08:10 -03:00
Roberto Ierusalimschy
34aa0c5bd7 new macros 'likely'/'unlikely' with hints for jump predictions
(used only in errors for now)
2018-05-30 11:25:52 -03:00
Roberto Ierusalimschy
e2b15aa21d janitor work on casts 2018-01-28 13:13:26 -02:00
Roberto Ierusalimschy
c5ebed7399 'luaM_shrinkvector' raises an error if it cannot shrink the block
(several parts of Lua use array size in protos as proxies for
number of valid elements)
2017-12-11 10:27:48 -02:00
Roberto Ierusalimschy
e663a24ab0 more freedom in handling memory-allocation errors (not all allocations
automatically raise an error), which allows fixing a bug when resizing
a table.
2017-12-08 15:28:25 -02:00
Roberto Ierusalimschy
7622373033 using explicit tests for allocation overflow whenever possible 2017-12-07 16:59:52 -02:00
Roberto Ierusalimschy
49dfaf7447 avoid using one function for different tasks (malloc, free, etc.) 2017-12-06 16:36:31 -02:00
Roberto Ierusalimschy
bb4baa73ea allocation function is not exactly API (and cannot raise errors
like other API functions); better not use 'api_check' for cheking it.
2015-03-06 16:45:54 -03:00
Roberto Ierusalimschy
b9a1f27250 do not attempt emergency collection while building state (it is
useless, and state can be inconsistent)
2015-03-03 15:18:29 -03:00
Roberto Ierusalimschy
e75c0148c3 comments (references to "ANSI C" changed to "ISO C", which is the
international name
2014-11-02 17:33:33 -02:00
Roberto Ierusalimschy
28fdbcf393 added include for 'lprefix.h', for stuff that must be added before
any other header file
2014-11-02 17:19:04 -02:00
Roberto Ierusalimschy
bdf566a8a3 `name' in comments changed to 'name' 2014-10-25 09:50:46 -02:00
Roberto Ierusalimschy
5bbb4a06a6 removed unused parameter Ä'L' in macro 'api_check' and company 2014-07-15 18:26:50 -03:00
Roberto Ierusalimschy
7cc40851e1 emergency collection can happen even when collector is stopped 2014-06-26 15:29:05 -03:00
Roberto Ierusalimschy
e131eb0d9a removed debug code 2012-05-23 12:41:53 -03:00
Roberto Ierusalimschy
e21b26a964 avoid 'return' "to avoid warnings" 2011-11-30 10:42:49 -02:00
Roberto Ierusalimschy
12ab78aca6 detail in extra trace code: total bytes is given by 'gettotalbytes',
not by 'totalbytes' counter.
2011-09-20 16:25:23 -03:00
Roberto Ierusalimschy
551b076f1c change in the relationship between totalbytes and GCdebt - luaM_realloc_
is too critical to update two counters
2010-12-20 17:40:07 -02:00
Roberto Ierusalimschy
737f119187 better control for GC running or stopped 2010-12-20 16:17:46 -02:00
Roberto Ierusalimschy
237f755dca typos in comments 2010-05-05 15:49:56 -03:00
Roberto Ierusalimschy
e7ce7e1850 changes in patch to monitor garbage collection 2010-05-04 15:10:02 -03:00
Roberto Ierusalimschy
9a9fe42deb wrong comment 2010-04-30 15:17:24 -03:00
Roberto Ierusalimschy
3410dcd375 new way to control GC speed 2010-04-29 14:35:10 -03:00
Roberto Ierusalimschy
e54668b696 added proper code to trace garbage collection 2010-04-02 11:37:41 -03:00
Roberto Ierusalimschy
0bbdddc86b allocator function receives the tag of object being allocated in 'osize'
when 'ptr' is NULL.
2009-12-17 13:46:44 -02:00
Roberto Ierusalimschy
bd869c7b31 details 2006-09-14 15:42:28 -03:00
Roberto Ierusalimschy
d5a23dde90 little better error messages for internal arrays overflows 2006-09-14 09:59:06 -03:00
Roberto Ierusalimschy
3ca9af51a4 emergency garbage collector (core forces a GC when allocation fails) 2006-07-11 12:53:29 -03:00
Roberto Ierusalimschy
0160591998 removal of dead code 2005-12-26 11:35:47 -02:00
Roberto Ierusalimschy
d55bb795fa details 2005-02-23 14:30:22 -03:00
Roberto Ierusalimschy
8e346d875a auxiliar patch to monitor garbage collection 2005-01-14 12:21:16 -02:00
Roberto Ierusalimschy
97e2dab1fb better control of overflows in size computations 2004-12-01 13:46:18 -02:00
Roberto Ierusalimschy
6f1ea817f5 better control over memory-size overflows 2004-11-19 13:52:40 -02:00
Roberto Ierusalimschy
0b06241483 better control for GC cycles 2004-08-30 10:44:44 -03:00
Roberto Ierusalimschy
b4cd38ba6c new scheme for configuration through `luaconf.h' 2004-04-30 17:13:38 -03:00