aboutsummaryrefslogtreecommitdiff
path: root/ltable.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Scanner and parser use different tables for constantsRoberto Ierusalimschy2024-12-171-2/+0
| | | | | | | | | | Moreover, each function being parsed has its own table. The code is cleaner when each table is used for one specific purpose: The scanner uses its table to anchor and unify strings, mapping strings to themselves; the parser uses it to reuse constants in the code, mapping constants to their indices in the constant table. A different table for each task avoids false collisions.
* 'luaH_fastseti' uses 'checknoTM'Roberto Ierusalimschy2024-12-111-1/+1
| | | | | | The extra check in checknoTM (versus only checking whether there is a metatable) is cheap, and it is not that uncommon for a table to have a metatable without a __newindex metafield.
* New way to keep hints for table lengthRoberto Ierusalimschy2024-11-291-14/+22
| | | | | | | | | | Instead of using 'alimit' for keeping the size of the array and at the same time being a hint for '#t', a table now keeps these two values separate. The Table structure has a field 'asize' with the size of the array, while the length hint is kept in the array itself. That way, tables with no array part waste no space with that field. Moreover, the space for the hint may have zero cost for small arrays, if the array of tags plus the hint still fits in a single word.
* 'objsize' returns 'l_mem'Roberto Ierusalimschy2024-11-151-1/+1
| | | | Sums of size_t may not fit in a size_t.
* 'objsize' broke in smaller piecesRoberto Ierusalimschy2024-09-301-0/+1
|
* Added gcc option '-Wconversion'Roberto Ierusalimschy2024-07-271-5/+5
| | | | | No warnings for standard numerical types. Still pending alternative numerical types.
* Encoding of table indices (hres) must use C indicesRoberto Ierusalimschy2024-06-101-15/+21
| | | | | As the encoding of array indices is (~index), 0 is encoded as -1 and INT_MAX is encoded as INT_MIN.
* Yet another representation for arraysRoberto Ierusalimschy2024-04-051-17/+20
| | | | | | This "linear" representation (see ltable.h for details) has worse locality than cells, but the simpler access code seems to compensate that.
* Some 'unsigned int' changed to 'unsigned'Roberto Ierusalimschy2024-03-221-4/+4
| | | | | 'unsigned int' is too long sometimes. (We already write 'long' instead of 'long int'...)
* 'luaH_get' functions return tag of the resultRoberto Ierusalimschy2024-03-211-13/+16
| | | | | | | Undoing previous commit. Returning TValue increases code size without any visible gains. Returning the tag is a little simpler than returning a special code (HOK/HNOTFOUND) and the tag is useful by itself in some cases.
* 'luaH_get' functions return 'TValue'Roberto Ierusalimschy2024-03-181-16/+13
| | | | | | Instead of receiving a parameter telling them where to put the result of the query, these functions return the TValue directly. (That is, they return a structure.)
* Removed "bulk operations"Roberto Ierusalimschy2024-03-151-15/+3
| | | | Negligible performance gains don't justify extra complexity.
* Added "bulk operations" to arraysRoberto Ierusalimschy2024-03-151-3/+15
| | | | | A few operations on arrays can be performed "in bulk", treating all tags of a cell as a simple (or a few) word(s).
* Optimizations for 'lua_rawgeti' and 'lua_rawseti'Roberto Ierusalimschy2024-01-121-0/+19
| | | | | | 'lua_rawgeti' now uses "fast track"; 'lua_rawseti' still calls 'luaH_setint', but the latter was recoded to avoid extra overhead when writing to the array part after 'alimit'.
* Simpler coding for new representation for arraysRoberto Ierusalimschy2023-11-241-30/+8
| | | | | With the tags comming first in a cell, we can define the whole cell as a C type and let C do part of the address computations.
* DetailsRoberto Ierusalimschy2023-11-081-9/+18
| | | | Comments and parameter name in header file.
* Merge branch 'newarray' into nextversionRoberto Ierusalimschy2023-11-071-5/+94
|\
| * Merge branch 'master' into newarrayRoberto Ierusalimschy2023-11-031-2/+0
| |\
| * | Full implementation of new representation for arraysRoberto Ierusalimschy2023-11-031-13/+50
| | |
| * | Full abstraction for representation of array valuesRoberto Ierusalimschy2023-10-301-4/+17
| | |
| * | Some cleaning in the new table APIRoberto Ierusalimschy2023-05-161-15/+22
| | |
| * | New table API for 'set' functionsRoberto Ierusalimschy2023-05-161-0/+11
| | |
| * | Towards a new implementation of arraysRoberto Ierusalimschy2023-05-151-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The array part of a table wastes too much space, due to padding. To avoid that, we need to store values in the array as something different from a TValue. Therefore, the API for table access should not assume that any value in a table lives in a *TValue. This commit is the first step to remove that assumption: functions luaH_get*, instead of returning a *TValue where the value lives, receive a *TValue where to put the value being accessed. (We still have to change the luaH_set* functions.)
* | | Merge branch 'master' into nextversionRoberto Ierusalimschy2023-06-221-2/+0
|\ \ \ | | |/ | |/|
| * | DetailsRoberto Ierusalimschy2023-05-151-2/+0
| |/ | | | | | | | | - Better comments about short strings in opcodes. - luaH_newkey made static.
* / Tables have a 'lastfree' information only when neededRoberto Ierusalimschy2022-11-011-2/+12
|/ | | | | Only tables with some minimum number of entries in their hash part have a 'lastfree' field, kept in a header before the node vector.
* Removed test function 'luaH_isdummy'Roberto Ierusalimschy2022-10-211-1/+0
| | | | It was not being used anywhere.
* Changes in the API of 'luaH_set' and related functionsRoberto Ierusalimschy2020-12-041-2/+6
| | | | | Functions to set values in a table (luaH_set, luaH_newkey, etc.) receive the new value, instead of returning a slot where to put the value.
* Free bit 7 of GC 'marked' fieldRoberto Ierusalimschy2020-08-071-1/+6
| | | | | | | | Tables were using this bit to indicate their array sizes were real ('isrealasize'), but this bit can be useful for tests. Instead, they can use bit 7 of their 'flag' field for that purpose. (There are only six fast-access metamethods.) This 'flag' field only exists in tables, so this use does not affect other types.
* Several details about 5.4.0 rc1Roberto Ierusalimschy2020-04-231-1/+1
| | | | | Corrected several small details: added 'const', adjusts in tabs x spaces, removed unused #includes and #defines, misspellings, etc.
* Removed extra information from RCS keyword stringsRoberto Ierusalimschy2018-08-231-1/+1
| | | | | Version numbers and dates (mostly wrong) from RCS keyword strings removed from all source files; only the file name are kept.
* field 'sizearray' in struct 'Table' changed to 'alimit', which canRoberto Ierusalimschy2018-06-151-1/+2
| | | | be used as a hint for '#t'
* no more 'luaH_emptyobject' and comparisons of addresses of global variablesRoberto Ierusalimschy2018-06-011-6/+1
| | | | | (instead, use a different kind of nil to signal the fake entry returned when a key is not found in a table)
* first version of empty entries in tablesRoberto Ierusalimschy2018-02-231-1/+6
| | | | (so that, in the future, tables can contain regular nil entries)
* in hash nodes, keys are stored in separate pieces to avoid wastingRoberto Ierusalimschy2017-06-091-14/+4
| | | | space with alignments
* 'luaH_getn' must return 'lua_Unsigned' (or 'lua_Integer'), toRoberto Ierusalimschy2017-05-191-2/+2
| | | | | allow the boundary-search algorithm to use 'maxinteger' when it cannot find a good upper bound.
* detail (removing spaces at end of lines)Roberto Ierusalimschy2016-12-221-2/+2
|
* using 'lastfree == NULL' to signal that table is using the dummyRoberto Ierusalimschy2016-11-071-2/+10
| | | | node for its hash part + new macro 'allocsizenode'
* bug: despite its name, 'luaH_getstr' did not work for strings inRoberto Ierusalimschy2015-11-031-1/+6
| | | | general, but only for short strings
* size for array part of a table ('sizearray') changed from 'int' toRoberto Ierusalimschy2014-09-041-4/+5
| | | | 'unsigned int', which allows twice as many elements in the array part
* simpler definition for 'setobj' (trust the compiler for the assignment)Roberto Ierusalimschy2014-07-291-2/+7
|
* bug (GC can collect long identifier during parser) + change (usingRoberto Ierusalimschy2013-08-301-1/+6
| | | | a single constant table for all functions in a chunk)
* "integer" keys in tables are now lua_Integer, not 'int'.Roberto Ierusalimschy2013-04-261-3/+4
|
* bug: __newindex metamethod may not work if metatable is its ownRoberto Ierusalimschy2011-08-171-1/+4
| | | | | metatable + luaV_settable does not create entry when there is a metamethod (and therefore entry is useless)
* no more 'luaH_setstr (used only once) + 'luaH_setint' receives valueRoberto Ierusalimschy2011-08-091-3/+2
| | | | to be set.
* macro 'key2tal' replaced by 'gkey' (as both were equal)Roberto Ierusalimschy2010-06-251-3/+1
|
* macro 'gkey' returns a "real" TValue*Roberto Ierusalimschy2009-11-061-2/+2
|
* luaH_[gs]etnum renamed to luaH_[gs]etint (as they only accept integers,Roberto Ierusalimschy2009-08-071-3/+3
| | | | not generic numbers)
* emergency garbage collector (core forces a GC when allocation fails)Roberto Ierusalimschy2006-07-111-2/+3
|
* avoid unnecessary exportsRoberto Ierusalimschy2006-01-101-6/+5
|