Roberto Ierusalimschy
55ac40f859
Cleaning of llimits.h
...
Several definitions that don't need to be "global" (that is, that
concerns only specific parts of the code) moved out of llimits.h,
to more appropriate places.
2024-06-20 13:43:33 -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
108e0bdc84
Merge branch 'master' into nextversion
2024-01-25 13:52:52 -03:00
Roberto Ierusalimschy
5853c37a83
Bug: Buffer overflow in string concatenation
...
Even if the string fits in size_t, the whole size of the TString object
can overflow when we add the header.
2023-12-21 13:37:51 -03:00
Roberto Ierusalimschy
024f9064f1
External strings
...
Strings can use external buffers to store their contents.
2023-11-09 17:05:42 -03:00
Roberto Ierusalimschy
7f4906f565
Towards external strings
...
Long strings have a pointer to string contents.
2023-11-08 13:24:38 -03:00
Roberto Ierusalimschy
14e416355f
Added suport for Fixed Buffers
...
A fixed buffer keeps a binary chunk "forever", so that the program
does not need to copy some of its parts when loading it.
2023-09-05 15:30:45 -03:00
Roberto Ierusalimschy
07a9eab23a
Cannot use 'getshrstr' before setting 'shrlen'
2023-08-25 15:55:14 -03:00
Roberto Ierusalimschy
9b4f39ab14
More disciplined use of 'getstr' and 'tsslen'
...
We may want to add other string variants in the future; this change
documents better where the code may need to handle those variants.
2023-08-17 15:59:28 -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
9a89fb1c9d
Hash always use all characters in a long string
...
Hashes for long strings are computed only when they are used as keys
in a table, not a too common case. And, in that case, it is to easy to
force collisions changing only the characters which are not part of the
hash.
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
7288528a1e
Short strings always use all bytes in the hash
...
Collisions in short strings occurr just by their existence, when
internalizing them. (Collisions in long strings is caused/controlled
by the program, when adding them as keys to the same table.)
2020-04-01 10:52:41 -03:00
Roberto Ierusalimschy
46c3587a6f
Clearer distinction between types and tags
...
LUA_T* represents only types; tags (types + Variants) are represented
by LUA_V* constants.
2020-01-31 11:09:53 -03:00
Roberto Ierusalimschy
2c68e66570
Details
...
Several small changes from feedback on 5.4 alhpa rc1 (warnings,
typos in the manual, and the like)
2019-06-03 11:36:42 -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
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
ca6fe7449a
userdata can have multiple user values
2018-02-20 13:52:50 -03:00
Roberto Ierusalimschy
c7a8cba745
no more 'nfield' string
2018-02-15 16:06:24 -02:00
Roberto Ierusalimschy
e2b15aa21d
janitor work on casts
2018-01-28 13:13:26 -02:00
Roberto Ierusalimschy
2f6f6abeba
'rehash' -> 'tablerehash'
...
(to avoid name colisions when compiling Lua as a single file)
2017-12-18 11:00:57 -02:00
Roberto Ierusalimschy
b077b20206
back to reallocation when resizing the string table.
...
(Not a good idea to explicitly allocate new memory when shrinking
something.)
2017-12-12 09:52:35 -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
9d28b40152
rehashes string table always allocating a new array instead of
...
reallocating old one. (Avoids problems if reallocation to a small
size fails.)
2017-12-01 14:40:29 -02:00
Roberto Ierusalimschy
6d998055c8
no more reference 'memerrmsg' + new reference to "n"
...
(both can be retrieved by 'luaS_newliteral' without creating anything,
because they are fixed, but "n" deserves fast access while 'memerrmsg'
does not)
2017-07-27 10:50:16 -03:00
Roberto Ierusalimschy
f230898ad6
tiny code refactoring in 'luaS_hash'
2015-11-23 09:32:51 -02:00
Roberto Ierusalimschy
d356183402
new function 'luaS_hashlongstr'
2015-11-03 13:36:01 -02:00
Roberto Ierusalimschy
df45f7118b
detail (added assertion)
2015-10-08 12:53:31 -03:00
Roberto Ierusalimschy
9fae7b6d3f
code for string cache generalized for "associative sets" (compiler
...
will optimize away or inline the extra loops)
2015-09-22 11:18:24 -03:00
Roberto Ierusalimschy
ee5edb6b68
macros 'getaddrstr' and 'getstr' unified (they do the same thing)
2015-09-17 12:51:05 -03:00
Roberto Ierusalimschy
41964648ee
long strings are created directly in final position when possible
...
(instead of using an auxiliar buffer to first create the string
and then allocate the final string and copy result there)
2015-09-08 12:41:05 -03:00
Roberto Ierusalimschy
a5cbb7c3a7
detail (i + 1 > exp is simply i >= exp)
2015-06-18 11:20:32 -03:00
Roberto Ierusalimschy
6645bb2df4
'strcache' elements as arrays of 1 element hints that cache can
...
be n-way (instead of direct mapped)
2015-06-01 13:34:37 -03:00
Roberto Ierusalimschy
b436ed58a3
'clearapihash' -> 'luaS_clearcache' and moved to 'lstring.c' (which
...
keeps all code related to this cache)
2015-03-25 10:42:19 -03:00
Roberto Ierusalimschy
a80cada914
new cache for interning strings
2015-03-04 10:31:21 -03:00
Roberto Ierusalimschy
7e2015a46d
size of short strings stored in a single byte, to reduce the size
...
of struct 'TString'
2015-01-16 14:54:37 -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
17ee57f8e0
'iswhite' and related macros now can work directly on any object
...
(no need to convert to 'GCObject')
2014-07-21 13:02:10 -03:00
Roberto Ierusalimschy
bb12903120
type 'Udata' refers directly to structure inside the union (union
...
used only for aligning purposes now)
2014-07-18 11:46:47 -03:00
Roberto Ierusalimschy
ca41b43f53
type 'TString' refers directly to the structure inside the union
...
(union used only for size purposes)
2014-07-18 10:36:14 -03:00
Roberto Ierusalimschy
56137d58ff
added check for conversion 'obj2gco' (and corrections for small
...
problems detected by this check)
2014-07-18 09:17:54 -03:00
Roberto Ierusalimschy
14929f5764
use appropriate macros to convert GCObject to specific types
2014-06-18 19:59:29 -03:00
Roberto Ierusalimschy
f61ceee708
LUAI_FUNC is being used only in header files
2014-04-02 13:44:42 -03:00
Roberto Ierusalimschy
2f5f77788f
removed function 'luaS_eqstr' (not used anywhere)
2014-03-19 15:51:42 -03:00
Roberto Ierusalimschy
c86b9da022
userdata can have any Lua value as uservalue
2014-02-19 10:52:42 -03:00
Roberto Ierusalimschy
6ca7b63bce
check for shrinking string table done only at the end of a GC cycle
2013-09-11 11:56:15 -03:00
Roberto Ierusalimschy
1150873447
'luaC_newobj' does not handle special cases; only special case
...
now is threads, which do not use 'luaC_newobj' anymore.
2013-09-11 09:26:14 -03:00
Roberto Ierusalimschy
d3bbb34c24
back to open hashing for the string table (but with a different
...
'hnext' field, to strings are still collected like all other
objects)
2013-09-05 16:31:49 -03:00
Roberto Ierusalimschy
9a871dd3db
tables and userdata all go to local list, too
2013-08-28 15:30:26 -03:00
Roberto Ierusalimschy
90972ff136
LOCALBLACK changed to LOCALMARK and used also to control whether object
...
is in 'localgc' list + luaC_newobj by default puts object in 'localgc'
list
2013-08-27 17:04:00 -03:00