aboutsummaryrefslogtreecommitdiff
path: root/lgc.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Comments detailing the ages for generational GCRoberto Ierusalimschy2023-11-291-4/+7
| | | | Plus other comments and small details.
* External stringsRoberto Ierusalimschy2023-11-091-1/+3
| | | | Strings can use external buffers to store their contents.
* Towards external stringsRoberto Ierusalimschy2023-11-081-2/+2
| | | | Long strings have a pointer to string contents.
* Merge branch 'newarray' into nextversionRoberto Ierusalimschy2023-11-071-7/+18
|\
| * Merge branch 'master' into newarrayRoberto Ierusalimschy2023-11-031-8/+12
| |\
| * | Full implementation of new representation for arraysRoberto Ierusalimschy2023-11-031-4/+4
| | |
| * | Full abstraction for representation of array valuesRoberto Ierusalimschy2023-10-301-7/+18
| | |
* | | Merge branch 'master' into nextversionRoberto Ierusalimschy2023-08-231-6/+10
|\ \ \ | | |/ | |/|
| * | More disciplined use of 'getstr' and 'tsslen'Roberto Ierusalimschy2023-08-171-3/+5
| | | | | | | | | | | | | | | We may want to add other string variants in the future; this change documents better where the code may need to handle those variants.
| * | Thread stacks resized in the atomic phaseRoberto Ierusalimschy2023-07-131-3/+5
| | | | | | | | | | | | | | | | | | | | | Although stack resize can be a little expensive, it seems unusual to have too many threads needing resize during one GC cycle. On the other hand, the change allows full collections to skip the propagate phase, going straight from a pause to the atomic phase.
| * | Several functions turned 'static'Roberto Ierusalimschy2023-05-221-2/+2
| |/ | | | | | | | | Several functions that were already being used only inside their own file have been declared as 'static'.
* | Do not avoid major collections when GCdebt is zeroRoberto Ierusalimschy2022-12-291-5/+2
| | | | | | | | | | 'collectgarbage("step")' (without an argument) does not have any special meaning, it means "do a step with some default size".
* | Changed signal of GC debtRoberto Ierusalimschy2022-12-131-8/+8
| | | | | | | | Positive debts seems more natural then negative ones.
* | Revamp of GC parametersRoberto Ierusalimschy2022-12-131-9/+5
| | | | | | | | | | More uniformity when handling GC parameters + avoid divisions by 100 when applying them.
* | Merge branch 'master' into nextversionRoberto Ierusalimschy2022-12-121-2/+6
|\|
| * Reduce calls to 'luaC_step' when GC is stoppedRoberto Ierusalimschy2022-12-091-3/+6
| |
* | Simplification in handling of GC debtRoberto Ierusalimschy2022-12-061-7/+5
| | | | | | | | | | Each incremental step has always the same size (stepsize), and the debt for next step also is always the same.
* | Simpler control for major collectionsRoberto Ierusalimschy2022-11-291-120/+70
| |
* | Removed GC checks from function callsRoberto Ierusalimschy2022-11-241-1/+2
| | | | | | | | | | Function calls do not create new objects. (It may use memory with stack reallocation, but now that is irrelevant to the GC.)
* | 'l_mem' renamed to 'l_obj' to count objectsRoberto Ierusalimschy2022-11-231-25/+25
| |
* | First version of GC counting objects for controlRoberto Ierusalimschy2022-11-231-132/+121
| | | | | | | | Still needs to review generational mode.
* | Added a counter of the total number of existing objectsRoberto Ierusalimschy2022-11-031-0/+2
|/ | | | It may simplify the control of the garbage collector.
* Threads are created like other objectsRoberto Ierusalimschy2022-11-011-4/+10
| | | | | Using a version of 'luaC_newobj' that allows offsets (extra space before the object itself).
* Stack indices changed to union'sRoberto Ierusalimschy2022-10-291-10/+10
| | | | | That will allow to change pointers to offsets while reallocating the stack.
* Bug: set correct pause when (re)entering gen. collection.Roberto Ierusalimschy2022-08-231-32/+31
|
* Bug: finalizer calling exit can corrupt finalization orderRoberto Ierusalimschy2021-12-221-5/+5
| | | | | 'os.exit' can call lua_close again, separating new finalizers created after all previous finalizers were already separated.
* Fix debug information about finalizersRoberto Ierusalimschy2021-12-141-1/+1
| | | | | | The flag CIST_FIN does not mark a finalizer, but the function that was running when the finalizer was called. (So, the function did not call the finalizer, but it looks that way in the stack.)
* Bug: GC is not reentrantRoberto Ierusalimschy2021-12-131-4/+7
| | | | As the GC is not reentrant, finalizers should not be able to invoke it.
* New control for reentrancy of emergency collectionsRoberto Ierusalimschy2021-02-261-12/+24
| | | | | | 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.
* Broadening the use of branch hintsRoberto Ierusalimschy2021-02-241-1/+1
| | | | | | 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).
* Bug when growing a stackRoberto Ierusalimschy2020-11-081-2/+2
| | | | | | When a stack grows, its extra area can be in use, and it becomes part of the common area. So, the extra area must be kept correct all the times. (Bug introduced by commit 5aa36e894f5.)
* Fixed bug of keys removed from tables vs 'next'Roberto Ierusalimschy2020-10-141-9/+8
| | | | | | Fixed the bug that a key removed from a table might not be found again by 'next'. (This is needed to allow keys to be removed during a traversal.) This bug was introduced in commit 73ec04fc.
* DetailsRoberto Ierusalimschy2020-10-121-11/+19
| | | | | | | - After converting a generic GCObject to a specific type ('gco2*'), avoid using the original GCObject (to reduce aliasing). - Small corrections in comments in 'lopcodes.h' - Added tests about who calls __close metamethods
* No more field 'lua_State.stacksize'Roberto Ierusalimschy2020-10-121-3/+2
| | | | | | The stack size is derived from 'stack_last', when needed. Moreover, the handling of stack sizes is more consistent, always excluding the extra space except when allocating/deallocating the array.
* Better control of gray objectsRoberto Ierusalimschy2020-08-171-44/+50
| | | | | | Avoid turning an object to gray except at the moment it is inserted in a gray list or in the explicit exceptional cases such as open upvalues and fixed strings.
* Small changes in macros that change GC colorsRoberto Ierusalimschy2020-08-131-27/+27
| | | | | | | | | | | | | - Macro 'gray2black' was renamed 'nw2black' (Non-White to black), as it was already being used on objects that could be already black. - Macros 'white2gray' and 'black2gray' were unified in 'set2gray'; no reason to have two macros when one will do and, again, 'black2gray' was already being used on objects that could be already gray. Moreover, macros 'maskcolors' and 'maskgcbits' were negated to have ones in the described bits, instead of zeros. (This naming seems more intuitive.)
* TOUCHED2 objects are not always blackRoberto Ierusalimschy2020-08-131-8/+2
| | | | | | | This commit fixes a bug introduced in commit 9cf3299fa. TOUCHED2 objects are always black while the mutator runs, but they can become temporarily gray inside a minor collection (e.g., if the object is a weak table).
* Open upvalues should be gray when entering gen. modeRoberto Ierusalimschy2020-08-071-8/+13
| | | | | Open upvalues are never black; so, when entering generational mode, they must be colored gray, not black.
* Detail (in asserts)Roberto Ierusalimschy2020-08-031-4/+1
| | | | Macro 'checkconsistency' replaced by the similar 'checkliveness".
* Threads don't need to always go to 'grayagain'Roberto Ierusalimschy2020-08-031-18/+29
| | | | | | | In incremental mode, threads don't need to be visited again once visited in the atomic phase. In generational mode (where all visits are in the atomic phase), only old threads need to be kept in the 'grayagain' list for the next cycle.
* Clearer handling of gray lists when entering generational modeRoberto Ierusalimschy2020-08-031-6/+30
| | | | | | | | When entering generational mode, all objects are old. So, the only objects that need to be in a gray list are threads, which can be assigned without barriers. Changes in anything else (e.g., weak tables) will trigger barriers that, if needed, will add the object to a gray list.
* Optimization in 'markold'Roberto Ierusalimschy2020-07-291-17/+42
| | | | | | | | | | OLD1 objects can be potentially anywhere in the 'allgc' list (up to 'reallyold'), but frequently they are all after 'old1' (natural evolution of survivals) or do not exist at all (when all objects die young). So, instead of 'markold' starts looking for them always from the start of 'allgc', the collector keeps an extra pointer, 'firstold1', that points to the first OLD1 object in the 'allgc' list, or is NULL if there are no OLD1 objects in that list.
* DetailsRoberto Ierusalimschy2020-07-291-15/+15
| | | | | The fields 'old' and 'finobjold' were renamed 'old1' and 'finobjold1', respectively, to make clearer the main ages of their elements.
* OLD1 ages advanced by 'markold'Roberto Ierusalimschy2020-07-291-5/+6
| | | | | Objects aged OLD1 have their ages advanced by 'markold', which has to visit them anyway. So, the GC doesn't need to "sweep" the old1 list.
* Same changes around 'correctgraylist'Roberto Ierusalimschy2020-07-281-53/+66
| | | | | | | Instead of adding all tables and userdata back to the 'grayagain' list to be checked by 'correctgraylist', the collector adds only the objects that will remain in that list (objects aged TOUCHED1). This commit also rewrites 'correctgraylist' with a clearer logic.
* All objects are kept 'new' in incremental GCRoberto Ierusalimschy2020-07-271-17/+21
| | | | | | Small changes to ensure that all objects are kept 'new' in incremental GC (except for fixed strings, which are always old) and to make that fact clearer.
* Fixed bug: barriers cannot be active during sweepRoberto Ierusalimschy2020-07-271-16/+32
| | | | | | | Barriers cannot be active during sweep, even in generational mode. (Although gen. mode is not incremental, it can hit a barrier when deleting a thread and closing its upvalues.) The colors of objects are being changed during sweep and, therefore, cannot be trusted.
* Fixed bug of old finalized objects in the GCRoberto Ierusalimschy2020-07-101-6/+4
| | | | | | When an object aged OLD1 is finalized, it is moved from the list 'finobj' to the *beginning* of the list 'allgc'. So, this part of the list (and not only the survival list) must be visited by 'markold'.
* Added 'simplesect' sections to the manualRoberto Ierusalimschy2020-04-131-1/+1
| | | | | | | 'simplesect' encloses the introductory text of sections with subsections, so that each section either is all text or is all subsections. (This commit also corrects a small brace error in the manual and extra spaces/tabs in some other files.)
* Clearer distinction between types and tagsRoberto Ierusalimschy2020-01-311-29/+29
| | | | | LUA_T* represents only types; tags (types + Variants) are represented by LUA_V* constants.