Roberto Ierusalimschy
d51022bf9e
Bug: overlapping assignments
...
ISO C forbids assignment of a union field to another field of the same
union.
2024-06-12 15:56:13 -03:00
Roberto Ierusalimschy
bb7bb5944c
More disciplined use of 'errno'
...
Set errno to zero before calling any function where we may use its
errno, and check errno for zero before using it (as functions may not
set it even in error). The code assumes that no function will put
garbage on errno (although ISO C allows that): If any function during an
operation set errno, and the operation result in an error, assume that
errno has something to say.
2024-06-12 15:50:31 -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
bdc85357aa
Bug: Active-lines for stripped vararg functions
...
Lua seg. faults when asked to create the 'activelines' table for a
vararg function with no debug information.
2024-06-04 17:27:13 -03:00
Roberto Ierusalimschy
b291008cc2
Manual for 'string.format' lists what it accepts
...
Instead of listing what it does not accept, which is always relative.
2024-06-04 16:51:31 -03:00
Roberto Ierusalimschy
814213b65f
utf8.offset returns also final position of character
...
'utf8.offset' returns two values: the initial and the final position
of the given character.
2024-05-27 11:29:39 -03:00
Roberto Ierusalimschy
cbdf4969ec
Manual: errors in lua_toclose are not memory errors
2024-05-23 09:55:26 -03:00
Roberto Ierusalimschy
262dc5729a
Details
...
Corrections in comments and manual. Added note in the manual about
local variables in the REPL.
2024-05-08 17:50:10 -03:00
Roberto Ierusalimschy
9d985db7bb
New year (2024)
2024-05-02 12:03:30 -03:00
Roberto Ierusalimschy
0897c0a428
'getmode' renamed to 'getMode'
...
The name 'getmode' conficts with a function from BSD, defined
in <unistd.h>. Although 'lbaselib.c' cannot include that header,
'onelua.c' can.
2024-04-08 14:28:26 -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
3507c3380f
Small simplification in 'findloader'
...
Instead of allways adding a prefix for the next message, and then
removing it if there is no message, add the prefix after each message.
2024-04-03 16:01:23 -03:00
Roberto Ierusalimschy
88a50ffa71
Fixed dangling 'StkId' in 'luaV_finishget'
...
Bug introduced in 05932567
.
2024-03-29 15:10:50 -03:00
Roberto Ierusalimschy
86a8e74824
Details
2024-03-28 17:11: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
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
52aa2b5d24
Details
...
- 'unsigned int' -> 'unsigned'
- Some explicit casts to avoid warnings
- Test avoids printing the value of 'fail' (which may not be nil)
2024-03-13 09:20:34 -03:00
Roberto Ierusalimschy
cc2b66c856
Removed type 'varint_t'
...
size_t should be big enough to count the number of strings in a dump.
(And, by definition, it is big enough to count the length of each
string.)
2024-03-13 09:16:51 -03:00
Roberto Ierusalimschy
65b07dd53d
API asserts for illegal pops of to-be-closed variables
2024-03-11 14:05:06 -03:00
Roberto Ierusalimschy
7237eb3f1c
Fixed warnings from different compilers
2024-02-15 11:18:34 -03:00
Roberto Ierusalimschy
165389b27b
New interface to function 'luaL_openselectedlibs'
...
Instead of preloading all non-loaded libraries, there is another
mask to select which libraries to preload.
2024-02-15 11:17:39 -03:00
Roberto Ierusalimschy
c8121ce34b
Revising code for Varint encoding in dumps
...
- Usign lua_Unsigned to count strings.
- Varint uses a type large enough both for size_t and lua_Unsigned.
- Most-Significant Bit 0 means last byte, to conform to common usage.
- (unrelated) Change in macro 'getaddr' so that multiplication is
by constants.
2024-02-12 15:16:11 -03:00
Roberto Ierusalimschy
7360f8d0fd
Removed deprecated function 'setcstacklimit'
2024-02-07 14:20:43 -03:00
Roberto Ierusalimschy
6063c47031
Field 'lastfree' changed (back) to 'Node *'
...
Due to allignment, it is already using the space of a pointer, and
a pointer generates slightly simpler code.
2024-02-07 13:56:39 -03:00
Roberto Ierusalimschy
0c9bec0d38
Better handling of size limit when resizing a table
...
Avoid silent conversions from int to unsigned int when calling
'luaH_resize'; avoid silent conversions from lua_Integer to int in
'table.create'; MAXASIZE corrected for the new implementation of arrays;
'luaH_resize' checks explicitly whether new size respects MAXASIZE.
(Even constructors were bypassing that check.)
2024-02-07 13:39:54 -03:00
Roberto Ierusalimschy
c31d6774ac
Details
2024-01-29 14:29:24 -03:00
Roberto Ierusalimschy
108e0bdc84
Merge branch 'master' into nextversion
2024-01-25 13:52:52 -03:00
Roberto Ierusalimschy
b34a97a4af
Small optimization in 'luaH_psetint'
...
It is quite common to write to empty but existing cells in the array
part of a table, so 'luaH_psetint' checks for the common case that
the table doesn't have a newindex metamethod to complete the write.
2024-01-25 13:44:49 -03:00
Roberto Ierusalimschy
3e9dbe143d
New function 'table.create'
...
Creates a table preallocating memory. (It just exports to Lua the API
function 'lua_createtable'.)
2024-01-18 15:16:26 -03:00
Roberto Ierusalimschy
4a8e480864
New mechanism to query GC parameters
2024-01-16 17:02:55 -03:00
Roberto Ierusalimschy
17e0c29d9b
Clear interface between references and predefines
...
The reference system has a defined way to add initial values to the
table where it operates.
2024-01-15 11:31:49 -03:00
Roberto Ierusalimschy
8eb0abc9db
Removed uses of LUA_NUMTAGS
...
That constant was already deprecated (see commit 6aabf4b15e
).
2024-01-13 18:10:50 -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
e288c5a918
Bug: Yielding in a hook stops in the wrong instruction
...
Yielding in a hook must decrease the program counter, because it already
counted an instruction that, in the end, was not executed. However,
that decrement should be done only when about to restart the thread.
Otherwise, inspecting the thread with the debug library shows it one
instruction behind of where it really is.
2024-01-11 13:44:16 -03:00
Roberto Ierusalimschy
7827c40c49
A few more tweaks in the garbage collector
2024-01-10 14:45:58 -03:00
Roberto Ierusalimschy
e7af9cdf0b
Fixed buffers reuse absolute line information
2023-12-27 17:42:00 -03:00
Roberto Ierusalimschy
12b6f610b0
Several tweaks in the garbage collector
...
- back with step size in collectgarbage("step")
- adjustments in defaults for some GC parameters
- adjustments in 'luaO_codeparam'
2023-12-27 12:09:11 -03:00
Roberto Ierusalimschy
e81f586001
Removed compatibility option LUA_COMPAT_GCPARAMS
...
The meaning of different GC parameters changed, so there is point in
supporting old values for them. The new code simply ignores the
parameters when changing the GC mode, so the incompatibility is small.
2023-12-22 14:57:43 -03:00
Roberto Ierusalimschy
e2cc179454
New option "setparms" for 'collectgarbage'
...
The generational mode also uses the parameters for the incremental
mode in its major collections, so it should be easy to change those
parameters without having to change the GC mode.
2023-12-22 14:48:07 -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
ad0ea7813b
GC parameters encoded as floating-point bytes
...
This encoding brings more precision and a larger range for these
parameters.
2023-12-20 16:25:20 -03:00
Roberto Ierusalimschy
666e95a66d
Option 0 for step multiplier makes GC non-incremental
2023-12-20 11:06:27 -03:00
Roberto Ierusalimschy
4eda1acafa
Cleaner protocol between 'lua_dump' and writer function
...
'lua_dump' signals to the writer function the end of a dump, so that
is has more freedom when using the stack.
2023-12-14 11:41:57 -03:00
Roberto Ierusalimschy
ad73b33224
Check minor->major made at the end of a minor cycle
...
It does not make sense to wait for another cycle to decide when much of
the information about creation of old objects is already available.
2023-12-07 15:45:41 -03:00
Roberto Ierusalimschy
925fe8a0f2
First criteria for shifts minor<->major
2023-12-07 15:45:11 -03:00
Roberto Ierusalimschy
789e7acdea
Major collections done incrementally
...
Major collections do not need to "stop the world". Still pending:
criteria for shifts minor-major, shifts generational-incremental.
2023-12-06 10:49:56 -03:00
Roberto Ierusalimschy
74b4013538
Removed macro 'changeage'
...
It is simpler to use always 'setage'. The saving from 'changeage'
is too irrelevant.
2023-12-01 16:42:01 -03:00