Commit Graph

99 Commits

Author SHA1 Message Date
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
94b503d95e Encoding of table indices (hres) must use C indices
As the encoding of array indices is (~index), 0 is encoded as -1 and
INT_MAX is encoded as INT_MIN.
2024-06-10 12:09:35 -03:00
Roberto Ierusalimschy
5edacafcfa Yet another representation for arrays
This "linear" representation (see ltable.h for details) has worse
locality than cells, but the simpler access code seems to compensate
that.
2024-04-05 15:35:11 -03:00
Roberto Ierusalimschy
9fa63a6268 Some 'unsigned int' changed to 'unsigned'
'unsigned int' is too long sometimes. (We already write 'long' instead
of 'long int'...)
2024-03-22 14:06:11 -03:00
Roberto Ierusalimschy
0593256707 'luaH_get' functions return tag of the result
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.
2024-03-21 11:23:21 -03:00
Roberto Ierusalimschy
ce6f5502c9 'luaH_get' functions return 'TValue'
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.)
2024-03-18 15:56:32 -03:00
Roberto Ierusalimschy
ba71060381 Removed "bulk operations"
Negligible performance gains don't justify extra complexity.
2024-03-15 11:23:35 -03:00
Roberto Ierusalimschy
3823fc6c81 Added "bulk operations" to arrays
A few operations on arrays can be performed "in bulk", treating all
tags of a cell as a simple (or a few) word(s).
2024-03-15 11:01:34 -03:00
Roberto Ierusalimschy
d862da6d04 Optimizations for 'lua_rawgeti' and 'lua_rawseti'
'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'.
2024-01-12 15:50:51 -03:00
Roberto Ierusalimschy
52b899d60d Simpler coding for new representation for arrays
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.
2023-11-24 14:41:07 -03:00
Roberto Ierusalimschy
b8a9d14032 Details
Comments and parameter name in header file.
2023-11-08 10:41:24 -03:00
Roberto Ierusalimschy
37c215b43f Merge branch 'newarray' into nextversion 2023-11-07 17:26:15 -03:00
Roberto Ierusalimschy
fa075b7953 Merge branch 'master' into newarray 2023-11-03 15:39:14 -03:00
Roberto Ierusalimschy
08a077d673 Full implementation of new representation for arrays 2023-11-03 15:26:13 -03:00
Roberto Ierusalimschy
43c8e5bded Full abstraction for representation of array values 2023-10-30 14:25:59 -03:00
Roberto Ierusalimschy
ab6a949522 Merge branch 'master' into nextversion 2023-06-22 11:41:48 -03:00
Roberto Ierusalimschy
819bd51d87 Some cleaning in the new table API 2023-05-16 16:53:29 -03:00
Roberto Ierusalimschy
f8d30826dd New table API for 'set' functions 2023-05-16 14:55:49 -03:00
Roberto Ierusalimschy
351ccd7332 Towards a new implementation of arrays
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.)
2023-05-15 17:56:25 -03:00
Roberto Ierusalimschy
934e77a286 Details
- Better comments about short strings in opcodes.
- luaH_newkey made static.
2023-05-15 10:07:25 -03:00
Roberto Ierusalimschy
8047b2d03e Tables have a 'lastfree' information only when needed
Only tables with some minimum number of entries in their hash part
have a 'lastfree' field, kept in a header before the node vector.
2022-11-01 15:42:08 -03:00
Roberto Ierusalimschy
b85816b9a8 Removed test function 'luaH_isdummy'
It was not being used anywhere.
2022-10-21 09:18:13 -03:00
Roberto Ierusalimschy
23051e830a Changes in the API of 'luaH_set' and related functions
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.
2020-12-04 11:08:42 -03:00
Roberto Ierusalimschy
7c3cb71fa4 Free bit 7 of GC 'marked' field
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.
2020-08-07 11:21:44 -03:00
Roberto Ierusalimschy
0ddc0f47bd Several details about 5.4.0 rc1
Corrected several small details: added 'const', adjusts in tabs x
spaces, removed unused #includes and #defines, misspellings, etc.
2020-04-23 14:48:15 -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
6e600695f8 field 'sizearray' in struct 'Table' changed to 'alimit', which can
be used as a hint for '#t'
2018-06-15 11:14:20 -03:00
Roberto Ierusalimschy
fb8fa66136 no more 'luaH_emptyobject' and comparisons of addresses of global variables
(instead, use a different kind of nil to signal the fake entry returned
when a key is not found in a table)
2018-06-01 13:51:34 -03:00
Roberto Ierusalimschy
9243c414d9 first version of empty entries in tables
(so that, in the future, tables can contain regular nil entries)
2018-02-23 10:16:18 -03:00
Roberto Ierusalimschy
b6f87491af in hash nodes, keys are stored in separate pieces to avoid wasting
space with alignments
2017-06-09 13:48:44 -03:00
Roberto Ierusalimschy
e39ee2cc58 'luaH_getn' must return 'lua_Unsigned' (or 'lua_Integer'), to
allow the boundary-search algorithm to use 'maxinteger' when
it cannot find a good upper bound.
2017-05-19 09:48:15 -03:00
Roberto Ierusalimschy
2a235312f0 detail (removing spaces at end of lines) 2016-12-22 11:08:50 -02:00
Roberto Ierusalimschy
7b1fba69b7 using 'lastfree == NULL' to signal that table is using the dummy
node for its hash part + new macro 'allocsizenode'
2016-11-07 10:38:35 -02:00
Roberto Ierusalimschy
46de77b219 bug: despite its name, 'luaH_getstr' did not work for strings in
general, but only for short strings
2015-11-03 13:47:30 -02:00
Roberto Ierusalimschy
3a15c7ce43 size for array part of a table ('sizearray') changed from 'int' to
'unsigned int', which allows twice as many elements in the array part
2014-09-04 15:15:29 -03:00
Roberto Ierusalimschy
07c7fdb9df simpler definition for 'setobj' (trust the compiler for the assignment) 2014-07-29 13:22:24 -03:00
Roberto Ierusalimschy
8ef9e8460e bug (GC can collect long identifier during parser) + change (using
a single constant table for all functions in a chunk)
2013-08-30 13:01:37 -03:00
Roberto Ierusalimschy
d4e6b75098 "integer" keys in tables are now lua_Integer, not 'int'. 2013-04-26 12:39:25 -03:00
Roberto Ierusalimschy
89b59eee73 bug: __newindex metamethod may not work if metatable is its own
metatable + luaV_settable does not create entry when there is a
metamethod (and therefore entry is useless)
2011-08-17 17:26:47 -03:00
Roberto Ierusalimschy
92afcf2823 no more 'luaH_setstr (used only once) + 'luaH_setint' receives value
to be set.
2011-08-09 17:58:29 -03:00
Roberto Ierusalimschy
d9ea6eca7c macro 'key2tal' replaced by 'gkey' (as both were equal) 2010-06-25 09:18:10 -03:00
Roberto Ierusalimschy
fbf866a1a5 macro 'gkey' returns a "real" TValue* 2009-11-06 15:07:48 -02:00
Roberto Ierusalimschy
3135a6bbab luaH_[gs]etnum renamed to luaH_[gs]etint (as they only accept integers,
not generic numbers)
2009-08-07 13:17:41 -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
f8b7a5581e avoid unnecessary exports 2006-01-10 11:13:06 -02:00
Roberto Ierusalimschy
ffb798e1e2 avoids type punning for table keys 2006-01-10 10:51:53 -02:00
Roberto Ierusalimschy
d987cf1f81 new mark LUAI_DATA for extern data 2005-06-06 10:30:25 -03:00
Roberto Ierusalimschy
8718fda9b2 added LUAI_FUNC to functions not in the API 2005-04-25 16:24:10 -03:00
Roberto Ierusalimschy
9ffae705ee new "primitive" getn 2005-03-16 13:58:41 -03:00
Roberto Ierusalimschy
e2498e079e change in hash algorithm so that it does not need empty slot
(tables can be 100% full)
2005-01-05 16:20:51 -02:00