Commit Graph

5225 Commits

Author SHA1 Message Date
Roberto Ierusalimschy
a901c505ab Fixed warning about casts between function pointers
gcc now warns (with -Wextra) about casts between pointers to different
function types. The type 'void(*)(void)' works as a 'void*' for function
pointers, cleaning the warning.
2020-04-29 16:37:25 -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
cac075a122 Small issue in 'exprstat'
The code should not compute an instruction address before checking that
it exists. (Virtually no machine complains of computing an invalid
address, as long as the address is not used, but for ISO C that is
undefined behavior.)
2020-04-23 14:39:34 -03:00
Roberto Ierusalimschy
9e0a8475cd Added 'simplesect' sections to the manual
'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.)
2020-04-13 13:42:40 -03:00
Roberto Ierusalimschy
7ccc6d8290 Improvements in the manual
Several small improvements, in particular a new subsection consolidating
all status codes in the API.
2020-04-10 15:44:48 -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
513559cc47 Fixed bug in 'string.format("%p")'
The string "(null)" used for non-collectable values must be printed as a
string, not as a pointer. (Bug introduced in commit e0cbaa50fa).
2020-03-16 14:13:13 -03:00
Roberto Ierusalimschy
e460752323 Fixed "conceptual" bug in 'luaK_setreturns'
This function was computing invalid instruction addresses when the
expression was not a multi-return instruction. (Virtually all machines
don't raise errors when computing an invalid address, as long as the
address is not accessed, but this computation is undefined behavior in
ISO C.)
2020-03-02 13:24:06 -03:00
Roberto Ierusalimschy
92594f0939 Corrected direct use of 'snprintf' in 'lstrlib.c' 2020-02-28 10:37:14 -03:00
Roberto Ierusalimschy
e8a52281d9 Code style in 'ldump'/'lundump'.
- function names start with lower case;
- state is always the first parameter.
2020-02-27 15:17:44 -03:00
Roberto Ierusalimschy
6eb53b7526 Details
Several details in code (e.g., moving a variable to the most inner
scope that encloses its uses), comments, parameter names, extra tests.
2020-02-27 12:59:22 -03:00
Roberto Ierusalimschy
9b7987a9d1 OP_LOADFALSE broken in two instructions 2020-02-11 11:12:33 -03:00
Roberto Ierusalimschy
28ef7061bb Tag values don't need to be different from type values
Variants can use zero for first variant.
2020-01-31 13:13:28 -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
69c7139ff8 New macro 'makevariant' to codify variant tags 2020-01-06 14:50:36 -03:00
Roberto Ierusalimschy
5ff408d218 Changed internal representation of booleans
Instead of an explicit value (field 'b'), true and false use different
tag variants. This avoids reading an extra field and results in more
direct code. (Most code that uses booleans needs to distinguish between
true and false anyway.)
2020-01-06 11:38:31 -03:00
Roberto Ierusalimschy
e3c83835e7 Fixed bug in 'aux_rawset'
In 'aux_rawset', top must be decremented after the barrier, which
refers to top-1. (Bug introduced in commit c646e57fd.)
2019-12-30 14:53:38 -03:00
Roberto Ierusalimschy
bd1b87c579 Comments (mosty typos) 2019-12-30 11:45:08 -03:00
Roberto Ierusalimschy
d7bb8df841 Copyright year changed to 2020 2019-12-27 10:38:53 -03:00
Roberto Ierusalimschy
c646e57fd6 Joined common code in 'lua_rawset' and 'lua_rawsetp' 2019-12-17 15:45:13 -03:00
Roberto Ierusalimschy
e0ab13c62f Easy way to allow Unicode characters in identifiers
For those that want to try it...
2019-12-17 14:24:30 -03:00
Roberto Ierusalimschy
e0cbaa50fa Added test for NULL in string.format("%p")
ISO C states that standard library functions should not be called
with NULL arguments, unless stated otherwise. 'sprintf' does not
state otherwise, and it doesn't hurt to be on the safe side.
2019-12-17 10:49:55 -03:00
Roberto Ierusalimschy
3747487320 Small correction in assertion 2019-12-13 14:02:42 -03:00
Roberto Ierusalimschy
1e0ad018ce Comment about LUA_COMPAT_LT_LE moved to proper place 2019-12-10 13:50:20 -03:00
Roberto Ierusalimschy
95735bda46 Simplifications in 'op_arith*' family of macros 2019-12-05 14:51:58 -03:00
Roberto Ierusalimschy
d30569c064 Using an enumeration for float->integer coercion modes 2019-12-05 14:14:29 -03:00
Roberto Ierusalimschy
2d92102dee 'l_mathlim' renamed to 'l_floatatt'
That macro is applied to float attributes, not to limits.
2019-12-05 13:31:07 -03:00
Roberto Ierusalimschy
490ecfcaa1 Better comments about the use of 'k' in opcodes 2019-12-05 12:59:42 -03:00
Roberto Ierusalimschy
e174f43807 Manual a little more clear about string->number coersions 2019-12-05 12:57:40 -03:00
Roberto Ierusalimschy
81f2401c6d Code reorganization for opcodes OP_FORPREP and OP_FORLOOP
Parts of the code for opcodes OP_FORPREP and OP_FORLOOP were moved
to functions outside the interpreter loop.
2019-12-04 16:51:53 -03:00
Roberto Ierusalimschy
508a705c1c Removed some wrong comments
Both 'tonumber' and 'tointeger' cannot change the out parameter when
the conversion fails.
2019-11-28 18:10:26 -03:00
Roberto Ierusalimschy
6f1c033d72 More generic pattern when testing 'string.format'
The result of 'string.format("%a", 0.0)' can have multiple zeros
after the dot.
2019-11-22 11:07:47 -03:00
Roberto Ierusalimschy
5f83fb6582 Details 2019-11-18 14:54:06 -03:00
Roberto Ierusalimschy
679dc72c08 Using 'metavalues' for "metamethods" that are not methods
Several "metamethods" are not required to be methods (functions),
so it seems clearer not to call them metamethods. The manual now
uses the word 'metavalue' for those values.
2019-11-08 15:45:55 -03:00
Roberto Ierusalimschy
1499680f9e Comments in 'lopcodes.h'
Both 'R' and 'K' are arrays, so the comments should use square
brackets to index them.
2019-11-07 10:57:57 -03:00
Roberto Ierusalimschy
bdcfae2e1c File 'bugs' no longer tracked by git
The file 'bugs' reports bugs in several different versions
(corresponding to different branches in the repository), without
a clear division of "this bugs belongs to this version". So, it
doesn't make sense to track it along with one (or many) versions.
2019-10-30 16:46:11 -03:00
Roberto Ierusalimschy
7d526e75a7 Fixed bug in tail calls of __call chains
A tail call of a __call chain (a __call metamethod that itself is
also not a function) was being perfomed as a regular call.
2019-10-28 15:58:07 -03:00
Roberto Ierusalimschy
c12983cf8a Fixed warnings from Keil compiler 2019-10-25 17:41:40 -03:00
Roberto Ierusalimschy
ba9cd0d25a Change in the prefix of messages from searchers
The initial "\n\t" to properly indent a searcher message is being added
by 'findloader' when building the error message, instead of being
included in the original message by each searcher itself.
2019-10-24 10:49:44 -03:00
Roberto Ierusalimschy
b93f3b00bb Added function 'luaL_buffsub' 2019-10-23 11:10:19 -03:00
Roberto Ierusalimschy
4c32d9300c Several enhancements in the manual 2019-10-23 10:41:47 -03:00
Roberto Ierusalimschy
6e285e5392 More pious implementation of 'string.dump'
In 'str__dump', the call to 'lua_dump' assumes the function is on the
top of the stack, but the manual allows 'luaL_buffinit' to push stuff
on the stack (although the current implementation does not).  So, the
call to 'luaL_buffinit' must come after the call to 'lua_dump'.
2019-10-23 10:31:02 -03:00
Roberto Ierusalimschy
b8cdea0190 Changed definition of macro 'l_isfalse'
The old definition did one test for nil, but three tests for the all
too common booleans (and two tests for other values); this definition
does two tests for all values.
2019-10-22 14:10:54 -03:00
Roberto Ierusalimschy
e592f94a64 Details (mostly comments) 2019-10-22 14:08:22 -03:00
Roberto Ierusalimschy
6e1aec7a67 Larger C-stack limits for new threads
New threads were being created with very small C-stack limits.
This is not a problem for coroutines, because 'lua_resume' sets
a new limit, but not all threads are coroutines.
2019-10-17 13:09:17 -03:00
Roberto Ierusalimschy
6055a039b5 Easy redefinition of valid flags for 'string.format' 2019-10-17 13:02:07 -03:00
Roberto Ierusalimschy
6c0e44464b Improvements in the manual around metamethods 2019-10-08 10:34:43 -03:00
Roberto Ierusalimschy
6a84c32900 No coercion string->number in arithmetic with LUA_NOCVTS2N 2019-10-08 10:29:38 -03:00
Roberto Ierusalimschy
6a10f03ff8 Makefile compiles the Lua compiler with '-Os'
The performance of the Lua compiler is not critical for Lua
performance, but it is a big component in the source. So, it makes
sense to trade speed for size in this component.
2019-10-08 10:26:02 -03:00
Roberto Ierusalimschy
7bd1e53753 Fixed a warning and other minor issues
Fixed some minor issues from the feedback for 5.4-beta rc1.
2019-10-04 16:17:04 -03:00