Roberto Ierusalimschy
cfce6f4b20
Warning in loslib.c (signed-unsigned comparison)
2025-06-27 14:47:11 -03:00
Roberto Ierusalimschy
1da89da62f
Manual updated to version 5.5
2025-06-27 14:46:41 -03:00
Roberto Ierusalimschy
f6c627af20
Cast added to 'add_history'
...
MacOS defines 'add_history' with a "wrong" type (it returns 'int'
instead of 'void').
2025-06-26 11:45:42 -03:00
Roberto Ierusalimschy
270a58c062
Application name for 'readline' is "lua", not "Lua"
2025-06-23 14:36:32 -03:00
Roberto Ierusalimschy
30531c291b
Refactoring in the use of 'readline' by 'lua.c'
...
More common code for 'readline' loaded statically or dynamically (or
not loaded).
2025-06-23 14:00:21 -03:00
Roberto Ierusalimschy
07b009c371
No need to limit variable declarations to 250
...
Only local variables, which use registers, need this low limit.
2025-06-18 16:45:55 -03:00
Roberto Ierusalimschy
f711567448
Check string indices when loading binary chunk
...
Lua is not religious about that, but it tries to avoid crashes when
loading binary chunks.
2025-06-17 11:40:49 -03:00
Roberto Ierusalimschy
9386e49a31
New metatable in an all-weak table can fool the GC
...
All-weak tables are not being revisited after being visited during
propagation; if it gets a new metatable after that, the new metatable
may not be marked.
2025-06-16 16:29:32 -03:00
Roberto Ierusalimschy
8cd7ae7da0
Simpler code for 'traversetable'
...
Check the mode in a separate function (getmode), instead of using
comma expressions inside the 'if' condition.
2025-06-16 15:50:12 -03:00
Roberto Ierusalimschy
0cecf1ab6d
Dump uses varints also for integer constants
...
Unlike sizes, these constants can be negative, so it encodes those
integers into unsigned integers in a way that keeps small numbers
small.
2025-06-13 14:14:50 -03:00
Roberto Ierusalimschy
e657a48ea5
The main thread cannot be closed
...
No thread started with pcall (instead of resume) can be closed,
because coroutine.close would not respect the expected number of
results from the protected call.
2025-06-13 14:08:38 -03:00
Roberto Ierusalimschy
fd897027f1
A coroutine can close itself
...
A call to close itself will close all its to-be-closed variables and
return to the resume that (re)started the coroutine.
2025-06-12 11:15:09 -03:00
Roberto Ierusalimschy
d05fe48bfd
Loading a binary chunk should not break assertions
...
Although the execution of a bad binary chunk can crash the interpreter,
simply loading it should be safe.
2025-06-04 12:55:43 -03:00
Roberto Ierusalimschy
519c57d597
Removed uneeded check in parser
...
In a constructor, each field generates at least one opcode, and the
number of opcodes is limited by INT_MAX. Therefore, the counters for
number of fields cannot exceed this limit. (The current limit for
items in the hash part of a table has a limit smaller than INT_MAX.
However, as long as there are no overflows, the logic for table
resizing will handle that limit.)
2025-06-04 09:54:31 -03:00
Roberto Ierusalimschy
c15543b9af
Bug: check for constructor overflow in [exp] fields
...
The check for constructor overflow was considering only fields with
explicit names, ignoring fields with syntax '[exp]=exp'.
2025-05-20 17:50:56 -03:00
Roberto Ierusalimschy
be05c44481
New way to control preambular declaration
...
Validity of the preambular global declaration in controled together
with all declarations, when checking variable names.
2025-05-20 17:36:05 -03:00
Roberto Ierusalimschy
6d53701c7a
Proper error message when jumping into 'global *'
...
A goto cannot jump into the scope of any variable declaration,
including 'global *'. To report the error, it needs a "name" for
the scope it is entering.
2025-05-18 12:03:54 -03:00
Roberto Ierusalimschy
abbae57c78
Variable attributes can prefix name list
...
In this format, the attribute applies to all names in the list;
e.g. "global<const> print, require, math".
2025-05-18 11:43:43 -03:00
Roberto Ierusalimschy
f2c1531e6c
Detail
...
Reports errors with "?:?:" (instead of "?👎 ") when there is no debug
information.
2025-05-16 15:20:32 -03:00
Roberto Ierusalimschy
ded2ad2d86
Slightly faster way to check for "global"
2025-05-16 14:51:07 -03:00
Roberto Ierusalimschy
3fb7a77731
Internalized string "break" kept by the parser
...
The parser uses "break" as fake label to compile "break" as "goto
break". To avoid producing this string at each use, it keeps it
available in its state.
2025-05-15 12:43:37 -03:00
Roberto Ierusalimschy
fded0b4a84
Remove compat code in parser when not needed
2025-05-13 11:50:43 -03:00
Roberto Ierusalimschy
3b9dd52be0
Collective declaration for globals ('global *')
2025-05-13 11:43:10 -03:00
Roberto Ierusalimschy
7dc6aae290
Correct line in error message for constant function
2025-05-12 11:42:45 -03:00
Roberto Ierusalimschy
5b1ab8efdc
'expdesc' doesn't depend on 'actvar' for var. info.
...
In preparation for 'global *', the structure 'expdesc' does not point
to 'actvar.arr' for information about global variables.
2025-05-11 11:51:58 -03:00
Roberto Ierusalimschy
7ade155762
Janitorial work on casts
2025-05-08 15:18:57 -03:00
Roberto Ierusalimschy
d827e96f33
Using 'l_uint32' for unicode codepoints in scanner
...
'l_uint32' is enough for unicode codepoints (versus unsigned long),
and the utf-8 library already uses that type.
2025-05-08 12:49:39 -03:00
Roberto Ierusalimschy
3f0ea90aa8
New syntax 'global function'
2025-05-08 11:08:03 -03:00
Roberto Ierusalimschy
4365a45d68
Checks for read-only globals
2025-05-06 15:54:05 -03:00
Roberto Ierusalimschy
be81209063
First implementation of global declarations
2025-05-05 16:24:59 -03:00
Roberto Ierusalimschy
e055905914
New macro 'pushvfstring'
...
Helps to ensure that 'luaO_pushvfstring' is being called correctly,
with an error check after closing the vararg list with 'va_end'.
2025-04-23 11:55:04 -03:00
Roberto Ierusalimschy
9b014d4bcd
Details (typos in comments)
2025-04-23 11:36:09 -03:00
Roberto Ierusalimschy
50fd8d03c3
Function 'luaK_semerror' made vararg
...
All calls to 'luaK_semerror' were using 'luaO_pushfstring' to create
the error messages.
2025-04-17 14:58:55 -03:00
Roberto Ierusalimschy
3dbb1a4b89
In gen. GC, some gray objects stay in gray lists
...
In generational collection, objects marked as touched1 stay in gray
lists between collections. This commit fixes a bug introduced in
commit 808976bb59 .
2025-04-15 17:00:30 -03:00
Roberto Ierusalimschy
3dd8ea54da
Order change in 'pushfuncname'
...
'pushglobalfuncname' can be quite slow (as it traverses all globals and
all loaded modules), so try first to get a name from the code.
2025-04-03 15:31:22 -03:00
Roberto Ierusalimschy
620f49a7aa
Tiny refactoring in io.flush
2025-04-03 12:56:52 -03:00
Roberto Ierusalimschy
3f4f28010a
io.write returns number of written bytes on error
2025-04-03 11:32:49 -03:00
Roberto Ierusalimschy
93e347b519
Corrections of stack addresses back to strict mode
...
It can be a little slower, but only for quite large stacks and moreover
stack reallocation is not a common operation. With no strong contrary
reason, it is better to follow the standard.
2025-04-01 10:41:25 -03:00
Roberto Ierusalimschy
f4123b2fc2
Growth factor of 1.5 for stack and lexical buffer
2025-03-31 13:44:41 -03:00
Roberto Ierusalimschy
37a1b72706
Small optimization in 'project' from math.random
...
When computing the Mersenne number, instead of spreading 1's a fixed
number of times (with shifts of 1, 2, 4, 8, 16, and 32), spread only
until the number becomes a Mersenne number.
2025-03-27 15:22:40 -03:00
Roberto Ierusalimschy
ef5d171cc8
New macro 'l_numbits'
2025-03-27 12:38:29 -03:00
Roberto Ierusalimschy
b0f3df16a4
Addition in math.random can overflow
...
To avoid complains from some tools, the addition when computing
math.random(n,m), which is computed as n + random(0, m - n), should
use unsigned integers.
2025-03-25 11:43:03 -03:00
Roberto Ierusalimschy
cad5a4fdbb
Details
...
Small changes in test library:
- execute mode added to 'all.lua';
- more information about subtypes (tags) when printing a stack.
2025-03-24 15:23:55 -03:00
Roberto Ierusalimschy
fdbb4c2341
Detail in the manual
2025-03-17 16:05:47 -03:00
Roberto Ierusalimschy
921832be8d
New function 'resetCI'
...
New function 'resetCI' resets the CallInfo list of a thread, ensuring
a proper state when creating a new thread, closing a thread, or
closing a state, so that we can run code after that. (When closing a
thread, we need to run its __close metamethods; when closing a
state, we need to run its __close metamethods and its finalizers.)
2025-03-17 14:32:08 -03:00
Roberto Ierusalimschy
205f9aa67b
New function 'printallstack' in test library
2025-03-17 14:30:43 -03:00
Roberto Ierusalimschy
94d38560c3
Wrong error message when using "_ENV" fields
...
The string "_ENV" is erroneously identified as a variable _ENV,
so that results from a field is classified as a global.
2025-03-14 15:16:09 -03:00
Roberto Ierusalimschy
c2dc6e8e94
Missing GC barrier in 'luaV_finishset'
2025-03-14 12:37:19 -03:00
Roberto Ierusalimschy
22974326ca
Use after free in 'luaV_finishset'
...
If a metatable is a weak table, its __newindex field could be collected
by an emergency collection while being used in 'luaV_finishset'. (This
bug has similarities with bug 5.3.2-1, fixed in commit a272fa66.)
2025-03-13 15:30:52 -03:00
Roberto Ierusalimschy
c931d86e98
'luaD_seterrorobj' should not raise errors
...
This function can be called unprotected, so it should not raise any
kind of errors. (It could raise a memory-allocation error when creating
a message).
2025-03-12 15:51:16 -03:00
Roberto Ierusalimschy
d9e0f64a5d
Small changes in the manual
2025-03-12 15:45:39 -03:00
Roberto Ierusalimschy
ab66652b32
Removed copyright notice from 'testes/all.lua'
...
All test files refer to the main copyright notice in 'lua.h'.
2025-03-12 14:00:58 -03:00
Roberto Ierusalimschy
4398e488e6
New test file 'memerr.lua'
...
Tests for memory-allocation errors moved from 'api.lua' to this new
file, as 'api.lua' was already too big. (Besides, these tests have
nothing to do with the API.)
2025-03-12 13:52:35 -03:00
Roberto Ierusalimschy
808976bb59
Small correction in 'traverseweakvalue'
...
After a weak table is traversed in the atomic phase, if it does not
have white values ('hasclears') it does not need to be retraversed
again. (Comments were correct, but code did not agree with them.)
2025-03-12 12:35:36 -03:00
Roberto Ierusalimschy
b5b1995f29
Checks for type 'int' added to binary header
...
The structure 'AbsLineInfo' is hard-dumped into binary chunks, and
it comprises two 'int' fields.
2025-03-10 15:21:32 -03:00
Roberto Ierusalimschy
cb88c1cd5d
Detail
...
Added macro LUA_FAILISFALSE to make easier to change the fail value
from nil to false.
2025-02-28 15:48:45 -03:00
Roberto Ierusalimschy
ee99452158
Error object cannot be nil
...
Lua will change a nil as error object to a string message, so that it
never reports an error with nil as the error object.
2025-02-28 14:53:58 -03:00
Roberto Ierusalimschy
127a8e80fe
'__close' gets no error object if there is no error
...
Instead of receiving nil as a second argument, __close metamethods are
called with just one argument when there are no errors.
2025-02-28 10:10:27 -03:00
Roberto Ierusalimschy
f9e35627ed
'lua_State.nci' must be an integer
...
Lua can easily overflow an unsigned short counting nested calls.
(The limit to this value is the maximum stack size, LUAI_MAXSTACK,
which is currently 1e6.)
2025-02-26 11:31:10 -03:00
Roberto Ierusalimschy
ceac82f78b
Details
...
Comments, small changes in the manual, an extra test for errors in
error handling, small changes in tests.
2025-02-26 11:29:54 -03:00
Roberto Ierusalimschy
e5f4927a0b
Array sizes in undump changed from unsigned to int
...
Array sizes are always int and are dumped as int, so there is no reason
to read them back as unsigned.
2025-02-20 10:09:04 -03:00
Roberto Ierusalimschy
cd38fe8cf3
Added macro LUAI_STRICT_ADDRESS
...
By default, the code assumes it is safe to use a dealocated pointer
as long as the code does not access it.
2025-02-18 17:02:32 -03:00
Roberto Ierusalimschy
fa1382b5cd
Main thread is a regular field of global_State
...
They were already allocated as a single block, so there is no need
for the global_State to point to its main thread.
2025-01-31 13:51:38 -03:00
Roberto Ierusalimschy
d1e677c52b
New type 'TStatus' for thread status/error codes
2025-01-30 11:41:39 -03:00
Roberto Ierusalimschy
f7439112a5
Details (in test library)
...
- Added support for negative stack indices in the "C interpreter"
- Improved format when printing values
2025-01-29 14:47:06 -03:00
Roberto Ierusalimschy
39a14ea7d7
CallInfo bit CIST_CLSRET broken in two
...
Since commit f407b3c4a , it was being used for two distinct (and
incompatible) meanings:
A: Function has TBC variables (now bit CIST_TBC)
B: Interpreter is closing TBC variables (original bit CIST_CLSRET)
B implies A, but A does not imply B.
2025-01-28 11:45:45 -03:00
Roberto Ierusalimschy
c4e7cdb541
Renaming two new functions
...
'lua_numbertostrbuff' -> 'lua_numbertocstring'
'lua_pushextlstring' -> 'lua_pushexternalstring'
2025-01-27 16:09:55 -03:00
Roberto Ierusalimschy
7d7ae8781e
Parameters for 'lua_createtable' back to int
...
Tables don't accept sizes larger than int.
2025-01-21 13:33:59 -03:00
Roberto Ierusalimschy
724012d3d0
Small change in macro 'isvalid'
...
The "faster way" to check whether a value is not 'nilvalue' is not
faster. (Both forms entail one memory access.)
2025-01-16 16:11:49 -03:00
Roberto Ierusalimschy
664bda02ba
fixing 'lua_status' in panic.
...
'luaD_throw' may call 'luaE_resetthread', which returns an error code
but clears 'L->status'; so, 'luaD_throw' should set that status again.
2025-01-16 16:07:39 -03:00
Roberto Ierusalimschy
2d8d5c74b5
Details
...
New year (2024->2025), typos in comments
2025-01-16 11:51:16 -03:00
Roberto Ierusalimschy
3cdd49c94a
Fixed conversion warnings from clang
...
Plus some other details. (Option '-Wuninitialized' was removed from
the makefile because it is already enabled by -Wall.)
2025-01-14 16:24:46 -03:00
Roberto Ierusalimschy
10e931da82
Error "break outside loop" made a syntax error
...
Syntax errors are easier to handle than semantic errors.
2025-01-13 11:23:07 -03:00
Roberto Ierusalimschy
4b107a8776
Details in lparser.c
...
Added comments so that all braces pair correctly. (The parser has
several instances of unmatched braces as characters ('{' or '}'), which
hinders matching regular braces in the code.)
2025-01-10 15:27:17 -03:00
Roberto Ierusalimschy
429761d7d2
New optimization option for testing
...
Using gcc's option '-Og' (instead of '-O0') for testing/debugging.
2025-01-10 15:14:01 -03:00
Roberto Ierusalimschy
915c29f8bd
Improvements in the manual
...
Plus details
2025-01-10 15:11:54 -03:00
Roberto Ierusalimschy
7ca3c40b50
Another way to compile goto's
...
The compilation of a goto or a label just create an entry and generate
boilerplate code for the gotos. As we don't know yet whether it needs a
CLOSE, we code a jump followed by a CLOSE, which is then dead code.
When a block ends (and then we know for sure whether there are variables
that need to be closed), we check the goto's against the labels of that
block. When closing a goto against a label, if it needs a CLOSE, the
compiler swaps the order of the jump and the CLOSE, making the CLOSE
active.
2025-01-10 13:54:51 -03:00
Roberto Ierusalimschy
8a3a49250c
Detail
...
Small improvement in line-tracing for internal debugging.
2025-01-06 14:44:06 -03:00
Roberto Ierusalimschy
1ec251e091
Detail (debugging aid)
...
When compiling with option HARDMEMTESTS, every creation of a new key
in a table forces an emergency GC.
2025-01-06 12:41:39 -03:00
Roberto Ierusalimschy
5894ca7b95
Scanner doesn't need to anchor reserved words
2024-12-30 16:53:51 -03:00
Roberto Ierusalimschy
abf8b1cd4a
Small optimization in 'luaH_psetshortstr'
...
Do not optimize only for table updates (key already present).
Creation of new short keys in new tables can be quite common in
programs that create lots of small tables, for instance with
constructors like {x=e1,y=e2}.
2024-12-28 15:05:01 -03:00
Roberto Ierusalimschy
2a307f898b
When parser reuses constants, only floats can collide
...
Ensure that float constants never use integer keys, so that only
floats can collide in 'k2proto'.
2024-12-28 15:03:48 -03:00
Roberto Ierusalimschy
f81d0bbd4f
Detail in 'luaD_inctop'
...
Protect stack top before possible stack reallocation. (In the current
implementation, a stack reallocation cannot call an emergency
collection, so there is no bug, but it is safer not to depend on that.)
2024-12-17 13:36:12 -03:00
Roberto Ierusalimschy
1c40ff9faa
Scanner and parser use different tables for constants
...
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.
2024-12-17 11:23:22 -03:00
Roberto Ierusalimschy
7538f3886d
'addk' broken in two functions
2024-12-16 14:13:49 -03:00
Roberto Ierusalimschy
412e9a4d95
'luaH_fastseti' uses 'checknoTM'
...
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.
2024-12-11 15:32:43 -03:00
Roberto Ierusalimschy
25a491fe34
OP_SELF restricted to constant short strings
...
Optimize this opcode for the common case. For long names or method
calls after too many constants, operation can be coded as a move
followed by 'gettable'.
2024-12-11 13:56:03 -03:00
Roberto Ierusalimschy
b4b616bdf2
Rehash reinserts elements with "lighter" functions
...
When reinserting elements into a table during a rehash, the code does
not need to invoke all the complexity of a full 'luaH_set':
- The table has space for all keys.
- The key cannot exist in the new hash.
- The keys are valid (not NaN nor nil).
- The keys are normalized (1.0 -> 1).
- The values cannot be nil.
- No barrier needed (the table already pointed to the key and value).
2024-12-05 17:34:08 -03:00
Roberto Ierusalimschy
bb93f04d87
Refactoring of 'luaH_newkey'
...
Function broke in two and some checks moved to the caller. (We may
want to call it without the checks.)
2024-12-05 14:27:58 -03:00
Roberto Ierusalimschy
975d4e0592
Fix in the definition of 'sizeLclosure'
...
The array at the end of a Lua closure has pointers to upvalues, not
to tagged values. This bug cannot cause any issue: The ISO C standard
requires that all pointers to structures have the same representation,
so sizeof(TValue*) must be equal to sizeof(UpVal*).
2024-12-03 10:53:46 -03:00
Roberto Ierusalimschy
04e495403b
New function 'lua_printvalue' for internal debugging
2024-12-02 11:19:03 -03:00
Roberto Ierusalimschy
62afbc6bfc
Details
...
Added two warnings to the makefile.
2024-11-29 17:39:20 -03:00
Roberto Ierusalimschy
002beeebe7
New way to keep hints for table length
...
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.
2024-11-29 17:26:20 -03:00
Roberto Ierusalimschy
9329eeac3b
Avoid an extra call to 'concretesize' in 'resizearray'
2024-11-27 18:37:29 -03:00
Roberto Ierusalimschy
682efe2678
Change to macro 'LUAI_TRY'
...
The call to 'f' is done by the macro, to give it more flexibility.
2024-11-25 15:47:08 -03:00
Roberto Ierusalimschy
50c7c915ee
Debug information about extra arguments from __call
...
'debug.getinfo' can return number of extra arguments added to a call by
a chain of __call metavalues. That information is being used to improve
error messages about errors in these extra arguments.
2024-11-19 14:09:18 -03:00
Roberto Ierusalimschy
b117bdb344
Counter for length of chains of __call metamethods
...
This counter will allow (in a later commit) error messages to correct
argument numbers in functions called through __call metamethods.
2024-11-16 12:00:28 -03:00
Roberto Ierusalimschy
f12ce4029d
More integration of 'nresults' into 'callstatus'
2024-11-15 15:25:11 -03:00
Roberto Ierusalimschy
a4762b6ffe
'objsize' returns 'l_mem'
...
Sums of size_t may not fit in a size_t.
2024-11-15 12:04:53 -03:00
Roberto Ierusalimschy
d4247befa1
New macro 'assert_code'
...
It allows code that is only used by assertions but that are not
assertions (e.g., declaration of a variable used in a later assertion).
2024-11-15 11:57:18 -03:00
Roberto Ierusalimschy
ee6a4cd1ec
Ease slightly making Lua with C89
2024-11-15 11:43:32 -03:00
Roberto Ierusalimschy
8a4419b119
Dummy node has a non-nil key
...
That allows 'getfreepos' to treat it like a regular hash part that has
a deleted entry.
2024-11-15 10:48:52 -03:00
Roberto Ierusalimschy
9a91fe1640
Add extra size when resizing tables with deleted keys
...
Without this extra space, sequences of insertions/deletions (and
some other uses) can have unpexpected low performances. See the
added tests for an example, and *Mathematical Models to Analyze Lua
Hybrid Tables and Why They Need a Fix* (Martínez, Nicaud, Rotondo;
arXiv:2208.13602v2) for detais.
2024-11-14 11:48:25 -03:00
Roberto Ierusalimschy
2491b87c10
New rule for size of array part
...
Array part needs 1/3 of its elements filled, instead of 1/2.
Array entries use ~1/3 the memory of hash entries, so this new rule
still ensures that array parts do not use more memory than keeping
the values in the hash, while allowing more uses of the array part,
which is more efficient than the hash.
2024-11-13 13:37:24 -03:00
Roberto Ierusalimschy
0de8191152
New structure to count keys in a table for rehashing
2024-10-28 14:15:21 -03:00
Roberto Ierusalimschy
853311e5b1
Table rehash can resize only the hash part
...
If there are no integer keys outside the array part, there is no
reason to resize it, saving the time to count its elements. Moreover,
assignments to non-integer keys will not collapse a table created with
'table.create'.
2024-10-28 10:54:36 -03:00
Roberto Ierusalimschy
25a2dac2bc
Always use unsigned int for indexing table-arrays
2024-10-24 15:33:25 -03:00
Roberto Ierusalimschy
e3ce88c9e8
New function 'lua_numbertostrbuff'
...
It converts a Lua number to a string in a buffer, without creating
a new Lua string.
2024-10-23 17:16:17 -03:00
Roberto Ierusalimschy
5ffcd458f0
Some changes in default GC parameters
2024-10-23 17:15:06 -03:00
Roberto Ierusalimschy
9b01da97e3
Small bug in 'luaE_luaE_statesize'
...
Plus, function was renamed to 'luaE_threadsize'.
2024-10-21 15:30:35 -03:00
Roberto Ierusalimschy
258355734d
Better support in 'ltests' for tracing the GC
2024-10-21 15:18:20 -03:00
Roberto Ierusalimschy
d0815046d0
Some adjustments in transition minor->major
...
Plus extra comments and other details.
2024-10-18 17:10:20 -03:00
Roberto Ierusalimschy
3d54b42d59
'objsize' broke in smaller pieces
2024-09-30 14:01:42 -03:00
Roberto Ierusalimschy
e4f418f07c
Local declaration in the REPL generates a warning
2024-09-27 10:00:35 -03:00
Roberto Ierusalimschy
20d42ccaae
No errors in 'luaO_pushvfstring'
...
Any call to 'va_start' must have a corresponding call to 'va_end';
so, functions called between them (luaO_pushvfstring in particular)
cannot raise errors.
2024-09-20 15:56:39 -03:00
Roberto Ierusalimschy
70d6975018
Towards no errors in 'luaO_pushvfstring'
...
Any call to 'va_start' must have a corresponding call to 'va_end';
so, functions called between them (luaO_pushvfstring in particular)
cannot raise errors.
2024-09-20 12:21:11 -03:00
Roberto Ierusalimschy
00e34375ec
In 'luaO_pushvfstring', all options use 'addstr2buff'
2024-09-20 10:06:06 -03:00
Roberto Ierusalimschy
45a8f1b593
Removed 'if' left from commit ddfa1fbccf
2024-09-20 09:43:46 -03:00
Roberto Ierusalimschy
8fac494509
Avoid Microsoft warning
...
> warning C4334: '<<': result of 32-bit shift implicitly converted to
> 64 bits (was 64-bit shift intended?)
2024-09-19 19:09:35 -03:00
Roberto Ierusalimschy
9b72355f99
USHRT_MAX changed to SHRT_MAX
...
USHRT_MAX does not fit in an 'int' in 16-bit systems.
2024-09-19 19:06:16 -03:00
Roberto Ierusalimschy
ddfa1fbccf
GC back to controling pace counting bytes
...
Memory is the resource we want to save. Still to be reviewed again.
2024-09-19 19:02:14 -03:00
Roberto Ierusalimschy
b443145ff3
Details
...
Fixed comments in sort partition.
2024-09-12 11:08:11 -03:00
Roberto Ierusalimschy
4901853c11
Parameter for lua_gc/LUA_GCSTEP changed to 'size_t'
...
'size_t' is the common type for measuring memory. 'int' can be too
small for steps.
2024-09-10 17:05:39 -03:00
Roberto Ierusalimschy
a04e0ffdb9
Rename of fields in global state that control GC
...
All fields in the global state that control the pace of the garbage
collector prefixed with 'GC'.
2024-09-06 14:38:39 -03:00
Roberto Ierusalimschy
007b8c7a01
Details
...
Identation + comments
2024-09-06 14:35:04 -03:00
Roberto Ierusalimschy
fd0e1f530d
Added option for direct correction of stack pointers
...
The use of a pointer (not access, only for computations) after its
deallocation is forbiden in ISO C, but seems to work fine in all
platforms we are aware of. So, using that to correct stack pointers
after a stack reallocation seems safe and is much simpler than the
current implementation (first change all pointers to offsets and
then changing the offsets back to pointers). Anyway, for now that
option is disabled.
2024-08-22 11:11:00 -03:00
Roberto Ierusalimschy
75620b45ae
'lcode.c' can use 'checklimit', too
2024-08-20 15:15:23 -03:00
Roberto Ierusalimschy
3e88b72b8e
A return can have at most 254 values
2024-08-19 18:39:25 -03:00
Roberto Ierusalimschy
8b752ddf14
Bug: wrong code gen. for indices with comparisons
...
In function 'luaK_exp2val', used to generate code for indices: Macro
'hasjumps' does not consider the case when the whole expression is a
"jump" (a test). In all other of its uses, the surrounding code ensures
that the expression cannot be VJMP.
2024-08-17 12:47:28 -03:00
Roberto Ierusalimschy
1bf4b80f1a
Floats formatted with "correct" precision
...
Conversion float->string ensures that, for any float f,
tonumber(tostring(f)) == f, but still avoiding noise like 1.1
converting to "1.1000000000000001".
2024-08-02 15:09:30 -03:00
Roberto Ierusalimschy
4c6afbcb01
Struct 'transferinfo' moved to "lua_State"
...
That reduces the size of "CallInfo". Moreover, bit CIST_HOOKED from
call status is not needed. When in a hook, 'transferinfo' is always
valid, being zero when the hook is not call/return.
2024-07-30 10:16:19 -03:00
Roberto Ierusalimschy
f2206b2abe
'-Wconversion' extended to all options of Lua numbers
2024-07-27 15:13:21 -03:00
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
15231d4fb2
'nresults' moved into 'callstatus'
...
That gives us more free bits in 'callstatus', for future use.
2024-07-21 14:56:59 -03:00
Roberto Ierusalimschy
f407b3c4a1
Using CIST_CLSRET instead of trick with 'nresults'
...
The callstatus flag CIST_CLSRET is used in all tests for the
presence of variables to be closed in C functions.
2024-07-19 17:34:22 -03:00
Roberto Ierusalimschy
a546138d15
Explicit limit for number of results in a call
...
The parameter 'nresults' in 'lua_call' and similar functions has a
limit of 250. It already had an undocumented (and unchecked) limit of
SHRT_MAX, but it is seldom larger than 2.
2024-07-18 14:44:40 -03:00
Roberto Ierusalimschy
cd4de92762
Maximum stack size may not fit in unsigned short
...
Therefore, fields ftransfer/ntransfer in lua_Debug must have type
'int'. (Maximum stack size must fit in an 'int'.) Also, this commit
adds check that maximum stack size respects size_t for size in bytes.
2024-07-16 11:33:30 -03:00
Roberto Ierusalimschy
6b45ccf4ed
Removed compatibility with "= exp" in the REPL
2024-07-05 15:19:11 -03:00
Roberto Ierusalimschy
93fd6892f8
Fixed bug in 'multiline'
...
'incomplete' was popping error message that should be used in case
there is no more lines to complete the input, that is, 'pushline'
returns NULL, due to end of file.
2024-07-05 15:13:46 -03:00
Roberto Ierusalimschy
193bf7919e
'printstack' (from ltests.c) made public
...
That function is useful for debugging the API.
2024-07-05 14:57:11 -03:00
Roberto Ierusalimschy
366c855648
lua.c loads 'readline' dynamically
...
(See comments in luaconf.h.) This change allows easier compilation,
as Lua compiles and works even if the package 'readline' is absent
from the system. Moreover, non-interactive uses don't load the library,
making the stand-alone slightly faster for small loads.
2024-07-04 17:11:58 -03:00
Roberto Ierusalimschy
781219dbe1
Small changes in casts from void* to functions
...
Macro moved to llimits.h, and casts from void* to lua_CFunction first
go through 'voidf' (a pointer to a function from void to void), a kind
of void* for functions.
2024-07-02 11:09:46 -03:00
Roberto Ierusalimschy
d71fbc3175
Updated dependencies in the make file
...
Mainly to include 'llimits.h' in the non-kernel files
2024-07-01 15:58:07 -03:00
Roberto Ierusalimschy
c403e456b6
New instruction format for SETLIST/NEWTABLE
...
New instruction format 'ivABC' (a variant of iABC where parameter vC has
10 bits) allows constructors of up to 1024 elements to be coded without
EXTRAARG.
2024-06-28 11:18:14 -03:00
Roberto Ierusalimschy
6ac7219da3
'isIT'/'isOT' turned from macros to functions
2024-06-27 15:01:57 -03:00
Roberto Ierusalimschy
9904c253da
Flexible limit for use of registers by constructors
...
Instead of a fixed limit of 50 registers (which, in a bad worst case,
can limit the nesting of constructors to 5 levels), the compiler
computes an individual limit for each constructor based on how many
registers are available when it runs. This limit then controls the
frequency of SETLIST instructions.
2024-06-27 11:24:27 -03:00
Roberto Ierusalimschy
fb7e5b76c9
Clearer code for controlling maximum registers
...
Plus, added a test to check that limit.
2024-06-26 14:46:44 -03:00
Roberto Ierusalimschy
c1dc08e8e8
Length of external strings must fit in Lua integer
...
(As the length of any string in Lua.)
2024-06-24 12:03:59 -03:00
Roberto Ierusalimschy
0f7025dcae
Details in the manual
2024-06-21 16:36:24 -03:00
Roberto Ierusalimschy
ef28e5f789
Removed 'int' size limit for string.rep
2024-06-21 16:26:49 -03:00
Roberto Ierusalimschy
ec65ab878e
Removed 'int' size limit for pack/unpack
2024-06-21 14:55:12 -03:00
Roberto Ierusalimschy
e24ce8c2b3
lua_writestring & co. moved to llimits.h
...
They don't need to be visible by clients of Lua.
2024-06-21 12:29:08 -03:00
Roberto Ierusalimschy
a08d82eb13
llimits.h being used by all Lua code
...
The definitions in llimits.h are useful not only for the core. That
header only defines types and '#define's, so libs and core still do
not share any real code/data.
2024-06-20 14:46:06 -03:00
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
97ef8e7bd4
GC test was not restarting collector after pause
2024-06-18 17:14:23 -03:00
Roberto Ierusalimschy
aaf3533653
Tricky _PROMPT may trigger undefined behavior in lua.c
2024-06-12 16:04:25 -03:00
Roberto Ierusalimschy
b529aefc53
Bug: luaL_traceback may need more than 5 stack slots
2024-06-12 16:02:01 -03:00
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
Roberto Ierusalimschy
b719ff9399
Removed parameter in 'collectgarbage("step")'
...
A call to 'collectgarbage("step")' always performs one GC basic step.
2023-12-01 16:38:28 -03:00
Roberto Ierusalimschy
35a2fed2d1
Removed deprecated options in 'lua_gc'
...
Options 'setpause' and 'setstepmul' were deprecated in Lua 5.4.
2023-11-30 15:51:02 -03:00
Roberto Ierusalimschy
63d68bd657
Comments detailing the ages for generational GC
...
Plus other comments and small details.
2023-11-29 16:22:09 -03:00
Roberto Ierusalimschy
842a83f09c
Panic functions should not raise errors
...
The standard panic function was using 'lua_tostring', which may raise
a memory-allocation error if error value is a number.
2023-11-24 16:08:55 -03:00
Roberto Ierusalimschy
011850a8f8
Details in the manual
2023-11-24 14:44:38 -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
25cd3d377e
Buffer in 'luai_makeseed' measured in bytes
...
In the (rare) cases when sizeof(void*) or sizeof(time_t) are not
multiples of sizeof(int), we still can use all their bytes in the seed.
2023-11-15 10:28:32 -03:00
Roberto Ierusalimschy
1028f296a8
Default paths stored as external strings
2023-11-13 13:41:59 -03:00
Roberto Ierusalimschy
6d042a178f
Auxiliary buffer uses external strings
...
The buffer system from the auxiliary library reuses its buffer
as external memory when closing long strings.
2023-11-13 13:12:33 -03:00
Roberto Ierusalimschy
eabf425c76
Correct anchoring and GC barriers in 'loadString'
...
Call to 'luaH_setint' could call the GC with the string unanchored.
Moreover, previously saved strings were being assigned to the prototype
without a barrier.
2023-11-13 13:11:09 -03:00
Roberto Ierusalimschy
3b57e37e48
Fixed buffers save long strings as external.
2023-11-10 12:35:48 -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
b8a9d14032
Details
...
Comments and parameter name in header file.
2023-11-08 10:41:24 -03:00
Roberto Ierusalimschy
19afd91687
Solving merge issue with use of tables in dump/undump
...
The use of tables in dump/undump to reuse strings did not exist in
the version that changed the representation of arrays, so it was not
corrected for the new API for tables.
2023-11-08 10:02:06 -03:00
Roberto Ierusalimschy
37c215b43f
Merge branch 'newarray' into nextversion
2023-11-07 17:26:15 -03:00
Roberto Ierusalimschy
9e99f3071d
Merge branch 'master' into nextversion
2023-11-07 17:25:46 -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
7923dbbf72
Bug: Recursion in 'getobjname' can stack overflow
...
'getobjname' now broken in two, a basic version that handles locals,
upvalues, and constants, and a full version, which uses the basic
version to handle table accesses (globals and fields).
2023-11-01 12:00:54 -03:00
Roberto Ierusalimschy
43c8e5bded
Full abstraction for representation of array values
2023-10-30 14:25:59 -03:00
Roberto Ierusalimschy
b8b709b6d4
Avoid direct accesses to the array part of a table
2023-10-27 16:32:49 -03:00
Roberto Ierusalimschy
81e4fce530
Simpler test in 'luaH_getint'
...
The test whether key is inside the array part of a table uses a bit
trick to avoid computing the real size of the array part.
2023-10-26 16:12:25 -03:00
Roberto Ierusalimschy
6baee9ef9d
Removed test for "corrupted binary dump"
...
Test is too non portable. (For instance, it does not work for
different number types.)
2023-09-08 16:19:21 -03:00
Roberto Ierusalimschy
edd8589f47
Avoid casts from unsigned long to floating-point
...
Old Microsoft compilers do not support those casts.
2023-09-08 11:34:39 -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
f33cda8d6e
New macro 'getlstr'
...
Accesses content and length of a 'TString'.
2023-08-30 11:26:16 -03:00
Roberto Ierusalimschy
96f7714237
Field 'Proto.is_vararg' uses only one bit
...
So that the other bits can be used for other purposes.
2023-08-30 10:44:28 -03:00
Roberto Ierusalimschy
0554581605
Opcode in dumps is stored properly aligned
2023-08-25 17:40:20 -03:00
Roberto Ierusalimschy
07a9eab23a
Cannot use 'getshrstr' before setting 'shrlen'
2023-08-25 15:55:14 -03:00
Roberto Ierusalimschy
c815c2f0eb
Merge branch 'master' into nextversion
2023-08-23 15:14:03 -03:00
Roberto Ierusalimschy
9363a8b990
Documentation for "LUA_NOENV"
...
Registry field "LUA_NOENV" (that signals to libraries that option -E
is on) now part of the "official" API of Lua stand-alone.
2023-08-23 13:50:38 -03:00
Roberto Ierusalimschy
5ab6a5756b
Bug: Wrong line number for function calls
2023-08-23 13:49:27 -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
f4211a5ea4
More control over encoding of test files
...
The few UTF-8 test files are commented as such, and there is only one
non UTF-8 test file (to test non UTF-8 sources).
2023-08-17 10:42:56 -03:00
Roberto Ierusalimschy
1b3f507f62
Bug: Call hook may be called twice when count hook yields
...
Took the opportunity and moved the code that controls call hooks
in 'luaV_execute' into a function.
2023-07-25 16:50:44 -03:00
Roberto Ierusalimschy
6b51133a98
Thread stacks resized in the atomic phase
...
Although stack resize can be a little expensive, it seems unusual to
have too many threads needing resize during one GC cycle. On the other
hand, the change allows full collections to skip the propagate phase,
going straight from a pause to the atomic phase.
2023-07-13 14:55:46 -03:00
Roberto Ierusalimschy
cbae016202
Details
2023-07-03 14:12:54 -03:00
Roberto Ierusalimschy
ab6a949522
Merge branch 'master' into nextversion
2023-06-22 11:41:48 -03:00
Roberto Ierusalimschy
ea39042e13
Removed redundancy in definitions of version/release
...
String rendering now derived from the numeric original definitions.
2023-06-21 15:04:24 -03:00
Roberto Ierusalimschy
05ec55f16b
Avoid inclusion loop in 'ltm.h'
2023-06-16 11:52:14 -03:00
Roberto Ierusalimschy
f623b96932
Bug: read overflow in 'l_strcmp'
...
Equality according to 'strcoll' does not imply that strings have
the same length.
2023-06-14 14:38:07 -03:00
Roberto Ierusalimschy
9be74ccc21
Several functions turned 'static'
...
Several functions that were already being used only inside their
own file have been declared as 'static'.
2023-05-22 14:47:54 -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
09f3c2372f
Option '-l' discards version sufix from file name
...
Like 'require', the command-line option '-l' discards an optional
version suffix (everything after an hyphen) from a file name when
creating the module name.
2023-05-15 13:46:38 -03:00
Roberto Ierusalimschy
c197885cb0
Small improvements in tests
2023-05-15 10:20:13 -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
6443185167
"Emergency" new version 5.4.6
...
'lua_resetthread' is back to its original signature, to avoid
incompatibilities in the ABI between releases of the same version.
New function 'lua_closethread' added with the "correct" signature.
2023-05-02 16:41:43 -03:00
Roberto Ierusalimschy
e15f1f2bb7
Details
...
Typos in comments and details in the manual.
2023-04-18 09:44:10 -03:00
Roberto Ierusalimschy
b5c65705ca
New year (2023)
...
Also, small tweak in makefile. (-Wsign-compare is already enabled by
-Wextra.)
2023-03-31 11:47:31 -03:00
Roberto Ierusalimschy
7ca8105a2e
More orderliness in casts of enumerations
2023-03-27 16:29:39 -03:00
Roberto Ierusalimschy
94689ac3ad
More regularity in uses of enums in 'lcode.c'
2023-03-24 15:52:03 -03:00
Roberto Ierusalimschy
86e8039a72
Clock component removed from 'luaL_makeseed'
...
'clock' can be quite slow on some machines.
2023-03-23 16:01:16 -03:00
Roberto Ierusalimschy
5a04f1851e
New function 'luaL_makeseed'
...
This function unifies code from 'lua_newstate', 'math.randomseed',
and 'table.sort' that tries to create a value with a minimum level
of randomness.
2023-03-20 16:13:17 -03:00
Roberto Ierusalimschy
ab859fe59b
Bug: Loading a corrupted binary file can segfault
...
The size of the list of upvalue names are stored separated from the
size of the list of upvalues, but they share the same array.
2023-03-17 15:52:09 -03:00
Roberto Ierusalimschy
c4b71b7ba0
Details
...
Comments in 'onelua.c'
2023-03-09 11:12:11 -03:00
Roberto Ierusalimschy
1de2f31694
Corrected support for 16-bit systems
...
We still need access to a 16-bit system to correctly test
these changes.
2023-03-09 11:10:04 -03:00
Roberto Ierusalimschy
02bab9fc25
Bug: Wrong line in error message for arith. errors
...
It also causes 'L->top' to be wrong when the error happens,
triggering an 'assert'.
2023-02-08 14:15:41 -03:00
Roberto Ierusalimschy
5e08b41567
Simpler definition for LUA_STRFTIMEOPTIONS
...
There is no need for those intermediate definitions.
2023-02-07 10:48:39 -03:00
Roberto Ierusalimschy
8c064fdc23
Merge branch 'master' into nextversion
2023-02-02 13:47:28 -03:00
Roberto Ierusalimschy
cf08915d62
New macro LUA_USE_IOS
...
Do not try to detect automatically whether system is iOS; it is
simpler and more reliable to let the programmer inform that.
2023-02-02 13:43:41 -03:00
Roberto Ierusalimschy
c888ae0aea
Small changes in hash of pointers
...
When converting from pointer to integer, use 'uintptr_t' if available;
otherwise try 'uintmax_t', and use 'size_t' as last resource.
2023-02-02 13:37:11 -03:00
Roberto Ierusalimschy
d69789da1c
Fix absence of 'system' in iOS
...
Despite claiming to be ISO, the C library in some Apple platforms
does not implement 'system'.
2023-01-24 15:04:17 -03:00
Roberto Ierusalimschy
8dea54877a
Do not avoid major collections when GCdebt is zero
...
'collectgarbage("step")' (without an argument) does not have any
special meaning, it means "do a step with some default size".
2022-12-29 15:41:07 -03:00
Roberto Ierusalimschy
b5ab31a475
Merge branch 'master' into nextversion
2022-12-28 18:38:20 -03:00
Roberto Ierusalimschy
314745ed84
Avoid excessive name pollution in test files
...
Test files are more polite regarding the use of globals when locals
would do, and when globals are necessary deleting them after use.
2022-12-28 18:34:11 -03:00
Roberto Ierusalimschy
140cdcced5
Merge branch 'master' into nextversion
2022-12-23 11:30:07 -03:00
Roberto Ierusalimschy
0825cf237d
Detail in make file for testes/libs
...
Everything depends on the Lua version (as given by 'lua.h')
2022-12-23 11:28:11 -03:00
Roberto Ierusalimschy
7d4c7ae2af
Changes in opcodes for generic 'for'
...
Again, as the control variable is read only, the code doesn't need
to keep an internal copy of it.
2022-12-22 13:52:53 -03:00
Roberto Ierusalimschy
873588dc5f
Simplification in opcodes for numerical 'for'
...
As the control variable is read only, the code doesn't need to keep
an internal copy of it.
2022-12-21 15:35:40 -03:00
Roberto Ierusalimschy
b2f7b3b79f
Control variables in for loops are read only
2022-12-21 12:04:59 -03:00
Roberto Ierusalimschy
540d805226
Towards Lua 5.5
2022-12-20 13:24:43 -03:00
Roberto Ierusalimschy
7d6a97e42b
Dump doesn't need to reuse 'source'
...
All strings are being reused now, including 'source'.
2022-12-20 11:14:52 -03:00
Roberto Ierusalimschy
d70a0c91ad
Dump/undump reuse strings
...
A repeated string in a dump is represented as an index to its first
occurence, instead of another copy of the string.
2022-12-15 16:44:22 -03:00
Roberto Ierusalimschy
3e6818ca87
Merge branch 'master' into nextversion
2022-12-15 14:23:59 -03:00
Roberto Ierusalimschy
f874d37fa2
Small change in barrier macros
...
Reuse macros for objects when defining the macros for values.
2022-12-15 14:18:03 -03:00
Roberto Ierusalimschy
88e5c6b80b
Merge branch 'master' into nextversion
2022-12-15 10:51:04 -03:00
Roberto Ierusalimschy
35e01ed21d
Small improvements in 'lmem.c'
...
Added some auxiliary macros + fixed a bug in compilation option
EMERGENCYGCTESTS. (It should not try to force an emergency collection
when it cannot run one.)
2022-12-15 10:44:55 -03:00
Roberto Ierusalimschy
e33e1bda97
Merge branch 'master' into nextversion
2022-12-14 16:22:43 -03:00
Roberto Ierusalimschy
6aabf4b15e
Details in some header files
...
Identifier LUA_NUMTAGS was deprecated (changed to LUA_NUMTYPES) +
better handling of some inclusion loops.
2022-12-14 16:20:39 -03:00
Roberto Ierusalimschy
5d8b5b9290
Changed signal of GC debt
...
Positive debts seems more natural then negative ones.
2022-12-13 15:45:57 -03:00
Roberto Ierusalimschy
40565b4a08
Revamp of GC parameters
...
More uniformity when handling GC parameters + avoid divisions by 100
when applying them.
2022-12-13 11:55:14 -03:00
Roberto Ierusalimschy
ff106c028c
Merge branch 'master' into nextversion
2022-12-12 14:08:55 -03:00
Roberto Ierusalimschy
fa2f294dd1
Reduce calls to 'luaC_step' when GC is stopped
2022-12-09 16:35:19 -03:00
Roberto Ierusalimschy
d738c8d18b
New function 'luaL_openselectedlibs'
...
Makes it easier to start Lua with only some standard libraries.
2022-12-07 15:12:52 -03:00
Roberto Ierusalimschy
0270c204c2
Simplification in handling of GC debt
...
Each incremental step has always the same size (stepsize), and the
debt for next step also is always the same.
2022-12-06 12:02:34 -03:00
Roberto Ierusalimschy
82fae58e25
Details
...
Parentheses and comments.
2022-12-02 11:33:09 -03:00
Roberto Ierusalimschy
efc7c5d503
Merge branch 'master' into nextversion
2022-12-01 09:51:07 -03:00
Roberto Ierusalimschy
d324a0ccf9
Simpler control for major collections
2022-11-29 10:37:08 -03:00
Roberto Ierusalimschy
152b51955a
Removed GC checks from function calls
...
Function calls do not create new objects. (It may use memory with
stack reallocation, but now that is irrelevant to the GC.)
2022-11-24 10:20:15 -03:00
Roberto Ierusalimschy
ec61be9a7e
'l_mem' renamed to 'l_obj' to count objects
2022-11-23 17:29:03 -03:00
Roberto Ierusalimschy
f356d5acdd
First version of GC counting objects for control
...
Still needs to review generational mode.
2022-11-23 17:17:20 -03:00
Roberto Ierusalimschy
9a77f57edc
Stop GC while building initial state
2022-11-23 14:17:28 -03:00
Roberto Ierusalimschy
be908a7d4d
Removed unused field 'UpVal.tbc'
2022-11-08 10:15:10 -03:00
Roberto Ierusalimschy
76953316d1
Added a counter of the total number of existing objects
...
It may simplify the control of the garbage collector.
2022-11-03 16:37:13 -03:00
Roberto Ierusalimschy
3d2bd1359d
Merge branch 'master' into nextversion
2022-11-01 17:17:21 -03:00
Roberto Ierusalimschy
9ede317c70
Threads are created like other objects
...
Using a version of 'luaC_newobj' that allows offsets (extra space
before the object itself).
2022-11-01 17:14:01 -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
ee645472eb
Stack reallocation done with a single realloc
...
To avoid the need of both the old and the new stack addresses valid
at the same time, to correct the pointers to the stack, these pointers
are changed to offsets before the reallocation and then changed back
to pointers after the reallocation.
2022-10-31 15:06:20 -03:00
Roberto Ierusalimschy
413a393e62
Stack indices changed to union's
...
That will allow to change pointers to offsets while reallocating
the stack.
2022-10-29 12:06:37 -03:00
Roberto Ierusalimschy
ba089bcb08
Details
...
Added comments in the makefile about other useful '-fsanitize' options.
2022-10-26 10:15:09 -03:00
Roberto Ierusalimschy
1e64c1391f
Bug: stack overflow with nesting of coroutine.close
2022-10-25 16:44:06 -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
c954db3924
Option '-l g=mod' added to the manual
...
Plus some other improvements in the manual.
2022-10-19 16:30:39 -03:00
Roberto Ierusalimschy
14d2803e55
Details
...
Some cast operations rewritten to use respective macros.
2022-10-19 16:29:54 -03:00
Roberto Ierusalimschy
7f12bf40c4
Portability issue in a test for 'string.format'
2022-10-19 16:20:11 -03:00
Roberto Ierusalimschy
26be27459b
Negation in constant folding of '>>' may overflow
2022-09-23 11:08:10 -03:00
Roberto Ierusalimschy
cfbe378f90
Small simplification in overflow check in 'getfield'
...
Subtracting a small non-negative int from a non-negative int cannot
overflow, and adding a non-negative int to INT_MIN cannot overflow.
2022-09-23 10:57:35 -03:00
Roberto Ierusalimschy
a1089b415a
Bug: 'utf8.codes' accepts spurious continuation bytes
2022-09-23 10:41:16 -03:00
Roberto Ierusalimschy
f8c4c4fcf2
New test for table rehash
2022-09-16 17:05:22 -03:00
Roberto Ierusalimschy
71bc69c2af
Note in the manual about using '...' as an expression
2022-09-08 17:21:02 -03:00
Roberto Ierusalimschy
cd56f222b7
Corrected error message in 'table.remove'
2022-09-07 12:21:46 -03:00
Roberto Ierusalimschy
69b77b6fde
Changed the growth rate of string buffers
...
The growth rate of string buffers was reduced from 2 to 1.5 (3/2).
As string buffers start larger (256~1024 bytes), they don't need to
grow that fast. Moreover, a lower rate allows multiplicative growth up
to larger sizes (3/2 of the maximum). (After that, the growth becomes
linear, which is mostly useless.)
2022-09-06 10:58:55 -03:00
Roberto Ierusalimschy
997f11f543
Bug: 'break' may not properly close variable in a 'for' loop
...
Function 'leaveblock' was generating "break" label before removing
variables from the closing block. If 'createlabel' created a 'close'
instruction (which it did when matching a goto/break that exited
the scope of an upvalue), that instruction would use the wrong level.
2022-08-24 17:36:47 -03:00
Roberto Ierusalimschy
02060b7a37
Simpler handling of Byte Order Mark (BOM)
2022-08-23 16:08:53 -03:00
Roberto Ierusalimschy
a1f77a234a
Bug: set correct pause when (re)entering gen. collection.
2022-08-23 16:06:23 -03:00
Roberto Ierusalimschy
c6cea857a4
Better documentation for 'multires' expressions
...
Manual has a new section explaining multires expressions, lists of
expressions, and adjustments. This commit also corrects some comments
in the code.
2022-08-19 14:10:18 -03:00
Roberto Ierusalimschy
d61b0c6028
More checks and documentation for uses of EXTRA_STACK
2022-05-26 15:14:54 -03:00
Roberto Ierusalimschy
196bb94d66
Bug: 'lua_settop' may use an invalid pointer to stack
2022-05-25 17:41:39 -03:00
Roberto Ierusalimschy
603b2c64ad
'luaV_concat' can use invalidated pointer to stack
...
Bug introduced in commit 42d40581 .
2022-05-23 17:50:47 -03:00
Roberto Ierusalimschy
4a00f61276
'lua_checkstack' doesn't need to check stack overflow
...
'luaD_growstack' already checks that. This commit also fixes an
internal bug in 'luaD_growstack': a large 'n' could cause an arithmetic
overflow when computing 'needed'.
2022-05-23 10:38:03 -03:00
Roberto Ierusalimschy
42d40581dd
Save stack space while handling errors
...
Because error handling (luaG_errormsg) uses slots from EXTRA_STACK,
and some errors can recur (e.g., string overflow while creating an
error message in 'luaG_runerror', or a C-stack overflow before calling
the message handler), the code should use stack slots with parsimony.
This commit fixes the bug "Lua-stack overflow when C stack overflows
while handling an error".
2022-05-20 13:14:33 -03:00
Roberto Ierusalimschy
e435aaabef
Details (identation and typos)
2022-05-10 11:13:39 -03:00
Roberto Ierusalimschy
315639d3bb
Factoring out common parts of 'codearith' and 'codebitwise'
2022-05-06 17:52:46 -03:00
Roberto Ierusalimschy
c764ca71a6
Bug: Wrong code generation in bitwise operations
2022-04-25 14:42:51 -03:00
Roberto Ierusalimschy
295cde9454
New release number (5.4.5)
2022-04-07 10:52:15 -03:00
Roberto Ierusalimschy
f3cfd5bf2b
Details
...
Comments + manual + identation + asserts about stack limits that were
not allowing the use of the full stack
2022-04-01 13:55:44 -03:00
Roberto Ierusalimschy
8426d9b4d4
Avoid computing invalid addresses
...
luaV_execute should compute 'ra' only when the instruction uses it.
Computing an illegal address is undefined behavior even if the address
is never dereferenced.
2022-02-18 13:22:25 -03:00
Roberto Ierusalimschy
1f3c6f4534
Bug: Lua can generate wrong code when _ENV is <const>
2022-02-15 12:28:46 -03:00
Roberto Ierusalimschy
25b143dd34
Bug: lua.c assumes that argv has at least one element
2022-02-07 10:16:35 -03:00
Roberto Ierusalimschy
5d708c3f9c
Explanation of borders in the manual
...
The explanation includes the limit case of maxinteger being a border.
It also avoids the term "natural", which might include large floats
with natural values.
2022-01-13 08:15:03 -03:00
Roberto Ierusalimschy
8dd2c912d2
Detail
...
Warnings with clang when using long double for Lua floats.
2022-01-03 09:12:17 -03:00
Roberto Ierusalimschy
05ac2409ee
New year (2022)
2022-01-02 07:11:08 -03:00
Roberto Ierusalimschy
597a53bbc6
Bug: finalizer calling exit can corrupt finalization order
...
'os.exit' can call lua_close again, separating new finalizers
created after all previous finalizers were already separated.
2021-12-22 09:00:52 -03:00
Roberto Ierusalimschy
86ec152433
Details
...
correction in macro for hard tests + type in comment
2021-12-21 07:39:25 -03:00
Roberto Ierusalimschy
cf613cdc6f
Bug: finalizers can be called with an invalid stack
...
The call to 'checkstackGC' can run finalizers, which will find an
inconsistent CallInfo, as 'ci' is half updated at the point of call.
2021-12-15 11:29:07 -03:00
Roberto Ierusalimschy
066e0f93c4
Fix debug information about finalizers
...
The flag CIST_FIN does not mark a finalizer, but the function that was
running when the finalizer was called. (So, the function did not call
the finalizer, but it looks that way in the stack.)
2021-12-14 12:50:05 -03:00
Roberto Ierusalimschy
0bfc572e51
Bug: GC is not reentrant
...
As the GC is not reentrant, finalizers should not be able to invoke it.
2021-12-13 10:41:17 -03:00
Roberto Ierusalimschy
1de95e97ef
Bug: Lua stack still active when closing a state
2021-12-10 10:53:54 -03:00
Roberto Ierusalimschy
ad3942adba
Main 'mainposition' replaced by 'mainpositionTV'
...
Handle values in table keys as the special cases they are, and not
the other way around.
2021-11-25 11:07:17 -03:00
Roberto Ierusalimschy
48835c76c8
Wrong assert in 'collectvalidlines'
2021-11-25 10:11:05 -03:00
Roberto Ierusalimschy
6b3e116d44
Corrected bug in 'luaD_tryfuncTM'
...
The pointer to the metamethod can be invalidated by a finalizer that
can run during a GC in 'checkstackGCp'. (This commit also fixes a
detail in the manual.) Bug introduced in commit 91673a8ec .
2021-11-16 14:35:06 -03:00
Roberto Ierusalimschy
e8deac5a41
Avoid OP_VARARGPREP for active lines
...
when building the table 'activelines' for a vararg function, this
first instruction does not make the first line active.
2021-11-10 15:07:14 -03:00
Roberto Ierusalimschy
bfbff3703e
Bug: Wrong status in coroutine during reset
...
When closing variables during 'coroutine.close' or 'lua_resetthread',
the status of a coroutine must be set to LUA_OK; a coroutine should
not run with any other status. (See assertion in 'lua_callk'.)
After the reset, the status should be kept as normal, as any error
was already reported.
2021-11-08 11:55:25 -03:00
Roberto Ierusalimschy
74d99057a5
Bug: C stack overflow with coroutines
...
'coroutine.resume' did not increment counter of C calls when
continuing execution after a protected error (that is,
while running 'precover').
2021-11-03 15:04:18 -03:00
Roberto Ierusalimschy
1fce5bea81
More uniform implementation for tail calls
...
'luaD_pretailcall' mimics 'luaD_precall', handling call metamethods
and calling C functions directly. That makes the code in the
interpreter loop simpler.
This commit also goes back to emulating the tail call in 'luaD_precall'
with a goto, as C compilers may not do proper tail calls and the C
stack can overflow much sooner than the Lua stack (which grows as the
metamethod is added to it).
2021-10-29 13:41:24 -03:00
Roberto Ierusalimschy
3699446aaf
Removed goto's in 'luaD_precall'
...
(plus a detail in lauxlib.h.)
2021-10-18 11:58:40 -03:00
Roberto Ierusalimschy
0e5071b5fb
Avoid taking the address of a 'TValue' field
...
That structure can be packed in the future.
2021-10-11 13:52:26 -03:00
Roberto Ierusalimschy
87a9573b2e
Documentation
...
Better explanation about the guaranties of multiple assignment in
the manual.
2021-10-11 13:49:13 -03:00
Roberto Ierusalimschy
deac067ed3
Avoid overflows when incrementing parameters in C
...
Any C function can receive maxinteger as an integer argument, and
therefore cannot increment it without some care (e.g., doing unsigned
arithmetic as the core does).
2021-09-22 13:10:39 -03:00
Roberto Ierusalimschy
2ff3471722
Using 'inline' in some functions
...
According to ISO C, "making a function an inline function suggests that
calls to the function be as fast as possible." (Not available in C89.)
2021-09-15 11:18:41 -03:00
Roberto Ierusalimschy
9db4bfed6b
Revamp of format validation in 'string.format'
...
When calling 'sprintf', not all conversion specifiers accept all
flags; some combinations are undefined behavior.
2021-09-03 13:14:56 -03:00
Roberto Ierusalimschy
91673a8ec0
'luaD_tryfuncTM' checks stack space by itself
2021-08-18 12:05:06 -03:00
Roberto Ierusalimschy
41871f1803
Undo simplification of tail calls (commit 901d760)
...
Not that simpler and slower.
2021-08-18 11:21:33 -03:00
Roberto Ierusalimschy
a393ac2554
Detail in 'testes/math.lua'
...
Added a print with the random seeds used in the tests of 'random'.
2021-08-18 10:46:18 -03:00
Roberto Ierusalimschy
65434b4d1b
Option '-l' can give a name for the global variable.
...
Sintax for this option now is '-l [globname=]modname'.
2021-08-16 13:57:19 -03:00
Roberto Ierusalimschy
59acd79c05
Added tests for string reuse by the scanner
2021-08-11 11:19:33 -03:00
Roberto Ierusalimschy
e2c07dcbf7
Improved documentation for 'lua_getinfo'
2021-08-11 11:18:10 -03:00
Roberto Ierusalimschy
439e45a2f6
Bug: luaL_tolstring may get confused with negative index
...
When object has a '__name' metafield, 'luaL_tolstring' used the
received index after pushing a string on the stack.
2021-07-22 13:48:43 -03:00
Roberto Ierusalimschy
62fb934427
Bug: Negation in 'luaV_shiftr' may overflow
...
Negation of an unchecked lua_Integer overflows with mininteger.
2021-07-22 13:44:53 -03:00
Roberto Ierusalimschy
8a32e0aa4a
Correction on documentation of string-buffer operations
...
All string-buffer operations can potentially change the stack in
unspecified ways; the push/pop documentation in the manual should
reflect that.
2021-07-21 11:33:58 -03:00
Roberto Ierusalimschy
dbdc74dc55
Simplification in the parameters of 'luaD_precall'
...
The parameters 'nresults' and 'delta1', in 'luaD_precall', were never
meaningful simultaneously. So, they were combined in a single parameter
'retdel'.
2021-06-30 12:53:21 -03:00
Roberto Ierusalimschy
6a0dace25a
Bug: 'local function' can assign to '<const>' variables
2021-06-20 15:36:36 -03:00
Roberto Ierusalimschy
04e19712a5
C functions can be tail called, too
...
A tail call to a C function can have the behavior of a "real" tail
call, reusing the stack frame of the caller.
2021-06-14 13:28:21 -03:00
Roberto Ierusalimschy
901d760093
Simpler implementation for tail calls
...
Tail calls handled by 'luaD_precall', like regular calls, to avoid
code duplication.
2021-06-11 13:41:07 -03:00
Roberto Ierusalimschy
c0ed74c1e1
Avoid the term "undefined behavior" in the manual
2021-06-09 13:24:49 -03:00
Roberto Ierusalimschy
fc6c74f100
'index2value' more robust
...
'index2value' accepts pseudo-indices also when called from a Lua
function, through a hook.
2021-05-24 16:48:43 -03:00
Roberto Ierusalimschy
1e6918d553
Details
...
- Removed unused (and trivial) definition LUA_UNSIGNEDBITS
- Alignment structure in pack/unpack moved to a narrower scope
2021-05-24 16:48:09 -03:00
Roberto Ierusalimschy
681297187e
Bug: yielding in '__close' mess up number of returns
...
Yielding in a __close metamethod called when returning vararg results
changes the top and so messes up the number of returned values.
2021-04-16 15:41:44 -03:00
Roberto Ierusalimschy
5148954eed
Align error messages for calling non-callable values
...
'pcall(foo)' message was "attempt to call a table value", while
'pcall(function () foo() end) message was "global 'foo' is not callable".
2021-04-12 16:50:34 -03:00
Roberto Ierusalimschy
d205f3a484
Bug: Lua source should not use C99 comments ("//")
2021-04-10 10:19:21 -03:00
Roberto Ierusalimschy
47cffdc723
Bug: tbc variables in "for" loops don't avoid tail calls
2021-04-07 14:59:26 -03:00
Roberto Ierusalimschy
36de01d988
Changes in cache for function constants
...
In 'lcode.c', when adding constants to the list of constants of a
function, integers represent themselves in the cache and floats
with integral values get a small delta to avoid collision with
integers. (This change avoids creating artificial addresses; the old
implementation converted integers to pointers to index the cache.)
2021-03-30 14:49:18 -03:00
Roberto Ierusalimschy
7fbe215808
New hash function for integer keys
...
When integer keys do not form a sequence, it is better to use all their
bits to compute their hashes. (The previous implementation was quite bad
for integer keys with common lower bits, and disastrous for integer keys
changing only in their upper 32 bits.)
2021-03-29 15:47:18 -03:00
Roberto Ierusalimschy
bf10593a3a
Allow yields inside '__pairs'
2021-03-29 12:57:32 -03:00
Roberto Ierusalimschy
bef250eb8d
Details
...
Comments and small improvements in the manual.
2021-03-29 11:47:12 -03:00
Roberto Ierusalimschy
ba81adaad9
Next release number (5.4.4)
2021-03-29 11:26:07 -03:00
Roberto Ierusalimschy
eadd8c7178
Added option LUA_NOBUILTIN
...
This option allows external code to avoid the use of gcc builtin macro
'__builtin_expect' in the Lua API.
2021-03-12 15:03:33 -03:00
Roberto Ierusalimschy
014daf43cb
Details
...
Comments and order of hashing macros in 'ltable.c'.
2021-03-12 11:29:34 -03:00
Roberto Ierusalimschy
05b13651f9
File 'tracegc.lua' added to 'packtests'
2021-03-10 10:35:57 -03:00
Roberto Ierusalimschy
81c6021fb4
New implementation for 'tbclist'
...
- Fixes a bug, by removing dummy nodes together with the node
itself. (The previous implementation could leave dummy nodes in frames
which otherwise had no tbc variables, and therefore would not close
variables; that could leave 'tbclist' pointing higher than 'top', which
could dangle if the stack shrank.)
- Computes MAXDELTA based on the type of delta, to ease changing its
type if needed.
- Instead of 'isdummy', uses 'delta==0' to signal dummy nodes. (Dummy
nodes always have MAXDELTA for their real delta.)
2021-03-10 10:27:19 -03:00
Roberto Ierusalimschy
a7b8b27dd3
Uses of "likely" in macros active to all users
...
The use of 'l_likely' in auxlib macros 'luaL_argcheck' and
'luaL_argexpected' should not be restricted to Lua's own code.
For that, 'l_likely' was renamed to 'luai_likely' to be exported
to external code.
2021-03-09 12:50:59 -03:00
Roberto Ierusalimschy
511d53a826
lua_settop/lua_pop closes to-be-closed variables
...
The existence of 'lua_closeslot' is no reason for lua_pop not to close
to-be-closed variables too. It is too error-prone for lua_pop not to
close tbc variables being popped from the stack.
2021-03-09 11:42:45 -03:00
Roberto Ierusalimschy
f5df7f91f7
Wrong assertion in 'getbaseline'
...
The assertion cannot compute 'f->abslineinfo[i]' when the initial
estimate 'i' is -1.
2021-03-05 12:10:34 -03:00
Roberto Ierusalimschy
e7803f7dbc
New release number (5.4.3)
2021-03-03 09:44:20 -03:00
Roberto Ierusalimschy
b7eb21c1ef
Normalization of metamethod typography in the manual
2021-03-02 13:50:00 -03:00
Roberto Ierusalimschy
cf23a93d82
Added assertions for proper use of string buffers
2021-03-02 11:39:42 -03:00
Roberto Ierusalimschy
9a2de786de
Stack check in warning function for tests
...
The warning function using for tests need to check the stack before
pushing anything. (Warning functions are not expected to access a
Lua state, therefore they have no preallocated stack space.)
2021-03-02 11:35:40 -03:00
Roberto Ierusalimschy
5276973224
New test module 'tracegc'
...
New module easies the inclusion of GC tracing in individual test files.
2021-03-01 13:54:29 -03:00
Roberto Ierusalimschy
f9d857a81b
Stack reallocation done in two phases
...
$he stack reallocation is done in two steps (allocation + free) because
the correction of the pointers pointing into the stack must be done
while both addresses (the old stack and the new one) are valid. In ISO
C, any pointer use after the pointer has been deallocated is undefined
behavior. The compiler option '-fsanitize=pointer-subtract' (plus what
it needs to work) complained about the old implementation.
2021-02-27 12:56:09 -03:00
Roberto Ierusalimschy
1537d6680b
New control for reentrancy of emergency collections
...
Instead of assuming that shrinking a block may be an emergency
collection, use an explicit field ('gcstopem') to stop emergency
collections while GC is working.
2021-02-26 11:41:02 -03:00
Roberto Ierusalimschy
e0260eb2d4
Bug (kind of) in 'isinstack'
...
The function 'isinstack' tried to work around the undefined behavior
of subtracting two pointers that do not point to the same object,
but the compiler killed to trick. (It optimizes out the safety check,
because in a correct execution it will be always true.)
2021-02-25 13:39:36 -03:00
Roberto Ierusalimschy
5205f073c5
Don't use tointegerns when luaV_tointegerns will do
...
Some places don't need the "fast path" macro tointegerns, either
because speed is not essential (lcode.c) or because the value is not
supposed to be an integer already (luaV_equalobj and luaG_tointerror).
Moreover, luaV_equalobj should always use F2Ieq, even if Lua is
compiled to "round to floor".
2021-02-24 12:24:42 -03:00
Roberto Ierusalimschy
31925e4cc2
Details
...
Added documentation and asserts that constants for arithmetic opcodes
must be numbers.
2021-02-24 11:30:46 -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
c03c527fd2
Bug: 'string.concat' error message uses wrong format
2021-02-15 13:31:45 -03:00
Roberto Ierusalimschy
38cc7d40a4
Bug: cannot allow the call 'debug.getinfo(0, ">")'
...
A 'what' argument starting with '>' indicates that there is a function
in the C stack, which won't be there if the first argument is not a
function.
2021-02-15 10:38:09 -03:00
Roberto Ierusalimschy
bc970005ce
'__close' methods can yield in the return of a C function
...
When, inside a coroutine, a C function with to-be-closed slots return,
the corresponding metamethods can yield. ('__close' metamethods called
through 'lua_closeslot' still cannot yield, as there is no continuation
to go when resuming.)
2021-02-12 13:36:30 -03:00
Roberto Ierusalimschy
f79ccdca9b
Eases the use of clang in the makefile
...
New definition in the makefile for warnings that are valid for gcc but
not for clang (CWARNGCC).
2021-02-10 14:11:51 -03:00
Roberto Ierusalimschy
4e47f81188
New implementation for to-be-closed variables
...
To-be-closed variables are linked in their own list, embedded into the
stack elements. (Due to alignment, this information does not change
the size of the stack elements in most architectures.) This new list
does not produce garbage and avoids memory errors when creating tbc
variables.
2021-02-09 14:00:05 -03:00
Roberto Ierusalimschy
c63e5d212b
New macro 'completestate'
2021-02-05 17:51:25 -03:00
Roberto Ierusalimschy
dee6433a89
Forbid changing numerical types through compiler options
...
'luaconf.h' always defines options LUA_32BITS, LUA_C89_NUMBERS,
LUA_INT_TYPE, and LUA_FLOAT_TYPE (using 0/1 for the first two),
to avoid they being set through compiler options. (It is too easy
to forget these options when compiling other software that
interoperates with Lua.)
2021-02-05 15:30:34 -03:00
Roberto Ierusalimschy
2bfa13e520
Fixed some bugs around stack reallocation
...
Long time without using HARDSTACKTESTS...
2021-02-05 11:00:28 -03:00
Roberto Ierusalimschy
e500892e18
Optimization/simplification of 'getbaseline'
...
By producing absolute line information at regular intervals, a simple
division can compute the correct entry for a given instruction.
2021-02-02 14:43:55 -03:00
Roberto Ierusalimschy
949187b049
Optimizations for line hook
...
The function 'changedline' tries harder to avoid calling
'luaG_getfuncline' plus small changes in the use of 'L->oldpc'.
2021-01-28 14:40:29 -03:00
Roberto Ierusalimschy
58aa09a0b9
Small improvements in hooks
...
- 'L->top' is set once in 'luaD_hook', instead of being set in
'luaD_hookcall' and 'rethook';
- resume discard arguments when returning after an yield inside a hook
(arguments may interfere with the coroutine stack);
- yield inside a hook asserts it has no arguments.
2021-01-26 16:53:51 -03:00
Roberto Ierusalimschy
1f81baffad
Janitorial work
...
Comments, code details, identation.
2021-01-25 10:39:18 -03:00
Roberto Ierusalimschy
0e9254dfa0
Correct order of return hooks vs. close metamethods
...
The return hook should be called only after closing variables (which
are still part of the function). C functions were calling the hook
before the metamethods.
2021-01-21 10:27:22 -03:00
Roberto Ierusalimschy
6ccd24eff5
Simpler handling of errors when creating tbc variables
...
New field 'lua_State.ptbc' keeps to-be-closed variable until its
upvalue is created, so that it can be closed in case of a
memory-allocation error.
2021-01-19 10:03:13 -03:00
Roberto Ierusalimschy
d0f34d9137
Allow yields in '__close' metamethods ater errors
...
Completes commit b07fc10e91 . '__close' metamethods can yield even
when they are being called due to an error. '__close' metamethods from
C functions are still not allowed to yield.
2021-01-18 11:40:45 -03:00
Roberto Ierusalimschy
825ac8eca8
Corrected documentation for 'table.sort'
...
The sort function must define a (strict) weak order for a correct
sorting. A partial order is not enough.
2021-01-14 13:26:55 -03:00
Roberto Ierusalimschy
b07fc10e91
Allow yields inside '__close' metamethods
...
Initial implementation to allow yields inside '__close' metamethods.
This current version still does not allow a '__close' metamethod
to yield when called due to an error. '__close' metamethods from
C functions also are not allowed to yield.
2021-01-13 13:54:10 -03:00
Roberto Ierusalimschy
cc1692515e
New API function 'lua_closeslot'
...
Closing a to-be-closed variable with 'lua_settop' is too restrictive,
as it erases all slots above the variable. Moreover, it adds side
effects to 'lua_settop', which should be a fairly basic function.
2021-01-11 15:03:01 -03:00
Roberto Ierusalimschy
ce101dcaf7
Handles '__close' errors in coroutines in "coroutine style"
...
Errors in '__close' metamethods in coroutines are handled by the same
logic that handles other errors, through 'recover'.
2020-12-30 11:20:22 -03:00
Roberto Ierusalimschy
553b37ce4f
Do not insert nil values into tables
2020-12-29 13:38:47 -03:00
Roberto Ierusalimschy
4bd10b6fe8
Better error messages for calling non-callable objects
...
When available, use the calling code to find a suitable name for what
was being called; this is particularly useful for errors of non-callable
metamethods. This commit also improved the debug information for
order metamethods.
2020-12-29 13:15:54 -03:00
Roberto Ierusalimschy
59e565d955
No need to recheck close method before calling it
...
A to-be-closed variable is constant and it must have a close metamethod
when it is created. A program has to go out of its way (e.g., by
changing the variable's metamethod) to invalidate that check. So,
it is not worth to test that again. If the program tampers with the
metamethod, Lua will raise a regular error when attempting to call it.
2020-12-29 10:23:02 -03:00
Roberto Ierusalimschy
6188f3a654
Reset thread before panicking
...
Before panicking, it is simpler to reset the thread instead of closing
its variables and adjust the top manually.
2020-12-28 16:34:07 -03:00
Roberto Ierusalimschy
7af27ef59d
Cleaner handling of errors in '__close' metamethods
...
Instead of protecting each individual metamethod call, protect the
entire call to 'luaF_close'.
2020-12-28 11:40:30 -03:00
Roberto Ierusalimschy
0ceada8da9
Report last error in closing methods
...
When there are multiple errors around closing methods, report the
last error instead of the original.
2020-12-22 10:54:25 -03:00
Roberto Ierusalimschy
f9d29b0c44
Upvalues removed from 'openupval' before being closed
...
Undo commit c220b0a5d0 : '__close' is not called again in case of
errors. (Upvalue is removed from the list before the call.) The
common error that justified that change was C stack overflows, which
are much rarer with the stackless implementation.
2020-12-21 15:21:45 -03:00
Roberto Ierusalimschy
409256b784
'coroutine.close'/'lua_resetthread' report original errors
...
Besides errors in closing methods, 'coroutine.close' and
'lua_resetthread' also consider the original error that stopped the
thread, if any.
2020-12-18 11:22:42 -03:00
Roberto Ierusalimschy
b17178b27a
Cleaner handling of floats in pack/unpack
2020-12-16 11:23:51 -03:00
Roberto Ierusalimschy
e1ceea5674
Cleaner definition for macro 'ttisclosure'
2020-12-16 11:02:40 -03:00
Roberto Ierusalimschy
748d6d4e7a
Review of asserts in 'ltests.c'
...
The module 'ltests.c' must work correctly with asserts off, too.
2020-12-08 11:54:21 -03:00
Roberto Ierusalimschy
e2ea3b31c9
Details (do not affect regular code)
...
* Avoids multiple definitions of 'lua_assert' in test file.
* Smaller C-stack limit in test mode.
* Note in the manual about the use of false
* Extra test for constant reuse.
2020-12-07 11:17:30 -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
f15589f3b0
Added test cases for error messages about goto/label
2020-12-03 12:11:15 -03:00
Roberto Ierusalimschy
754ca0060f
n Windows, 'popen' accepts "[rw][bt]?" as valid modes
...
Added the modifiers 'b' and 't' to valid modes for 'popen' in Windows.
2020-12-03 12:09:50 -03:00
Roberto Ierusalimschy
c36ced53c9
Avoid "bad programming habits" in the reference system
...
References were using both 0 indices and nils as values in arrays.
Both do not fit in the concept of a sequence, which is the kind
of use that guides all Lua optimizations.
2020-12-03 12:00:32 -03:00
Roberto Ierusalimschy
d41c36bf67
'lua_assert' moved from 'lualib.h' to 'lauxlib.h'
...
The macro is useful also in 'lauxlib.c', which does not include
'lualib.h'. Also, the definition was corrected to be "on" when
LUAI_ASSERT is defined.
2020-12-03 10:39:38 -03:00
Roberto Ierusalimschy
d9d2904f09
Details
...
Names in the parser and other details that do not change actual code.
2020-12-02 15:13:13 -03:00
Roberto Ierusalimschy
65d2294454
Changed access to global table in the registry
...
The global table is always in the array part of the registry; we can
use this fact to make its access slightly more efficient.
2020-11-26 18:23:40 -03:00
Roberto Ierusalimschy
131e3fd814
Avoid using 'signal' when 'sigaction' is available
...
The semantics of 'signal' varies a lot among different implementations;
'sigaction' ensures a more consistent behavior.
2020-11-24 14:41:50 -03:00
Roberto Ierusalimschy
9d067ab73b
Optimization for 'n^2'
...
Squares are much more common than other exponentiations, and 'n*n' is
much more efficient than 'pow'.
2020-11-13 09:59:07 -03:00
Roberto Ierusalimschy
2f4162bc47
Compiler optimization back to '-O2'
...
Undo commit 6a10f03ff . Compiler performance is important, too.
2020-11-11 15:10:51 -03:00
Roberto Ierusalimschy
ab1aca94e8
Removed optimization for «if ... then goto»
...
That optimization was too complex and caused some weird traces when
debugging. The more common case «if ... then break» was kept.
2020-11-11 14:41:41 -03:00
Roberto Ierusalimschy
d282652561
Bug when growing a stack
...
When a stack grows, its extra area can be in use, and it becomes part
of the common area. So, the extra area must be kept correct all the
times. (Bug introduced by commit 5aa36e894f5.)
2020-11-08 11:52:26 -03:00
Roberto Ierusalimschy
58216600eb
'luaL_newstate' should not allocate extra memory
...
The allocation of a userdata for the state of the warn system can
cause a panic if it fails; 'luaL_ref' also can fail. This commit
re-implements the warn system so that it does not need an explicit
state. Instead, the system uses different functions to represent
the different states.
2020-11-03 16:34:36 -03:00
Roberto Ierusalimschy
94cbe46511
Details
...
- small corrections in the manual
- ldo.c: 'docall' -> 'ccall' ('docall' already used in 'lua.c')
- comments
2020-10-30 10:18:54 -03:00
Roberto Ierusalimschy
69b71a6919
_PROMPT can have non-string values
...
'get_prompt' uses 'luaL_tolstring' to convert _PROMPT or _PROMPT2
value to a string. That conversion may invoke a '__tostring'
metamethod.
2020-10-26 11:15:51 -03:00
Roberto Ierusalimschy
d742a193e5
Comments
2020-10-22 15:54:46 -03:00
Roberto Ierusalimschy
e4a38eb0e8
Fixed wrong trace of vararg functions
...
Trace of vararg functions was skipping an instruction when returning
from a call. (Bug introduced by commit 5d8ce05b3.)
2020-10-19 15:55:25 -03:00
Roberto Ierusalimschy
f07de22576
Fixed compiler option -DHARDSTACKTESTS to commit 5aa36e8
2020-10-19 15:43:59 -03:00
Roberto Ierusalimschy
52c8679760
Fixed bug of keys removed from tables vs 'next'
...
Fixed the bug that a key removed from a table might not be found
again by 'next'. (This is needed to allow keys to be removed during a
traversal.) This bug was introduced in commit 73ec04fc .
2020-10-14 15:46:58 -03:00
Roberto Ierusalimschy
849b2ecbd2
New release number (5.4.2)
2020-10-12 14:52:39 -03:00
Roberto Ierusalimschy
30528049f1
'lua_upvalueid' returns NULL on invalid upvalue index
2020-10-12 14:51:28 -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
c23cc86c54
Details
...
- After converting a generic GCObject to a specific type ('gco2*'),
avoid using the original GCObject (to reduce aliasing).
- Small corrections in comments in 'lopcodes.h'
- Added tests about who calls __close metamethods
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
171dcd7d74
'recover' finish of 'luaD_pcall' should follow the original
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
5aa36e894f
No more field 'lua_State.stacksize'
...
The stack size is derived from 'stack_last', when needed. Moreover,
the handling of stack sizes is more consistent, always excluding the
extra space except when allocating/deallocating the array.
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
9ecd446141
Avoid shrinking stacks to often
...
Shrink a stack only when the final stack size can be at most 2/3 the
previous size with half of its entries empty. This commit also
improves the clarity of 'luaD_growstack'.
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
fb172d0a92
No need for 'volatile' in string.pack/unpack
...
Type punning an address to 'char *' should be always safe.
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
0085db4596
Avoid GCs when testing stack overflow
...
A GC step may invoke some finalizer, which may error and emit
a warning due to stack overflfow.
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
490d42b5f8
Correct handling of 'luaV_execute' invocations
...
The previous stackless implementations marked all 'luaV_execute'
invocations as fresh. However, re-entering 'luaV_execute' when
resuming a coroutine should not be a fresh invocation. (It works
because 'unroll' called 'luaV_execute' for each call entry, but
it was slower than letting 'luaV_execute' finish all non-fresh
invocations.)
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
287b302acb
Revision of stackless implementation
...
- more organized handling of 'nCcalls'
- comments
- deprecation of 'setcstacklimit'
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
5d8ce05b3f
Back to a stackless implementation
...
A "with stack" implementation gains too little in performance to be
worth all the noise from C-stack overflows.
This commit is almost a sketch, to test performance. There are several
pending stuff:
- review control of C-stack overflow and error messages;
- what to do with setcstacklimit;
- review comments;
- review unroll of Lua calls.
2020-10-12 12:29:09 -03:00
Roberto Ierusalimschy
f83de8e34e
Wrong cast in 'str_unpack'
2020-09-30 15:10:12 -03:00
Roberto Ierusalimschy
9f791535cd
Merge branch 'master' of https://github.com/lua/lua
...
Adding file README.md to local repository.
2020-09-29 10:25:50 -03:00
lhf
51c29ec0c4
Create README.md
2020-09-28 14:34:44 +00:00
Roberto Ierusalimschy
fbaf040f5e
Details in the manual
2020-09-25 10:49:29 -03:00
Roberto Ierusalimschy
e51564d1be
Details in comments and documentation
2020-09-16 14:57:51 -03:00
Roberto Ierusalimschy
98ec799591
Detail
...
Code for multi-character tokens can start right after maximum char.
2020-09-15 14:29:52 -03:00
Roberto Ierusalimschy
b6888a158b
New release number (5.4.1)
2020-09-15 14:27:10 -03:00
Roberto Ierusalimschy
613513d09f
Better documentation for the GC of strings in the C API
...
Plus some other small changes.
2020-09-09 17:28:25 -03:00
Roberto Ierusalimschy
8496112a18
Better documentation for 'lctype.h'
...
The old documentation said that 'ltolower' only works for alphabetic
characters. However, 'l_str2d' uses it (correctly) also on dots ('.').
2020-09-03 09:52:43 -03:00
Roberto Ierusalimschy
6bc0f13505
Fixed bug of long strings in binary chunks
...
When "undumping" a long string, the function 'loadVector' can call the
reader function, which can run the garbage collector, which can collect
the string being read. So, the string must be anchored during the call
to 'loadVector'.
2020-08-18 14:42:11 -03:00
Roberto Ierusalimschy
8a89da07ba
Better control of gray objects
...
Avoid turning an object to gray except at the moment it is inserted in a
gray list or in the explicit exceptional cases such as open upvalues and
fixed strings.
2020-08-17 15:38:51 -03:00
Roberto Ierusalimschy
f849885a4b
Small changes in macros that change GC colors
...
- Macro 'gray2black' was renamed 'nw2black' (Non-White to black), as it
was already being used on objects that could be already black.
- Macros 'white2gray' and 'black2gray' were unified in 'set2gray'; no
reason to have two macros when one will do and, again, 'black2gray' was
already being used on objects that could be already gray.
Moreover, macros 'maskcolors' and 'maskgcbits' were negated to have
ones in the described bits, instead of zeros. (This naming seems more
intuitive.)
2020-08-13 15:23:21 -03:00
Roberto Ierusalimschy
f7ce7e5faa
TOUCHED2 objects are not always black
...
This commit fixes a bug introduced in commit 9cf3299fa . TOUCHED2
objects are always black while the mutator runs, but they can become
temporarily gray inside a minor collection (e.g., if the object is a
weak table).
2020-08-13 14:31:27 -03:00
Roberto Ierusalimschy
65141832d2
Open upvalues should be gray when entering gen. mode
...
Open upvalues are never black; so, when entering generational mode,
they must be colored gray, not black.
2020-08-07 14:53:38 -03:00
Roberto Ierusalimschy
f13dc59416
Better tests for gray lists
...
Test uses an extra bit in 'marked' to mark all elements in gray lists
and then check against elements colored gray.
2020-08-07 14:45:20 -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
68109afcdb
Detail (in asserts)
...
Macro 'checkconsistency' replaced by the similar 'checkliveness".
2020-08-03 16:05:10 -03:00
Roberto Ierusalimschy
9cf3299faf
Threads don't need to always go to 'grayagain'
...
In incremental mode, threads don't need to be visited again once
visited in the atomic phase. In generational mode (where all visits
are in the atomic phase), only old threads need to be kept in the
'grayagain' list for the next cycle.
2020-08-03 14:28:13 -03:00
Roberto Ierusalimschy
b9b554e0f6
Clearer handling of gray lists when entering generational mode
...
When entering generational mode, all objects are old. So, the only
objects that need to be in a gray list are threads, which can be
assigned without barriers. Changes in anything else (e.g., weak
tables) will trigger barriers that, if needed, will add the object
to a gray list.
2020-08-03 13:22:57 -03:00
Roberto Ierusalimschy
0dc5deca1c
Optimization in 'markold'
...
OLD1 objects can be potentially anywhere in the 'allgc' list (up
to 'reallyold'), but frequently they are all after 'old1' (natural
evolution of survivals) or do not exist at all (when all objects die
young). So, instead of 'markold' starts looking for them always
from the start of 'allgc', the collector keeps an extra pointer,
'firstold1', that points to the first OLD1 object in the 'allgc' list,
or is NULL if there are no OLD1 objects in that list.
2020-07-29 17:05:47 -03:00
Roberto Ierusalimschy
b4c353434f
Details
...
The fields 'old' and 'finobjold' were renamed 'old1' and 'finobjold1',
respectively, to make clearer the main ages of their elements.
2020-07-29 11:34:08 -03:00
Roberto Ierusalimschy
71f70df327
OLD1 ages advanced by 'markold'
...
Objects aged OLD1 have their ages advanced by 'markold', which has to
visit them anyway. So, the GC doesn't need to "sweep" the old1 list.
2020-07-29 09:58:25 -03:00
Roberto Ierusalimschy
663f83f647
Same changes around 'correctgraylist'
...
Instead of adding all tables and userdata back to the 'grayagain' list
to be checked by 'correctgraylist', the collector adds only the objects
that will remain in that list (objects aged TOUCHED1). This commit
also rewrites 'correctgraylist' with a clearer logic.
2020-07-28 15:51:07 -03:00
Roberto Ierusalimschy
ae5b5ba529
Fixed bug: line hooks in stripped functions
...
Line-hook handling was accessing debug info. without checking whether
it was present.
2020-07-27 13:23:05 -03:00
Roberto Ierusalimschy
a585eae6e7
Fixed bug: Negation overflow in getlocal/setlocal
2020-07-27 12:01:38 -03:00
Roberto Ierusalimschy
d2c2e32e8a
All objects are kept 'new' in incremental GC
...
Small changes to ensure that all objects are kept 'new' in incremental
GC (except for fixed strings, which are always old) and to make that
fact clearer.
2020-07-27 11:39:42 -03:00
Roberto Ierusalimschy
8c7c9ea065
Function 'printobj' in 'ltests.c' made public
...
It helps to have this function available for debugging.
2020-07-27 11:24:03 -03:00
Roberto Ierusalimschy
a6da1472c0
Fixed bug: barriers cannot be active during sweep
...
Barriers cannot be active during sweep, even in generational mode.
(Although gen. mode is not incremental, it can hit a barrier when
deleting a thread and closing its upvalues.) The colors of objects are
being changed during sweep and, therefore, cannot be trusted.
2020-07-27 10:26:20 -03:00
Roberto Ierusalimschy
34affe7a63
Fixed bug: 'luaD_callnoyield' called twice in a row
...
In luaD_callnoyield, when there is a possible stack overflow, it
zeros the number of CallInfos to force a check when calling the
function. However, if the "function" is not a function, the code will
raise an error before checking the stack. Then, the error handling calls
luaD_callnoyield again and nCcalls is decremented again, crossing the
stack redzone without raising an error. (This loop can only happens
once, because the error handler must be a function. But once is enough
to cross the redzone.)
2020-07-17 14:54:26 -03:00
Roberto Ierusalimschy
a2195644d8
Fixed bug: invalid 'oldpc' when returning to a function
...
The field 'L->oldpc' is not always updated when control returns to a
function; an invalid value can seg. fault when computing 'changedline'.
(One example is an error in a finalizer; control can return to
'luaV_execute' without executing 'luaD_poscall'.) Instead of trying to
fix all possible corner cases, it seems safer to be resilient to invalid
values for 'oldpc'. Valid but wrong values at most cause an extra call
to a line hook.
2020-07-17 11:01:05 -03:00
Roberto Ierusalimschy
1ecfbfa1a1
Fixed bug: invalid mode can crash 'io.popen'
2020-07-15 16:01:03 -03:00
Roberto Ierusalimschy
e1d8770f12
Fixed bug: wrong stack limit when entering a coroutine
...
When entering a coroutine, the computation of nCcalls added 'from->nci'
to correct for preallocated CallInfos, but 'nci' includes also the
Callinfos already used.
2020-07-13 13:39:02 -03:00
Roberto Ierusalimschy
0f1cd0eba9
Added test for fix 127e7a6c89
2020-07-13 13:37:01 -03:00
Roberto Ierusalimschy
127e7a6c89
Fixed bug of old finalized objects in the GC
...
When an object aged OLD1 is finalized, it is moved from the list
'finobj' to the *beginning* of the list 'allgc'. So, this part of the
list (and not only the survival list) must be visited by 'markold'.
2020-07-10 14:13:50 -03:00
Roberto Ierusalimschy
6f5bd5072d
Macro LUAI_ASSERT eases turning assertions on
2020-07-08 15:51:55 -03:00
Roberto Ierusalimschy
56ec432281
Change in macro HARDMEMTESTS for testing GC
...
Macro HARDMEMTESTS broke in two: HARDMEMTESTS forces a full GC cycle
at every point where the GC can run. New macro EMERGENCYGCTESTS
forces an emergency collection at every memory allocation.
2020-07-08 15:36:48 -03:00
Roberto Ierusalimschy
31b8c2d438
Fixed bug of access violation in finalizers
...
Errors in finalizers need a valid 'pc' to produce an error message,
even if the error is not propagated. Therefore, calls to the GC (which
may call finalizers) inside luaV_execute must save the 'pc'.
2020-07-08 12:02:56 -03:00
Roberto Ierusalimschy
eb41999461
Fixed bugs of stack reallocation x GC
...
Macro 'checkstackGC' was doing a GC step after resizing the stack;
the GC could shrink the stack and undo the resize. Moreover, macro
'checkstackp' also does a GC step, which could remove the preallocated
CallInfo when calling a function. (Its name has been changed to
'checkstackGCp' to emphasize that it calls the GC.)
2020-07-07 18:03:48 -03:00
Roberto Ierusalimschy
314c6057b7
Avoid any code before locks in the API
...
For consistency in the C API, avoid any initializations before
callling lua_lock.
2020-07-06 14:06:47 -03:00
Roberto Ierusalimschy
d39ea8b3ce
Make sure that main thread is non yieldable
...
Main thread must be non yieldable even at "level 0" (bare API), outside
the 'pcall' from 'lua.c'.
2020-07-06 13:54:01 -03:00
Roberto Ierusalimschy
6298903e35
Keep minimum size when shrinking a stack
...
When shrinking a stack (during GC), do not make it smaller than the
initial stack size.
2020-07-06 12:11:54 -03:00
Roberto Ierusalimschy
b57574d6fb
Keep memory errors as memory errors
...
Allow memory errors to be raised through the API (throwing the
error with the memory error message); error in external allocations
raises a memory error; memory errors in coroutines are re-raised
as memory errors.
2020-07-06 12:09:44 -03:00
Roberto Ierusalimschy
bfcf06d91a
Avoid memory allocation in some functions from 'ltests.c'
...
To allow their use in memory tests, some functions in 'ltests.c'
should never allocate memory. To avoid this allocation, the
library registers the strings used for status codes, and keeps
the variable '_WARN' always defined (with false instead of nil).
2020-07-04 16:40:18 -03:00
Roberto Ierusalimschy
0280407fc5
Details
...
Comments in makefile and function 'l_str2d'.
2020-07-03 13:02:41 -03:00
Roberto Ierusalimschy
ae809e9fd1
'luaV_concat' can "concat" one single value
...
Several of its callers needed that case and had to do the check
themselves.
2020-07-03 11:54:58 -03:00
Roberto Ierusalimschy
e96385aded
Simplification and smaller buffers for 'lua_pushfstring'
...
The function 'lua_pushfstring' is seldom called with large strings,
there is no need to optimize too much for that cases.
2020-07-03 11:36:56 -03:00
Roberto Ierusalimschy
56a165bf0f
Added '.gitignore' to the repository
2020-07-02 16:55:23 -03:00
Roberto Ierusalimschy
422ce50d2e
Fixed detail in 'loadUpvalues'
...
In 'lundump.c', when loading the upvalues of a function, there can be
a read error if the chunk is truncated. In that case, the creation
of the error message can trigger an emergency collection while the
prototype is still anchored. So, the prototype must be GC consistent
before loading the upvales, which implies that it the 'name' fields
must be filled with NULL before the reading.
2020-06-30 15:36:26 -03:00
Roberto Ierusalimschy
c33b1728ae
Details
...
Added as incompatibility, in the manual, the extra return of 'io.lines'.
2020-06-18 11:07:27 -03:00
Roberto Ierusalimschy
a304199836
Detail in 'lua_resetthread'
...
'lua_resetthread' should reset the CallInfo list before calling
'luaF_close'. luaF_close can call functions, and those functions
should not run with dead functions still in the CallInfo list.
2020-06-17 10:36:42 -03:00
Roberto Ierusalimschy
6d7cd31fee
Fixed missing GC barriers in compiler and undump
...
While building a new prototype, the GC needs barriers for every object
(strings and nested prototypes) that is attached to the new prototype.
2020-06-16 09:54:20 -03:00
Roberto Ierusalimschy
993c58fde3
In 'lua_checkmemory', userdata can be gray, too
...
Since commit ca6fe7449a , userdata with uservalues can be gray
and can belong to gray lists ('gclist').
2020-06-15 12:01:36 -03:00
Roberto Ierusalimschy
d49b288728
'luaE_shrinkCI' shouldn't remove first free CallInfo
...
Due to emergency collections, 'luaE_shrinkCI' can be called while Lua
is building a new CallInfo, which for a while is still a free CallInfo.
2020-06-15 11:58:59 -03:00
Roberto Ierusalimschy
69e84805e4
Details
2020-06-10 16:39:37 -03:00
Roberto Ierusalimschy
364e569945
Avoid calling 'fprintf' with NULL
...
Avoid undefined behavior in calls like «fprintf("%s", NULL)».
('lua_writestringerror' is implemented as 'fprintf', and 'lua_tostring'
can return NULL if object is not a string.)
2020-06-09 16:12:01 -03:00
Roberto Ierusalimschy
63295f1f7f
Fixed two bugs in to-be-closed variables x constants
...
The parser were mixing compiler indices of variables with stack indices,
so that when a to-be-closed variable was used inside the scope of
compile-time constants (which may be optimized away), it might be closed
in the wrong place. (See new tests for examples.)
Besides fixing the bugs, this commit also changed comments and variable
names to avoid that kind of confusion and added tests.
2020-06-01 15:07:58 -03:00
Roberto Ierusalimschy
50523b107d
Improvements in the manual
...
- more consistent nomenclature for error handling
- more precise definition for dead objects
- added algorithm used by 'math.random'
- added luaL_pushfail
- some other minor changes
2020-05-29 10:41:32 -03:00
Roberto Ierusalimschy
aa8d4a782d
Details (more uniformity in error messages)
2020-05-27 11:46:47 -03:00
Roberto Ierusalimschy
efcf24be0c
'luaL_execresult' does not assume -1 status as error
...
ISO C is silent about the return of 'system'. Windows sets 'errno' in
case of errors. Linux has several different error cases, with different
return values. ISO C allows 'system' to set 'errno' even if there are no
errors. Here we assume that a status==0 is success (which is the case
on several platforms), otherwise it is an error. If there is an error
number, gives the error based on it. (The worst a spurious 'errno'
can do is to generate a bad error message.) Otherwise uses the normal
results.
2020-05-22 15:39:29 -03:00
Roberto Ierusalimschy
17dbaa8639
Improvements in the handling of signals
...
Added 'volatile' to 'l_signalT' variables plus some minor changes.
2020-05-22 11:40:34 -03:00
Roberto Ierusalimschy
9514abc2da
Cleaner definition for 'TString'
...
Use a variable-sized array to store string contents at the end of a
structure 'TString', instead of raw memory.
2020-05-19 12:42:20 -03:00
Roberto Ierusalimschy
0be57b9b6d
Details in comments
2020-05-07 14:52:19 -03:00
Roberto Ierusalimschy
61a4e64a66
Back to old encoding of versions in binary files
...
(Undoing part of commit f53eabeed8.) It is better to keep this encoding
stable, so that all Lua versions can read at least the version of a
binary file.
2020-05-06 14:19:08 -03:00
Roberto Ierusalimschy
9a6f47f0ed
C-Stack test does not assume minimum of 400 slots
2020-05-04 14:17:15 -03:00
Roberto Ierusalimschy
948fb628d9
Details
...
When in test mode (#include "tests.h"), force Lua to use its own
implementation of 'lua_strx2number' and 'lua_number2strx' to test them.
2020-04-30 17:29:27 -03:00
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
Roberto Ierusalimschy
b98d41db99
Script 'packtests' gets Lua version as a parameter
2019-10-02 17:04:06 -03:00
Roberto Ierusalimschy
b2a580bdb1
Janitorial work
...
- Several details in 'lcode.c'
- A few more tests for code generation
- Bug in assert in 'lcode.c' ("=" x "==")
- Comments in 'lopcodes.h' and 'ltable.c'
2019-10-01 17:24:37 -03:00
Roberto Ierusalimschy
89f6a85f03
Details in the makefile (warning options)
2019-09-24 14:43:32 -03:00
Roberto Ierusalimschy
6ef366644f
Subtraction of small constant integers optimized with OP_ADDI
2019-09-24 14:34:52 -03:00
Roberto Ierusalimschy
03cde80b58
'setCstacklimit' renamed to 'setcstacklimit'
...
Function names in the API use only lowercase letters.
2019-09-24 14:31:06 -03:00
Roberto Ierusalimschy
6b2e202df5
Janitorial work in 'lcode.c'
2019-09-19 14:29:21 -03:00
Roberto Ierusalimschy
40d8832ee0
Simplification in the call to 'constfolding'
2019-09-11 10:20:10 -03:00
Roberto Ierusalimschy
91dad09f65
Removed arithmetic opcodes with immediate operand
...
The difference in performance between immediate operands and K operands
does not seem to justify all those extra opcodes. We only keep OP_ADDI,
due to its ubiquity and because the difference is a little more relevant.
(Later, OP_SUBI will be implemented by OP_ADDI, negating the constant.)
2019-09-10 13:20:03 -03:00
Roberto Ierusalimschy
4518e5df24
Added macro 'testMMMode'
...
Macro 'testMMMode' checks whether opcode is an MM opcode.
2019-09-06 14:14:11 -03:00
Roberto Ierusalimschy
72a094bda7
Undo change in the handling of 'L->top' (commit b80077b8f3)
...
With MMBIN instructions, there are fewer opcodes that need to update
'L->top', so that change does not seem to pay for the increased
complexity.
2019-08-29 12:52:37 -03:00
Roberto Ierusalimschy
46b84580d6
Use of 'MMBIN' opcodes extended to shift operators
...
Plus, this commit removes useless 'tm' parameters in 'op_*' macros.
2019-08-28 09:58:03 -03:00
Roberto Ierusalimschy
df13f25948
First version of OP_MMBIN opcodes
...
In arithmetic/bitwise operators, the call to metamethods is made
in a separate opcode following the main one. (The main
opcode skips this next one when the operation succeeds.) This
change reduces slightly the size of the binary and the complexity
of the arithmetic/bitwise opcodes. It also simplfies the treatment
of errors and yeld/resume in these operations, as there are much
fewer cases to consider. (Only OP_MMBIN/OP_MMBINI/OP_MMBINK,
instead of all variants of all arithmetic/bitwise operators.)
2019-08-27 13:59:39 -03:00
Roberto Ierusalimschy
643188d6e5
Fixed missing case in 'luaV_finishOp'
...
A metamethod call like '1 << a' was not being properly resumed
if it got yielded.
2019-08-27 10:28:09 -03:00
Roberto Ierusalimschy
3df5624ff4
Fixed bug when yiedling inside OP_ADDK opcode
...
The family of opcodes OP_ADDK (arithmetic operators with K constant)
were not being handled in 'luaV_finishOp', which completes their
task after an yield.
2019-08-21 12:19:47 -03:00
Roberto Ierusalimschy
be78aeae4c
Default for warnings changed to "off"
...
Warnings are mostly a tool to help developers (e.g., by showing hidden
error messages); regular users usually don't need to see them.
2019-08-20 13:42:26 -03:00
Roberto Ierusalimschy
5bc47fe830
Detail (extra test for warnings when closing state)
2019-08-19 14:41:48 -03:00
Roberto Ierusalimschy
9405472565
Improvement in warn-mode '@store' (for testing)
...
When using warn-mode '@store', from the test library, the tests ensure
not only that the expected warnings were issued, but also that there was
no extra warnings.
2019-08-18 17:29:46 -03:00
Roberto Ierusalimschy
45948e7e55
Manual corrected with the new syntax for attributes
...
Commit 0d52913804 , with the change in the syntax of attributes,
did not update the manual accordingly.
2019-08-16 16:11:21 -03:00
Roberto Ierusalimschy
b96b0b5abb
Added macro 'luaL_pushfail'
...
The macro 'luaL_pushfail' documents all places in the standard libraries
that return nil to signal some kind of failure. It is defined as
'lua_pushnil'. The manual also got a notation (@fail) to document those
returns. The tests were changed to be agnostic regarding whether 'fail'
is 'nil' or 'false'.
2019-08-16 14:58:02 -03:00
Roberto Ierusalimschy
ca13be9af7
Supressed errors in '__close' generate warnings
2019-08-16 09:51:54 -03:00
Roberto Ierusalimschy
a1d8eb2743
Added control messages to warnings
...
Added the concept of control messages to the warning system, plus the
implementation of the controls "@on"/"@off" to turn warnings on/off.
Moreover, the warning system in the test library adds some other
controls to ease the test of warnings.
2019-08-15 13:44:36 -03:00
Roberto Ierusalimschy
f64a1b175a
Small optimization in 'convergeephemerons'
...
When converging marks on ephemeron tables, change the direction the
tables are traversed at each iteration, to try to avoid bad-case
scenarios with linked lists of entries in a table.
2019-08-12 15:32:44 -03:00
Roberto Ierusalimschy
09b4e527a0
Detail in the manual (method 'file:setvbuf')
...
ANSI C is vague about 'setvbuf'; most details are implementation
defined. So, the manual cannot give any guaranties, either.
2019-08-12 11:26:08 -03:00
Roberto Ierusalimschy
35a28a58b3
Details
...
- removed rule about RCS from makefile
- comments and nitpicking in 'llex.c'
2019-08-01 14:11:33 -03:00
Roberto Ierusalimschy
223bb04090
Correction in the documentation of 'io.lines'
...
The loop does not end on end of file, but when the iterator function
fails to read a value. (In particular, the format "a" never fails,
so a loop with 'io.lines(fname, "a")' never ends.)
2019-07-31 11:41:59 -03:00
Roberto Ierusalimschy
fe040633a1
Tracebacks recognize metamethods '__close'
2019-07-31 11:22:39 -03:00
Roberto Ierusalimschy
f645d31573
To-be-closed variables must be closed on initialization
...
When initializing a to-be-closed variable, check whether it has a
'__close' metamethod (or is a false value) and raise an error if
if it hasn't. This produces more accurate error messages. (The
check before closing still need to be done: in the C API, the value
is not constant; and the object may lose its '__close' metamethod
during the block.)
2019-07-31 10:43:51 -03:00
Roberto Ierusalimschy
35b4efc270
Fixed test in 'main.lua'
...
The test "to-be-closed variables in main chunk" was broken,
as it used the removed feature of functions as to-be-closed values.
The error was not detected because its expected result had no lines
to be checked (due to missing new lines).
2019-07-30 13:48:40 -03:00
Roberto Ierusalimschy
0d52913804
Change in the syntax of attributes
...
Attributes changed to posfixed ('x <const>', instead of '<const> x'),
and "toclose" renamed to "close". Posfixed attributes seem to make it
clearer that it applies to only one variable when there are multiple
variables.
2019-07-30 12:18:19 -03:00
Roberto Ierusalimschy
b80077b8f3
Change in the handling of 'L->top' when calling metamethods
...
Instead of updating 'L->top' in every place that may call a
metamethod, the metamethod functions themselves (luaT_trybinTM and
luaT_callorderTM) correct the top. (When calling metamethods from
the C API, however, the callers must preserve 'L->top'.)
2019-07-26 14:59:39 -03:00
Roberto Ierusalimschy
e70f275f32
Bug: 'Vardesc' array can be reallocated in 'localstat'
...
A reference to a 'Vardesc*' (as done by 'localstat') can be
invalidated by the creation of any new variable.
2019-07-26 13:27:43 -03:00
Roberto Ierusalimschy
9a37dc0ce6
Small corrections when setting 'L->top'
...
- OP_NEWTABLE can use 'ra + 1' to set top (instead of ci->top);
- OP_CLOSE doesn't need to set top ('Protect' already does that);
- OP_TFORCALL must use 'ProtectNT', to preserve the top already set.
(That was a small bug, because iterators could be called with
extra parameters besides the state and the control variable.)
- Comments and an extra test for the bug in previous item.
2019-07-25 13:55:29 -03:00
Roberto Ierusalimschy
0eb6aa4013
Some improvements in date/time functions
...
- Range in date table extended to full 32 bits.
- Easier support for times represented as floats.
- Added more tests.
2019-07-24 15:01:59 -03:00
Roberto Ierusalimschy
7f5c31cdca
Fixed bug in 'string.format' with option '%f'
...
As an example, 'print(string.format("%.99f", 1e70))' may have a
lot of garbage after the number.
The old test to ensure that 'string.format("%.99f", n)' was not too
large, 'fabs(n) < 1e100', assumes that the number will fit in the 99
bytes; but the 99 is not the space for the number, it is the added
extra zeros. The option worked for smaller numbers because of the
extra space added to MAX_ITEM.
2019-07-23 12:46:33 -03:00
Roberto Ierusalimschy
9e6807c3c9
Do not collect open upvalues
...
Open upvalues are kept alive together with their corresponding
stack. This change makes a simpler and safer fix to the issue in
commit 440a5ee78c , about upvalues in the list of open upvalues
being collected while others are being created. (That previous fix
may not be correct.)
2019-07-22 09:41:10 -03:00
Roberto Ierusalimschy
2f22c6bb79
'math.randomseed' always returns the two seed components
2019-07-19 13:31:53 -03:00
Roberto Ierusalimschy
3c0d3c6fbe
Avoid using addresses of static variables as unique keys
...
The addresses of static variables may be different for different
instances of Lua, making these instances incompatible if they use
these addresses as unique keys in the registry (or other tables).
2019-07-19 13:14:06 -03:00
Roberto Ierusalimschy
440a5ee78c
Fixed bug for emergency collection in upvalue creation
...
When creating an upvalue, an emergency collection can collect the
previous upvalue where the new one would be linked. The following
code can trigger the bug, using valgrind on Lua compiled with the
-DHARDMEMTESTS option:
local x; local y
(function () return y end)();
(function () return x end)()
2019-07-19 12:13:00 -03:00
Roberto Ierusalimschy
dc07719b0d
Tag LUA_TUPVALTBC replaced by a flag
...
It is simpler to signal a to-be-closed upvalue with a boolean flag,
instead of using a different tag.
2019-07-19 11:12:31 -03:00
Roberto Ierusalimschy
9cdf6b7082
Some details in 'lmem.c' and 'lgc.c'
...
- Several new comments in 'lmem.c'.
- Both 'luaM_growaux_' and 'luaM_shrinkvector_' use 'luaM_saferealloc_'
to check for errors. Moreover, the use of 'luaM_saferealloc_' makes
'luaM_shrinkvector_' try again if shrink fails (which can happen now).
- In 'checkSizes', save old debt only when needed.
2019-07-19 09:43:35 -03:00
Roberto Ierusalimschy
3c1d415bd3
Details
...
- Macro 'checkliveness' (for debug) always uses 'L', to avoid warnings.
- Some old 'while' changed to 'for' in 'testes/gc.lua'.
- In 'testes/libs/makefile', do not make files depend on 'ltests.h',
which may not even exist.
2019-07-18 15:31:22 -03:00
Roberto Ierusalimschy
d36a31e673
Reviving HARDMEMTESTS
...
This commit brings a new implementation for HARDMEMTESTS, which forces
an emergency GC whenever possible. It also fixes some issues detected
with this option:
- A small bug in lvm.c: a closure could be collected by an emergency
GC while being initialized.
- Some tests: a memory address can be immediatly reused after a GC;
for instance, two consecutive '{}' expressions can return exactly the
same address, if the first one is not anchored.
2019-07-18 14:58:15 -03:00
Roberto Ierusalimschy
024a6071ca
Small bug with stack reallocation
...
OP_RETURN must update trap before updating stack. (Bug detected with
-DHARDSTACKTESTS). Also, in 'luaF_close', do not create a variable
with 'uplevel(uv)', as the stack may change and invalidate this
value. (This is not a bug, but could become one if 'upl' was used
again.)
2019-07-18 11:26:03 -03:00
Roberto Ierusalimschy
4eefef07ab
'math.randomseed()' returns the seeds it used
...
A call to 'math.randomseed()' returns the two components of the seed
it set, so that they can be used to set that same seed again.
2019-07-17 16:00:24 -03:00
Roberto Ierusalimschy
9c28ed05c9
Calls 'luaF_close' in 'lua_settop' only when needed
...
In 'lua_settop', avoid calling 'luaF_close' when increasing the stack
or when the function has no to-be-closed variables.
2019-07-17 15:22:11 -03:00
Roberto Ierusalimschy
8082906c05
Fixed small issue with constant propagation
...
Constants directly assigned to other constants were not propagating:
For instance, in
local <const> k1 = 10
local <const> k2 = k1
'k2' were not treated as a compile-time constant.
2019-07-17 14:50:42 -03:00
Roberto Ierusalimschy
d6af81084d
New kind of expression VKSTR
...
String literal expressions have their own kind VKSTR, instead of the
generic VK. This allows strings to "cross" functions without entering
their constant tables (e.g., if they are used only by some nested
function).
2019-07-17 14:26:56 -03:00
Roberto Ierusalimschy
4846f7e3bb
Micro optimization in OP_RETURN and OP_TAILCALL
...
Many functions are vararg but create no upvalues, so it is better
to separate the tests for these two kinds of "extra work".
2019-07-16 15:44:37 -03:00
Roberto Ierusalimschy
c220b0a5d0
'__close' method may be called again in case of error
...
An error in a closing method may be caused by a lack of resources,
such as memory or stack space, and the error may free enough resources
(by unwinding the stack) to allow the method to work if called again.
If the closing method is already running after some error (including
its own), it is not called again.
2019-07-16 15:17:47 -03:00
Roberto Ierusalimschy
298f383ffc
Avoid setting the stack top below upvalues to be closed
...
When leaving a scope, the new stack top should be set only after
closing any upvalue, to avoid manipulating values in an "invalid"
part of the stack.
2019-07-16 14:13:22 -03:00
Roberto Ierusalimschy
758c1ef445
Unification of size representation in OP_NEWTABLE and OP_SETLIST
...
Opcodes OP_NEWTABLE and OP_SETLIST use the same representation to
store the size of the array part of a table. This new representation
can go up to 2^33 (8 + 25 bits).
2019-07-15 14:59:35 -03:00
Roberto Ierusalimschy
dd6d8db49a
Reordering of instructions in the main loop
...
The instructions in the main interpreter loop were reordered to
the same order of their enumeration in 'lopcodes.h'.
2019-07-12 16:47:02 -03:00
Roberto Ierusalimschy
1fb4d53925
OP_NEWTABLE keeps exact size of arrays
...
OP_NEWTABLE is followed by an OP_EXTRAARG, so that it can keep
the exact size of the array part of the table to be created.
(Functions 'luaO_int2fb'/'luaO_fb2int' were removed.)
2019-07-12 16:13:50 -03:00
Roberto Ierusalimschy
f6aab3ec1f
First implementation of constant propagation
...
Local constant variables initialized with compile-time constants
are optimized away from the code.
2019-07-12 11:38:42 -03:00
Roberto Ierusalimschy
be8445d7e4
Details
...
In the generic for loop, it is simpler for OP_TFORLOOP to use the
same 'ra' as OP_TFORCALL. Moreover, the internal names of the loop
temporaries "(for ...)" don't need to leak internal details (even
because the numerical for loop doesn't have a fixed role for each of
its temporaries).
2019-07-10 14:58:31 -03:00
Roberto Ierusalimschy
3d296304ef
Towards constant propagation
...
This commit detaches the number of active variables from the
number of variables in the stack, during compilation. Soon,
compile-time constants will be propagated and therefore will
not exist during run time (in the stack).
2019-07-10 14:00:22 -03:00
Roberto Ierusalimschy
54f7b46c1e
New implementation for constants
...
VLOCAL expressions keep a reference to their corresponding 'Vardesc',
and 'Upvaldesc' (for upvalues) has a field 'ro' (read-only). So, it is
easier to check whether a variable is read-only. The decoupling in
VLOCAL between 'vidx' ('Vardesc' index) and 'sidx' (stack index)
should also help the forthcoming implementation of compile-time
constant propagation.
2019-07-09 10:43:17 -03:00
Roberto Ierusalimschy
e888976bc6
Details (typos in comments)
2019-07-05 15:03:15 -03:00
Roberto Ierusalimschy
4d46289331
Local attributes can be used in list of local variables
...
The syntax for local attributes ('const'/'toclose') was unified with
the regular syntax for local variables, so that we can have variables
with attributes in local definitions with multiple names; for instance:
local <toclose> f, <const> err = io.open(fname)
This new syntax does not implement constant propagation, yet.
This commit also has some small improvements to the manual.
2019-07-03 14:18:07 -03:00
Roberto Ierusalimschy
8eca21c2e8
First take on constant propagation
2019-07-01 12:42:31 -03:00
Roberto Ierusalimschy
924bed7297
Methods separated from metamethods in 'io'
...
In the 'io' library, changed the use of the metatable also as its
own "method table", so that metamethods cannot be accessed as if they
were methods. (For instance, 'io.stdin.__gc' does not result in
the finalizer metamethod anymore.)
2019-07-01 12:25:00 -03:00
Roberto Ierusalimschy
8b7cfee26b
Small changes around C-stack limit
...
- Better documentation in 'testes/cstack.lua' about using
'debug.setCstacklimit' to find a good limit.
- Constant LUAI_MAXCSTACK gets added CSTACKERR (extra stack for
error handling), so that it is compatible with the argument to
'debug.setCstacklimit'.
2019-06-26 13:26:36 -03:00
Roberto Ierusalimschy
c1a63c45f8
'__call' metamethod can be any callable object
...
Removed the restriction that a '__call' metamethod must be an actual
function.
2019-06-25 17:45:50 -03:00
Roberto Ierusalimschy
4487c28ced
A few more tests for table access in the API
...
Added tests where the table being accessed is also the index or
value in the operation.
2019-06-25 17:38:58 -03:00
Roberto Ierusalimschy
05ba288049
Added script 'packtests' to the project
...
The script 'packtests' creates the 'tar.gz' to deploy the test suite
for Lua.
2019-06-21 10:46:41 -03:00
Roberto Ierusalimschy
6b9490bd72
Details in tests
...
- Added a test for calling 'debug.traceback' after yields inside
hooks. (Lua 5.3 seems to have a bug there.)
- Removed test "repeat test with '__open' metamethod instead of a
function", as the previous test already uses the '__open' metamethod.
(It changed when functions were removed as possible to-be-closed
variables).
2019-06-21 10:21:07 -03:00
Roberto Ierusalimschy
e4b02ca8e4
Structure 'Vardesc' does not need a 'name' field
...
Removed the field 'name' from the structure 'Vardesc', as the name
of the local variable is already available in the prototype of the
function, through the index 'idx'.
2019-06-21 10:16:57 -03:00
Roberto Ierusalimschy
20a9853e02
Cleaning macros in 'luaV_execute'
...
Ensure that operation macros, such as 'luai_numdiv' and 'luai_numidiv',
operate only on variables, or at most at 's2v(ra)'. ('s2v' is a nop, a
cast from pointer to pointer.)
2019-06-21 10:00:50 -03:00
Roberto Ierusalimschy
1d70708a78
Fixed bug [5.4 alpha] for errors in finalizers
...
Fixes the bug related in [1] (Lua can crash after raising an error
in a finalizer), following the lead in [2].
[1] http://lua-users.org/lists/lua-l/2019-06/msg00448.html
[2] http://lua-users.org/lists/lua-l/2019-06/msg00450.html
2019-06-21 09:34:49 -03:00
Roberto Ierusalimschy
be73f72fcc
New function 'setCstacklimit'
...
Added new functions to dynamically set the C-stack limit
('lua_setCstacklimit' in the C-API, 'debug.setCstacklimit' in Lua).
2019-06-18 16:52:22 -03:00
Roberto Ierusalimschy
3cd9b56ae6
Revamp around 'L->nCcalls' count
...
The field 'L->nCcalls' now counts downwards, so that the C-stack
limits do not depend on the stack size.
2019-06-12 10:31:38 -03:00
Roberto Ierusalimschy
d2a9b4ffb8
Detail in the manual
...
More precision describing the variables that won't be closed if a
coroutine yields forever.
2019-06-10 13:59:19 -03:00
Roberto Ierusalimschy
f39e8c06d6
Updated the documentation for the API function 'lua_gc'
2019-06-06 12:51:41 -03:00
Roberto Ierusalimschy
6aeaeb5656
Detail in makefile
2019-06-05 13:21:16 -03:00
Roberto Ierusalimschy
b4d5dff8ec
Multiple errors in '__toclose' report the first one
...
When there are multiple errors when closing objects, the error
reported by the protected call is the first one, for two reasons:
First, other errors may be caused by this one;
second, the first error is handled in the original execution context,
and therefore has the full traceback.
2019-06-05 13:16:25 -03:00
Roberto Ierusalimschy
14edd364c3
Function 'warn' is vararg
...
Instead of a 'tocont' flag, the function 'warn' in Lua now receives all
message pieces as multiple arguments in a single call. Besides being
simpler to use, this implementation ensures that Lua code cannot create
unfinished warnings.
2019-06-04 11:22:21 -03:00
Roberto Ierusalimschy
514d942748
'coroutine.kill' renamed 'coroutine.close'
2019-06-03 13:11:20 -03:00
Roberto Ierusalimschy
4a3fd8488d
bug in 5.4 alpha rc1: to-be-closed x vararg functions
...
Closing methods must be run before correcting 'ci->func' when exiting
a vararg function, to get correct debug information (e.g., in case of
errors).
2019-06-03 12:13:13 -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
7d0f41df41
Improvements in 'testes/cstack.lua'
...
- tests show progress in real time, so that we can see maximum
stack levels even if test crashes.
- new test for recursion continuing into message handler.
2019-06-03 11:34:32 -03:00
Roberto Ierusalimschy
2b8b53864c
Improvements in 'luaL_traceback'
...
'luaL_traceback' changed to use an aux buffer instead of concats.
This should reduce the quantity of garbage it generates (in the
form of intermediate strings) while producing a trackback.
It also added information about the number of levels skipped when
skipping levels in a trace.
2019-05-28 15:50:40 -03:00
Roberto Ierusalimschy
b293ae0577
Details
...
- new error message for "attempt to assign to const variable"
- note in the manual about compatibility options
- comments
- small changes in 'read_line' and 'pushstr'
2019-05-28 15:46:49 -03:00
Roberto Ierusalimschy
d9f40e3f6f
First implementation for 'const' variables
...
A variable can be declared const, which means it cannot be assigned to,
with the syntax 'local <const> name = exp'.
2019-05-17 11:11:44 -03:00
Roberto Ierusalimschy
347d6961ac
Define LUA_MAXUNSIGNED as a preprocessor constant
...
The previous definition of LUA_MAXUNSIGNED used a typecast,
making it unsuitable for constant expressions in the preprocessor.
2019-05-14 11:10:24 -03:00
Roberto Ierusalimschy
0b63d79b36
Details
...
- 'luaL_setfuncs' avoids creating closures for placeholders.
- Fixed some warnings about unused values in comma expressions.
- Comments.
2019-05-13 16:20:40 -03:00
Roberto Ierusalimschy
279c3a6961
A few changes in tests about number of bits in integers
...
- The preprocessor must work with at least 'long', and therefore must
do shifts of up to 31 bits correctly.
- Whenever possible, use unsigned types in shifts.
2019-05-13 16:17:21 -03:00
Roberto Ierusalimschy
49c42f3615
Some improvements in 'luaconf.h'
...
Added '#if !defined' in some definitions to allow external definitions;
more comments; other small changes.
2019-05-13 14:24:10 -03:00
Roberto Ierusalimschy
d881325c2f
Flag for to-be-closed variables changed to '<toclose>'
...
The flag for to-be-closed variables was changed from '*toclose'
to '<toclose>'. Several people found confusing the old syntax and
the new one has a clear terminator, making it more flexible for
future changes.
2019-05-09 12:10:31 -03:00
Roberto Ierusalimschy
3f253f116e
Test for dead coroutine moved to 'lua_resume'
...
The test for dead coroutines done in the 'coro' library was moved
to 'lua_resume', in the kernel, which already does other similar
tests.
2019-05-09 11:32:20 -03:00
Roberto Ierusalimschy
389116d8ab
Coroutines do not unwind the stack in case of errors
...
Back to how it was, a coroutine does not unwind its stack in case of
errors (and therefore do not close its to-be-closed variables). This
allows the stack to be examined after the error. The program can
use 'coroutine.kill' to close the variables.
The function created by 'coroutine.wrap', however, closes the
coroutine's variables in case of errors, as it is impossible to examine
the stack any way.
2019-05-09 11:13:45 -03:00
Roberto Ierusalimschy
01bded3d8c
File 'lib2-v2.so' generated from its own source
...
Instead of being a copy of 'lib2.so', 'lib2-v2.so' has its own source
file ('lib22.c'), so that the test can distinguish both libraries.
2019-05-03 10:36:19 -03:00
Roberto Ierusalimschy
7c5786479c
A few more improvements in 'luaO_pushvfstring'
...
- 'L' added to the 'BuffFS' structure
- '%c' does not handle control characters (it is not its business.
This now is done by the lexer, who is the one in charge of that
kind of errors.)
- avoid the direct use of 'l_sprintf' in the Lua kernel
2019-05-03 10:18:44 -03:00
Roberto Ierusalimschy
b14609032c
Avoid the creation of too many strings in 'package'
...
Both when setting a path and searching for a file ('searchpath'),
this commit reduces the number of intermediate strings created
in Lua.
(For setting a path the change is not relevant, because this is
done only twice when loading the module. Anyway, it is a nice example
of how to use auxlib buffers to manipulate strings in the C API.)
2019-05-03 10:14:25 -03:00
Roberto Ierusalimschy
b36e26f51b
Some more small improvements to 'luaO_pushvfstring'
...
Details:
- counter 'pushed' moved to the struct 'BuffFS'
- new auxiliar function 'getbuff' to build strings directly on
the buffer.
2019-04-26 11:24:39 -03:00
Roberto Ierusalimschy
969b8c1f14
Fixed bug with to-be-closed variables in base C level
...
To-be-closed variables in C use 'ci.nresults' to code that there is
a variable to be closed in that function. The intialization of the
base C level (the one "running" when calling API functions outside
any Lua call) did not initialize 'ci.nresults', creating (correct)
warnings in valgrind.
2019-04-26 11:13:01 -03:00
Roberto Ierusalimschy
c65605151c
New function 'luaL_addgsub'
...
Added a new function 'luaL_addgsub', similar to 'luaL_gsub' but that
adds its result directly to a preexisting buffer, avoiding the creation
of one extra intermediate string. Also added two simple macros,
'luaL_bufflen' and 'luaL_buffaddr', to query the current length
and the contents address of a buffer.
2019-04-24 14:41:41 -03:00
Roberto Ierusalimschy
3da34a5fa7
Revamp of 'lua_pushfstring' / 'luaO_pushvfstring'
...
The function 'luaO_pushvfstring' now uses an internal buffer to
concatenate small strings, instead of pushing all pieces on the
stack. This avoids the creation of several small Lua strings for each
piece of the result. (For instance, a format like "n: '%d'" used to
create three intermediate strings: "n: '", the numeral, and "'".
Now it creates none.)
2019-04-24 14:01:20 -03:00
Roberto Ierusalimschy
20b161e285
Small correction in test about 'isdst'
...
The field 'isdst' can be false, so we cannot test its absence with
'if not D.isdst'; we must compare with nil for a correct test.
2019-04-22 12:31:29 -03:00
Roberto Ierusalimschy
ed2872cd3b
'require' returns where module was found
...
The function 'require' returns the *loader data* as a second result.
For file searchers, this data is the path where they found the module.
2019-04-17 14:57:29 -03:00
Roberto Ierusalimschy
2d3f095448
Avoid using large buffers in 'string.format'
...
The result of "string.format("%.99f", -1e308) is 410 characters long,
but all other formats have much smaller limits (at most 99 plus a fex
extras). This commit avoids 'string.format' asking for a buffer
~400 chars large when ~100 will do.
2019-04-12 11:48:24 -03:00
Roberto Ierusalimschy
b0810c51c3
Small optimizations in 'string.gsub'
...
Avoid creating extra strings when possible:
- avoid creating new resulting string when subject was not modified
(instead, return the subject itself);
- avoid creating strings representing the captured substrings when
handling replacements like '%1' (instead, add the substring directly
to the buffer).
2019-04-11 11:29:16 -03:00
Roberto Ierusalimschy
a93e014447
Added an optional parameter to 'coroutine.isyieldable'
2019-04-10 13:23:14 -03:00
Roberto Ierusalimschy
8ba4523ccc
'print' does not call 'tostring' to format its arguments
2019-04-10 12:58:14 -03:00
Roberto Ierusalimschy
979ad95eb1
Thorough revision of the reference manual
2019-04-10 12:41:56 -03:00
Roberto Ierusalimschy
0f028b9008
Corrected tests around non-portable 'isdst' in dates
...
The field 'isdst' in date tables may not be present; portable tests
should not assume it is.
2019-04-09 18:44:13 -03:00
Roberto Ierusalimschy
65d1aa7a77
Syntax should not allow numbers touching identifiers
...
Code like 'a = 1print()' should not be accepted.
2019-04-09 18:40:39 -03:00
Roberto Ierusalimschy
8004798b03
Fixed wrong error message in 'return math.seed(0)'
...
Bug introduced in commit 28d829c8 : OP_TAILCALL might raise an
error without saving 'pc'. (This commit also fixes a detail in
'testes/uf8.lua'.)
2019-04-04 16:31:24 -03:00
Roberto Ierusalimschy
5ca1075b71
Added field 'srclen' to structure 'lua_Debug'
...
This new field gets the length of 'source' in the same structure.
Unlike the other strings in that structure, 'source' can be
relatively large, and Lua already has its length readily available.
2019-04-04 11:45:26 -03:00
Roberto Ierusalimschy
38425e0692
Avoid moving the collector while in 'GCSenteratomic' state
...
The 'GCSenteratomic' is just an auxiliary state for transitioning
to 'GCSatomic'. All GC traversals should be done either on the
'GCSpropagate' state or the 'GCSatomic' state.
2019-04-01 14:22:07 -03:00
Roberto Ierusalimschy
d12262068d
Small optimizations in range checks
...
Checks of the form '1 <= x && x <= M' were rewritten in the form
'(unsigned)x - 1 < (unsigned)M', which is usually more efficient.
(Other similar checks have similar translations.) Although
some compilers do these optimizations, that does not happen
for all compilers or all cases.
2019-03-27 14:56:10 -03:00
Roberto Ierusalimschy
0443ad9e28
LUAI_MAXCCALLS renamed LUAI_MAXCSTACK
...
The limit LUAI_MAXCCALLS was renamed LUAI_MAXCSTACK, which better
represents its meaning. Moreover, its definition was moved to
'luaconf.h', given its importance now that Lua does not use
a "stackless" implementation.
2019-03-25 14:12:06 -03:00
Roberto Ierusalimschy
f9b0cf0e2e
Year in copyright notice updated to 2019
2019-03-25 14:00:09 -03:00
Roberto Ierusalimschy
7ceb2154ed
Fixed small bugs/issues
...
- In 'readutf8esc' (llex.c), the overflow check must be done before
shifting the accumulator. It was working because tests were using
64-bit longs. Failed with 32-bit longs.
- In OP_FORPREP (lvm.c), avoid negating an unsigned value. Visual
Studio gives a warning for that operation, despite being well
defined in ISO C.
- In 'luaV_execute' (lvm.c), 'cond' can be defined only when needed,
like all other variables.
2019-03-25 10:38:56 -03:00
Roberto Ierusalimschy
23e6bac8a0
Keep correct type for immediate operands in comparisons
...
When calling metamethods for things like 'a < 3.0', which generates
the opcode OP_LTI, the C register tells that the operand was
converted to an integer, so that it can be corrected to float when
calling a metamethod.
This commit also includes some other stuff:
- file 'onelua.c' added to the project
- opcode OP_PREPVARARG renamed to OP_VARARGPREP
- comparison opcodes rewritten through macros
2019-03-22 13:37:17 -03:00
Roberto Ierusalimschy
682054920d
Details in the implementation of the integer 'for' loop
...
Changed some implementation details; in particular, it is back using
an internal variable to keep the index, with the control variable
being only a copy of that internal variable. (The direct use of
the control variable demands a check of its type for each access,
which offsets the gains from the use of a single variable.)
2019-03-21 16:01:55 -03:00
Roberto Ierusalimschy
f53eabeed8
Small changes in the header of binary files
...
- LUAC_VERSION is equal to LUA_VERSION_NUM, and it is stored
as an int.
- 'sizeof(int)' and 'sizeof(size_t)' removed from the header, as
the binary format does not depend on these sizes. (It uses its
own serialization for unsigned integer values.)
2019-03-19 15:31:08 -03:00
Roberto Ierusalimschy
39bb3cf242
Name 'nonstrict' in the UTF-8 library changed to 'lax'
...
It is not a good idea to use negative words to describe boolean
values. (When we negate that boolean we create a double negative...)
2019-03-19 11:15:49 -03:00
Roberto Ierusalimschy
9b37a4695e
New semantics for the integer 'for' loop
...
The numerical 'for' loop over integers now uses a precomputed counter
to control its number of iteractions. This change eliminates several
weird cases caused by overflows (wrap-around) in the control variable.
(It also ensures that every integer loop halts.)
Also, the special opcodes for the usual case of step==1 were removed.
(The new code is already somewhat complex for the usual case,
but efficient.)
2019-03-19 10:53:18 -03:00
Roberto Ierusalimschy
1e0c73d5b6
Changes in the validation of UTF-8
...
All UTF-8 encoding functionality (including the escape
sequence '\u') accepts all values from the original UTF-8
specification (with sequences of up to six bytes).
By default, the decoding functions in the UTF-8 library do not
accept invalid Unicode code points, such as surrogates. A new
parameter 'nonstrict' makes them accept all code points up to
(2^31)-1, as in the original UTF-8 specification.
2019-03-15 13:14:17 -03:00
Roberto Ierusalimschy
8fa4f1380b
Finalizers must be callable
...
Non-function __gc metamethods are not ignored; if present, the
metamethod will be called even if it is not a function.
2019-03-14 15:53:42 -03:00
Roberto Ierusalimschy
b56d4e570a
Changes in the warning system
...
- The warning functions get an extra parameter that tells whether
message is to be continued (instead of using end-of-lines as a signal).
- The user data for the warning function is a regular value, instead
of a writable slot inside the Lua state.
2019-03-14 15:30:54 -03:00
Roberto Ierusalimschy
9eca305e75
'math.randomseed()' sets a somewhat random seed
...
When called with no arguments, 'math.randomseed' uses time and ASLR
to generate a somewhat random seed. the initial seed when Lua starts
is generated this way.
2019-03-13 14:47:48 -03:00
Roberto Ierusalimschy
c5feac2b5e
Strings inside Lua are not fully aligned
...
Removed code to ensure that strings inside Lua (as returned by
'lua_tolstring') always start in fully aligned addresses.
Since version 5.3 the documentation does not ensure that.
2019-03-13 14:14:40 -03:00
Roberto Ierusalimschy
dfebe439db
New conversion specifier '%p' for 'string.format'
...
The call 'string.format("%p", val)' gives a Lua equivalent to the
C API function 'lua_topointer'.
2019-03-13 14:04:01 -03:00
Roberto Ierusalimschy
cf71a5ddc7
Details
...
Several small improvements (code style, warnings, comments, more tests),
in particular:
- 'lua_topointer' extended to handle strings
- raises an error in 'string.format("%10q")' ('%q' with modifiers)
- in the manual for 'string.format', the term "option" replaced by
"conversion specifier" (the term used by the C standard)
2019-03-13 13:16:53 -03:00
Roberto Ierusalimschy
2c32bff609
After a "bad collections", avoid switching back back to generational
...
After a major bad collection (one that collects too few objects),
next collection will be major again. In that case, avoid switching
back to generational mode (as it will have to switch again to
incremental to do next major collection).
2019-01-30 11:44:42 -02:00
Roberto Ierusalimschy
264659bd53
Optional 'init' argument to 'string.gmatch'
...
The function 'string.gmatch' now has an optional 'init' argument,
similar to 'string.find' and 'string.match'. Moreover, there was
some reorganization in the manipulation of indices in the string
library.
This commit also includes small janitorial work in the manual
and in comments in the interpreter loop.
2019-01-08 14:22:32 -02:00
Roberto Ierusalimschy
4ace93ca65
No more to-be-closed functions
...
To-be-closed variables must contain objects with '__toclose'
metamethods (or nil). Functions were removed for several reasons:
* Functions interact badly with sandboxes. If a sandbox raises
an error to interrupt a script, a to-be-closed function still
can hijack control and continue running arbitrary sandboxed code.
* Functions interact badly with coroutines. If a coroutine yields
and is never resumed again, its to-be-closed functions will never
run. To-be-closed objects, on the other hand, will still be closed,
provided they have appropriate finalizers.
* If you really need a function, it is easy to create a dummy
object to run that function in its '__toclose' metamethod.
This comit also adds closing of variables in case of panic.
2019-01-04 13:09:47 -02:00
Roberto Ierusalimschy
c6f7181e91
No more LUA_ERRGCMM errors
...
Errors in finalizers (__gc metamethods) are never propagated.
Instead, they generate a warning.
2019-01-01 12:14:56 -02:00
Roberto Ierusalimschy
437a5b07d4
Added a warning system to Lua
...
The warning system is just a way for Lua to emit warnings, messages
to the programmer that do not interfere with the running program.
2018-12-28 15:42:34 -02:00
Roberto Ierusalimschy
ba7da13ec5
Changes in the control of C-stack overflow
...
* unification of the 'nny' and 'nCcalls' counters;
* external C functions ('lua_CFunction') count more "slots" in
the C stack (to allow for their possible use of buffers)
* added a new test script specific for C-stack overflows. (Most
of those tests were already present, but concentrating them
in a single script easies the task of checking whether
'LUAI_MAXCCALLS' is adequate in a system.)
2018-12-27 14:32:29 -02:00
Roberto Ierusalimschy
da37ac9c78
Detail
...
Slightly better error message for invalid conversions in 'string.format'.
2018-12-27 14:19:53 -02:00
Roberto Ierusalimschy
662506476b
'all' script automatically 'make's everything
...
The script 'all', to run all tests, automatically ensures that the
Lua interpreter and the test C libraries (in 'testes/libs/') are
updated with any changes in 'luaconf.h'.
2018-12-19 13:15:14 -02:00
Roberto Ierusalimschy
5d7dec5520
Added directory 'testes/libs/P1' to the repository
...
This directory is used for some tests. As standard Lua has no command
to create directories, it must be present before running tests.
2018-12-17 15:19:56 -02:00
Roberto Ierusalimschy
af6d9f3116
Details
...
A few details in the makefile and in the manual. (In particular,
it updates the dependency lists in the makefile.)
2018-12-17 13:56:22 -02:00
Roberto Ierusalimschy
2258f3133b
Added file 'testes/heavy.lua'
...
This file is not part of the regular tests. It tests error conditions
that demand too much memory or too much time to create:
* string with too many characters
* control structure with body too large
* chunk with too many lines
* identifier with too many characters
* chunks with too many instructions
* function with too many constants
* too many strings internalized
* table with too many entries
In machines with limited memory (less than 150 GB), many tests run up
to a "not enough memory" error. We need some memory (~256 GB) to
run all tests up to their intrinsic limits.
2018-12-14 13:49:02 -02:00
Roberto Ierusalimschy
57f5b81da9
Bug: Long brackets with a huge number of '=' causes overflow
...
A long bracket with too many equal signs can overflow the 'int' used for
the counting and some arithmetic done on the value. Changing the counter
to 'size_t' avoids that. (Because what is counted goes to a buffer, an
overflow in the counter will first raise a buffer-overflow error.)
2018-12-14 13:12:01 -02:00
Roberto Ierusalimschy
fdc25a1ebf
New functions 'lua_resetthread' and 'coroutine.kill'
...
New functions to reset/kill a thread/coroutine, mainly (only?) to
close any pending to-be-closed variable. ('lua_resetthread' also
allows a thread to be reused...)
2018-12-13 13:07:53 -02:00
Roberto Ierusalimschy
3b06f983ae
Details
...
- in 'luaB_tonumber', do not need to "checkany" when argument
is a number.
- in 'lua_resume', the call to 'luaD_rawrunprotected' cannot return
a status equal to -1.
2018-12-11 11:54:14 -02:00
Roberto Ierusalimschy
51316f9df7
'math.rand()' uses higher bits to produce float value
...
The call 'math.rand()' converts the higher bits of the internal unsigned
integer random to a float, instead of its lower bits. That ensures that
Lua compiled with different float precisions always generates equal (up
to the available precision) random numbers when given the same seed.
2018-12-11 11:34:47 -02:00
Roberto Ierusalimschy
46beca5bed
Better error messages for some polymorphic functions
...
New auxiliary functions/macros 'luaL_argexpected'/'luaL_typeerror'
ease the creation of error messages such as
bad argument #2 to 'setmetatable' (nil or table expected, got boolean)
(The novelty being the "got boolean" part...)
2018-12-10 13:46:03 -02:00
Roberto Ierusalimschy
28d829c867
Calls cannot be tail in the scope of a to-be-closed variable
...
A to-be-closed variable must be closed when a block ends, so even
a 'return foo()' cannot directly returns the results of 'foo'; the
function must close the scope before returning.
2018-12-04 15:01:42 -02:00
Roberto Ierusalimschy
6d04537ea6
A to-be-closed variable must have a closable value (or be nil)
...
It is an error for a to-be-closed variable to have a non-closable
non-nil value when it is being closed. This situation does not seem to
be useful and often hints to an error. (Particularly in the C API, it is
easy to change a to-be-closed index by mistake.)
2018-11-29 16:02:44 -02:00
Roberto Ierusalimschy
7696c6474f
Auxiliary buffer cannot close box with 'lua_remove'
...
To remove a to-be-closed variable from the stack in the C API a
function must use 'lua_settop' or 'lua_pop'. Previous implementation of
'luaL_pushresult' was not closing the box. (This commit also added
tests to check that box is being closed "as soon as possible".)
2018-11-26 14:16:17 -02:00
Roberto Ierusalimschy
7e63d3da02
Some bugs with stack reallocation by 'luaF_close'
...
(Long time without testing with '-DHARDSTACKTESTS'...)
With the introduction of to-be-closed variables, calls to 'luaF_close'
can move the stack, but some call sites where keeping pointers to the
stack without correcting them.
2018-11-24 11:59:15 -02:00
Roberto Ierusalimschy
84e32ad2eb
Added opcodes for arithmetic with K operands
...
Added opcodes for all seven arithmetic operators with K operands
(that is, operands that are numbers in the array of constants of
the function). They cover the cases of constant float operands
(e.g., 'x + .0.0', 'x^0.5') and large integer operands (e.g.,
'x % 10000').
2018-11-23 12:23:45 -02:00
Roberto Ierusalimschy
35296e1fde
Details
...
comments and other janitorial work.
2018-11-22 13:56:04 -02:00
Roberto Ierusalimschy
bb0185b196
Documentation for to-be-closed variables
2018-11-13 14:33:14 -02:00
Roberto Ierusalimschy
d40cd315f5
Visibility of non-API functions changed to "internal"
...
The visibility for functions marked as LUAI_FUNC was changed from
"hidden" to "internal". These functions cannot be called from
outside the Lua kernel, and "internal" visibility offers more
chances for optimizations.
2018-11-13 13:58:46 -02:00
Roberto Ierusalimschy
8cb84210ab
String buffer using to-be-closed variable
...
The string buffers in the C API now mark their boxes as to-be-closed
variables, to release their buffers in case of errors.
2018-11-13 13:50:33 -02:00
Roberto Ierusalimschy
5fda30b4f9
'lua_toclose' gets the index to be closed as an argument
...
Sometimes it is useful to mark to-be-closed an index that is not
at the top of the stack (e.g., if the value to be closed came from
a function call returning multiple values).
2018-11-12 14:15:50 -02:00
Roberto Ierusalimschy
9eafe9c053
New implementation for 'luaL_addvalue'
...
The function 'luaL_addvalue' (from the buffer system) was rewritten
so that it does not change the position of the box (if present)
in the stack.
2018-11-09 17:03:52 -02:00
Roberto Ierusalimschy
7f6f70853c
To-be-closed variable in 'for' loop separated from the state
...
The variable to be closed in a generic 'for' loop now is the
4th value produced in the loop initialization, instead of being
the loop state (the 2nd value produced). That allows a loop to
use a state with a '__toclose' metamethod but do not close it.
(As an example, 'f:lines()' might use the file 'f' as a state
for the loop, but it should not close the file when the loop ends.)
2018-11-07 14:42:05 -02:00
Roberto Ierusalimschy
b8fed93215
New syntax for to-be-closed variables
...
The new syntax is <local *toclose x = f()>. The mark '*' allows other
attributes to be added later without the need of new keywords; it
also allows better error messages. The API function was also renamed
('lua_tobeclosed' -> 'lua_toclose').
2018-11-07 10:03:05 -02:00
Roberto Ierusalimschy
5e76a4fd31
New macros for arithmetic/bitwise operations in 'luaV_execute'
...
The repetitive code of the arithmetic and bitwise operators in
the main iterpreter loop was moved to appropriate macros.
(As a detail, the function 'luaV_div' was renamed 'luaV_idiv',
as it does an "integer division" (floor division).
2018-11-05 16:10:42 -02:00
Roberto Ierusalimschy
e8c779736f
Removed internal cache for closures
...
The mechanism of "caching the last closure created for a prototype to
try to reuse it the next time a closure for that prototype is created"
was removed. There are several reasons:
- It is hard to find a natural example where this cache has a measurable
impact on performance.
- Programmers already perceive closure creation as something slow,
so they tend to avoid it inside hot paths. (Any case where the cache
could reuse a closure can be rewritten predefining the closure in some
variable and using that variable.)
- The implementation was somewhat complex, due to a bad interaction
with the generational collector. (Typically, new closures are new,
while prototypes are old. So, the cache breaks the invariant that
old objects should not point to new ones.)
2018-11-01 13:21:00 -03:00
Roberto Ierusalimschy
2fc6b55dae
Removed resource-related "emergency collections"
...
New to-be-closed variables is a better way to ensure the proper release
of resources.
2018-10-31 16:25:29 -03:00
Roberto Ierusalimschy
947a372f58
State in generic 'for' acts as a to-be-closed variable
...
The implicit variable 'state' in a generic 'for' is marked as a
to-be-closed variable, so that the state will be closed as soon
as the loop ends, no matter how.
Taking advantage of this new facility, the call 'io.lines(filename)'
now returns the open file as a second result. Therefore,
an iteraction like 'for l in io.lines(name)...' will close the
file even when the loop ends with a break or an error.
2018-10-31 14:54:45 -03:00
Roberto Ierusalimschy
e073cbc2e5
Better error messages for invalid operands in numeric 'for'
...
"Better" and similar to error messages for invalid function arguments.
*old message: 'for' limit must be a number
*new message: bad 'for' limit (number expected, got table)
2018-10-30 15:46:56 -03:00
Roberto Ierusalimschy
2316ec4c24
Back with optimization for 'if cond then goto'
...
Statements like 'if cond then goto label' generate code so that the
jump in the 'if' goes directly to the given label. This optimization
cannot be done when the jump is backwards leaving the scope of some
variable, as it cannot add the needed 'close' instruction. (The jumps
were already generated by the 'if'.)
This commit also added 'likely'/'unlikely' for tests for errors in
the parser, and it changed the way breaks outside loops are detected.
(Now they are detected like other goto's with undefined labels.)
2018-10-30 15:04:19 -03:00
Roberto Ierusalimschy
a006514ea1
Big revamp in the implmentation of labels/gotos
...
Added restriction that, when a label is created, there cannot be
another label with the same name visible. That allows backward goto's
to be resolved when they are read. Backward goto's get a close if
they jump out of the scope of some variable; labels get a close only
if previous goto to it jumps out of the scope of some upvalue.
2018-10-29 14:26:48 -03:00
Roberto Ierusalimschy
6e9b719694
More uniformity in code generation for 'for' loops
...
Added new instruction 'OP_TFORPREP' to prepare a generic for loop.
Currently it is equivalent to a jump (but with a format 'iABx',
similar to other for-loop preparing instructions), but soon it will
be the place to create upvalues for closing loop states.
2018-10-26 10:38:50 -03:00
Roberto Ierusalimschy
34840301b5
To-be-closed variables in the C API
2018-10-25 15:30:15 -03:00
Roberto Ierusalimschy
41c800b352
Closing methods should not interfere with returning values
...
A closing method cannot be called in its own stack slot, as there may
be returning values in the stack after that slot, and the call would
corrupt those values. Instead, the closing method must be copied to the
top of the stack to be called.
Moreover, even when a function returns no value, its return istruction
still has to have its position (which will set the stack top) after
the local variables, otherwise a closing method might corrupt another
not-yet-called closing method.
2018-10-25 12:50:20 -03:00
Roberto Ierusalimschy
0a9aca56ca
Added a '__close' metamethod to file handles
2018-10-23 13:57:25 -03:00
Roberto Ierusalimschy
ea1322ef54
Detail: bad assertion in 'luaM_free_'
2018-10-23 12:58:38 -03:00
Roberto Ierusalimschy
6a4b9bb2b4
Removed extra information from RCS keyword strings in tests
...
Version numbers and dates (mostly wrong) from RCS keyword strings
removed from all test files; only the file name are kept.
2018-10-22 15:20:07 -03:00
Roberto Ierusalimschy
7c8146d556
Small improvements in the manual
2018-10-22 15:02:09 -03:00
Roberto Ierusalimschy
c90176f969
Complete implementation of to-be-closed variables
2018-10-22 14:55:51 -03:00
Roberto Ierusalimschy
3c7dc52909
Handling of memory errors when creating to-be-closed upvalues
2018-10-18 16:15:09 -03:00
Roberto Ierusalimschy
bd96330d03
First "complete" implementation of to-be-closed variables
...
Still missing:
- handling of memory errors when creating upvalue (must run closing
method all the same)
- interaction with coroutines
2018-10-17 10:44:42 -03:00
Roberto Ierusalimschy
4cd1f4aac0
Towards "to closed" local variables
...
Start of the implementation of "scoped variables" or "to be closed"
variables, local variables whose '__close' (or themselves) are called
when they go out of scope. This commit implements the syntax, the
opcode, and the creation of the corresponding upvalue, but it still
does not call the finalizations when the variable goes out of scope
(the most important part).
Currently, the syntax is 'local scoped name = exp', but that will
probably change.
2018-10-08 10:42:07 -03:00
Roberto Ierusalimschy
b114c7d487
Added "cost" for the use of C stack by a coroutine invocation.
...
Resuming a coroutine uses more C stack than other operations (such as
function calls or recursive syntax). So, to avoid stack overflow
in recursive coroutine invocations, either LUAI_MAXCCALLS must be
too small or a coroutine invocation must "pay" a higher price.
New constant LUAL_COROCSTK ("COROutine C STaK") defines how much
is this price.
2018-09-11 14:24:14 -03:00
Roberto Ierusalimschy
9cbf17b0f1
Details (comments)
2018-09-11 08:39:12 -03:00
Roberto Ierusalimschy
5382a22e0e
Corrections in the implementation of '%' for floats.
...
The multiplication (m*b) used to test whether 'm' is non-zero and
'm' and 'b' have different signs can underflow for very small numbers,
giving a wrong result. The use of explicit comparisons solves this
problem. This commit also adds several new tests for '%' (both for
floats and for integers) to exercise more corner cases, such as
very large and very small values.
2018-08-28 12:36:58 -03:00
Roberto Ierusalimschy
8c8a91f2ef
Deprecated the emulation of '__le' using '__lt'
...
As hinted in the manual for Lua 5.3, the emulation of the metamethod
for '__le' using '__le' has been deprecated. It is slow, complicates
the logic, and it is easy to avoid this emulation by defining a proper
'__le' function.
Moreover, often this emulation was used wrongly, with a programmer
assuming that an order is total when it is not (e.g., NaN in
floating-point numbers).
2018-08-24 10:17:54 -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
3dcd04ad61
details
...
Minor optimizations in 'lvm.c'. (Not exactly optimizations, but more
chances for optimizations.)
2018-08-17 15:53:39 -03:00
Roberto Ierusalimschy
faaf7e481f
Removed use of 'rl_inhibit_completion' in 'lua.c'
...
Some old systems (e.g., Mac OS X 10.4) do not define
'rl_inhibit_completion', even when line history is available.
Anyway, the user can configure this option externally, using '~/.inputrc'.
2018-08-16 14:38:05 -03:00
Roberto Ierusalimschy
3d838f635c
Added "emergency collection" to 'io.tmpfile' and 'os.tmpname'
...
These operations also can give errors for lack of resources, so they
also will try "emergency collections" in case of resource errors.
Because there are now two libraries with that kind of handling,
'resourcetryagain' was moved to the auxiliary library to be shared
by the libraries.
2018-07-27 15:50:53 -03:00
Roberto Ierusalimschy
aa4c5cf190
Added directory to test file names in '$Id:'
...
From the point of view of 'git', all names are relative to the root
directory of the project. So, file names in '$Id:' also should be
relative to that directory: the proper name for test file 'all.lua'
is 'testes/all.lua'.
2018-07-25 15:31:04 -03:00
Roberto Ierusalimschy
b47f2cd068
Small improvements in the manual
2018-07-25 14:56:42 -03:00
Roberto Ierusalimschy
e885dee5ab
File operations try an "emergency collection" when failing
...
If a file operation fails do to lack of resources (too many open
files or not enough memory), it does a full garbage collection and
tries the operation again. Lack of resources are "too many open
files" (process wise and system wise) and "not enough memory".
The code is full of '#if's because error codes are not part
of the standard ISO C.
2018-07-25 11:44:46 -03:00
Roberto Ierusalimschy
ccae0f5aad
Comments about OLD0/OLD1 ages
...
Improved the comments in file 'lgc.c' explaining the roles of "ages"
OLD0 and OLD1 in the generacional collector.
2018-07-18 11:43:45 -03:00
Roberto Ierusalimschy
2e297d6ab3
Fixed bug in generational collection of userdata
...
During generational collection, a userdatum must become gray and
go to a gray list after being traversed (like tables), so that
'correctgraylist' can handle it to its next stage.
This commit also added minimum tests for the generational collector,
including one that would detect this bug.
2018-07-13 15:43:02 -03:00
Roberto Ierusalimschy
fb18346ddd
Avoid using 'int' for UTF-8 values
...
An 'int' may have only 16 bits, so it may not be big enough for UTF-8
values. The new type 'utfint' (in the utf8 library) ensures at least
21 bits for those values.
2018-07-12 15:56:44 -03:00
Roberto Ierusalimschy
96f9643f33
Bug: wrong 'nCcalls' when resuming a coroutine
...
The counter 'nCcalls' now includes the number of CallInfo structures
pre-allocated (so that these "potential" C calls can be made without
checking 'nCcalls'). So, when copying this value from a thread to
another, in 'lua_resume', it must be corrected to the number of
CallInfo structures in the thread being resumed.
2018-07-11 16:11:50 -03:00
Roberto Ierusalimschy
84058b1506
Added definition for LUA_VERSION_RELEASE_NUM
...
LUA_VERSION_RELEASE_NUM is set to the release number of the Lua
interpreter (e.g., 5.4.0 becomes the integer 50400).
2018-07-11 13:17:46 -03:00
Roberto Ierusalimschy
4d5de1c1fb
Fixed bug in line info. when using 'not' operator
...
When creating code for a jump on a 'not' condition, the code generator
was removing an instruction (the OP_NOT) without adjusting its
corresponding line information.
This fix also added tests for this case and extra functionality in
the test library to debug line info. structures.
2018-07-11 12:53:23 -03:00
Roberto Ierusalimschy
9a825f6bb9
In tests of opcodes, avoid coercion in bitwise operation
2018-07-10 14:55:16 -03:00
Roberto Ierusalimschy
941b189d98
Improvements in the manual
...
- More precise use of 'argument' x 'parameter'.
- Clarification about what the lexer considers 'letter', 'space',
and 'digit'.
2018-07-10 13:48:19 -03:00
Roberto Ierusalimschy
21f663d29f
Added missing $Id$ to file 'ljumptab.h'
2018-07-10 13:40:30 -03:00
Roberto Ierusalimschy
626cf0581b
Generational mode may wait longer after a major collection
...
When Lua is building large long-duration structures, frequent small
minor collections just waste time. Trying to avoid this, the
collector will do a larger pause after a major collection when it
does not collect enough garbage (which is a hint that memory is
being used for long-lasting objects).
2018-07-09 14:22:09 -03:00
Roberto Ierusalimschy
ccf6d098f6
'searchpath' creates less temporary strings
...
When creating error messages, package loaders may create dozens of
temporary strings (one or more for each tried template). This change
reduces the number of these strings, and avoid creating some of
them if the search is successful.
2018-07-09 13:29:08 -03:00
Roberto Ierusalimschy
de2caf7ee4
Bit-library file removed from the project (as it was deprecated)
...
This commit only removed the file 'lbitlib.c' from the project; the
makefile already was not using it.
2018-07-09 12:54:51 -03:00
Roberto Ierusalimschy
b08c9079c5
Opcode names moved to a new header file
...
The array with the names of the opcodes was moved to a header file
('lopnames.h'), as it is not used by the Lua kernel. Files that need
that array ('luac.c' and 'ltests.c') include the header file to get
a private (static) copy.
2018-07-09 12:50:51 -03:00
Roberto Ierusalimschy
06e08c6d05
Fixed bug in OP_IDIVI
...
Opocode was using 'luai_numdiv' (float division) instead of
'luai_numidiv' (integer division).
2018-07-09 12:41:24 -03:00
Roberto Ierusalimschy
7c519dfbd0
Added manual and tests for version 5.4-w2
2018-07-09 12:33:01 -03:00
Roberto Ierusalimschy
f59e6a93c0
opening functions must be exported!
2018-06-19 16:23:57 -03:00
Roberto Ierusalimschy
6683f83b51
several details
2018-06-18 15:25:19 -03:00
Roberto Ierusalimschy
a314409dba
in generational mode, an emergency collection can turn any object black
...
during any memory allocation +
'luaT_getvarargs' may reallocate the stack, and therefore the top must
be correct.
2018-06-18 14:58:21 -03:00
Roberto Ierusalimschy
15ce8d0904
in generational mode, an emergency collection can turn any object black
...
during any memory allocation.
2018-06-18 14:57:20 -03:00
Roberto Ierusalimschy
b43300c14f
change in 'LUAI_DDEC' to allow variables to be static in 'onelua'
...
+ change in 'LUAMOD_API' as opening functions do not need to be global
2018-06-18 09:51:05 -03:00
Roberto Ierusalimschy
af70905246
no need to check whether libraries and host use the same kernel;
...
Lua should work correctly with several copies of the kernel
2018-06-18 09:08:10 -03:00
Roberto Ierusalimschy
b95e466218
new field 'nilvalue' in struct 'global_State' to avoid the use of
...
addresses of static variables
2018-06-15 16:31:22 -03:00
Roberto Ierusalimschy
d406d3d05f
removed unused macros 'isstackindex'/'api_checkstackindex' +
...
macro 'api_checkvalidindex' (used only once) expanded and removed
2018-06-15 14:30:52 -03:00
Roberto Ierusalimschy
b6780ee41b
detail (removed unused definition for 'LUA_QS')
2018-06-15 12:49:28 -03:00
Roberto Ierusalimschy
2c107e13a8
warning (comparison between signed and unsigned integers)
2018-06-15 11:18:40 -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
06127927ff
new macro 'ispow2'
2018-06-15 11:13:45 -03:00
Roberto Ierusalimschy
aedcfb9414
type 'Rand64' may not be long long, so it should not use 'LL' in its
...
constants
2018-06-14 15:47:22 -03:00
Roberto Ierusalimschy
992b6d2712
no more 'TESTGRAYBIT' (to free this bit for real uses)
2018-06-11 11:19:50 -03:00
Roberto Ierusalimschy
588dfa4ce5
detail in comment
2018-06-08 16:07:27 -03:00
Roberto Ierusalimschy
6f2b8e21c4
added 'const' to 'Proto*' when possible
2018-06-08 16:06:59 -03:00
Roberto Ierusalimschy
c5dc521d65
added patch for bug 5.3.4-7
2018-06-08 13:23:18 -03:00
Roberto Ierusalimschy
505fc91222
no more 'luaO_nilobject' to avoid comparison of global variable addresses
...
(now uses static variables)
2018-06-01 14:40:38 -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
b397064955
avoid craches when loading tampered code with NULL as a string constant
2018-06-01 13:45:58 -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
97e394ba18
macro 'luai_makeseed' now controls the whole process of making the seed
2018-05-29 15:02:51 -03:00
Roberto Ierusalimschy
950fbcb971
detail ('l_castU2S' should only be used over lua_Unsigned values)
2018-05-29 15:01:50 -03:00
Roberto Ierusalimschy
b2d4d06428
avoid possible overflows when checking sizes in 'string.unpack'
2018-05-25 10:39:32 -03:00
Roberto Ierusalimschy
3b8dba5279
added patches for two bugs (5.3.4-2 and 5.3.4-3)
2018-05-24 17:25:14 -03:00
Roberto Ierusalimschy
892aff2a07
avoid circular inclusion between ltm.h <-> lstate.h
2018-05-23 11:41:20 -03:00
Roberto Ierusalimschy
02ed0b2c30
in 'luaD_poscall', there is no need to compute 'firstResult' when 'nres==0'
2018-05-22 09:02:36 -03:00
Roberto Ierusalimschy
de53c2ec7e
using some weak "randomness" (time and memory address) to initialize
...
seeds for the PRNG
2018-05-16 08:27:59 -03:00
Roberto Ierusalimschy
80bd4a8940
correction on xoshiro256** algorithm
...
(should use state[1] instead of state[0] for output)
2018-05-09 11:54:37 -03:00
Roberto Ierusalimschy
3e7415e846
reorganization of '#if's for sellecting a type for 'Rand64' +
...
comments
2018-05-04 17:01:45 -03:00
Roberto Ierusalimschy
e64e20ac81
minimizing the code ran by 'vmfetch' + no more 'vra'
...
(the code is simpler without 'vra' and conversion is a no-op)
2018-05-02 15:17:59 -03:00
Roberto Ierusalimschy
deb807837c
'luaO_pushvfstring' does not need to reallocate stack
...
(less error cases in the API)
2018-04-25 13:26:20 -03:00
Roberto Ierusalimschy
26eb144541
no need to define 'luaP_opnames' in regular builds
2018-04-19 12:42:41 -03:00
Roberto Ierusalimschy
f9c3d6fdbe
use test mode to test the interpreter without jump tables
2018-04-11 13:49:36 -03:00
Roberto Ierusalimschy
762baf0548
detail (trim constants are unsigned)
2018-04-06 14:52:42 -03:00
Roberto Ierusalimschy
b8a04658b2
PRNG changed from 'xoroshiro128+' to 'xoshiro256**' + "I' renamed 'Rand64'
...
+ implementation can use integer types larger than 64 (or 32) bits
2018-04-06 12:41:29 -03:00
Roberto Ierusalimschy
b44787652b
using 'xoroshiro128+' for PRNG
...
(plus a rotate at the final result to have better lower bits)
2018-04-04 13:12:53 -03:00
Roberto Ierusalimschy
03c6a05ec8
no more nil-in-table
2018-04-04 11:23:41 -03:00
Roberto Ierusalimschy
3d0b5edfe4
using unsigned comparison in 'l_intfitsf' (avoids one comparison)
2018-04-02 14:52:07 -03:00
Roberto Ierusalimschy
8d50a998e3
definition for LUA_UNSIGNEDBITS (number of bits in a LUA_UNSIGNED)
2018-04-02 10:58:33 -03:00
Roberto Ierusalimschy
bdd10a08b1
in 'random', uses high-order bits instead of low-order
...
(better statistical properties)
2018-03-26 16:48:46 -03:00
Roberto Ierusalimschy
c5e3b2f814
in random/'project', remove the special case for "small" intervals;
...
it is slower than the general case.
2018-03-22 16:54:49 -03:00
Roberto Ierusalimschy
6486762463
missing LUAI_FUNC in prototype for 'luaK_patchgoto'
2018-03-19 17:03:44 -03:00
Roberto Ierusalimschy
4907444db9
'fTransfer' -> 'ftransfer' / 'nTransfer' -> 'ntransfer'
...
(keep the standard of names in lower case)
2018-03-16 12:33:34 -03:00
Roberto Ierusalimschy
c3cb31fa9a
some extra goodies for 'readline'
...
('rl_readline_name' and 'rl_inhibit_completion')
2018-03-16 11:23:08 -03:00
Roberto Ierusalimschy
0c7738240e
FALLTHROUGH comment must be last "statement"
...
(so it does not work when inside a block)
2018-03-16 11:22:09 -03:00
Roberto Ierusalimschy
7b0b6b3b39
cannot use 'defined' inside a macro +
...
call to 'luaT_keydef' must be protected
2018-03-16 11:21:20 -03:00
Roberto Ierusalimschy
89da4168df
avoid functions named 'pack'
...
(name too common, may collide when doing 'onelua.c')
2018-03-16 11:18:18 -03:00
Roberto Ierusalimschy
6b01b6cf6a
'lu_int32' may not be 'int'
2018-03-12 09:39:03 -03:00
Roberto Ierusalimschy
e3388ebfad
more explicit casts when converting an integer to a random float
...
(to ensure computations are done with all bits)
2018-03-11 11:48:09 -03:00
Roberto Ierusalimschy
9e3db70482
details (casts between 'lua_Number' and 'double')
2018-03-09 16:24:45 -03:00
Roberto Ierusalimschy
dbec41f34c
random floats of different sizes get exactly needed number of random bits
...
(up to 64)
2018-03-09 16:23:39 -03:00
Roberto Ierusalimschy
0b3db69e41
slight simplification in 'xorshift128plus'
2018-03-09 12:05:13 -03:00
Roberto Ierusalimschy
80ae1c1c16
fairer projection of random integers into an integer interval
2018-03-09 11:56:25 -03:00
Roberto Ierusalimschy
40683b4934
added definition for LUA_MAXUNSIGNED
2018-03-09 11:56:02 -03:00
Roberto Ierusalimschy
6480e73599
details (avoid using non-C89 '//' comment)
2018-03-07 13:26:01 -03:00
Roberto Ierusalimschy
4a1612ff9b
new experimental syntax using reserved word 'undef'
2018-03-07 12:55:38 -03:00
Roberto Ierusalimschy
464658b16a
better modularization of the code for the REPL
2018-03-06 17:30:17 -03:00
Roberto Ierusalimschy
bdcde45d05
updated to use jump tables
2018-03-05 11:26:18 -03:00
Roberto Ierusalimschy
8b0434e5e6
both 'fTransfer' and 'nTransfer' may not fit in a 'char'
2018-03-05 11:15:32 -03:00
Roberto Ierusalimschy
8b0b675149
added casts (warnings in VS)
2018-03-05 11:15:04 -03:00
Roberto Ierusalimschy
8c429311a3
typo in comment
2018-03-05 11:13:55 -03:00
Roberto Ierusalimschy
66b7b075a6
'math.random' using the xorshift128+ algorithm
2018-03-05 11:07:48 -03:00
Roberto Ierusalimschy
62a392ff46
using jump tables when available
2018-03-02 15:59:19 -03:00
Roberto Ierusalimschy
893f382e94
Jump Table for the interpreter
2018-03-02 15:56:14 -03:00
Roberto Ierusalimschy
0eb10c6303
'LUA_USE_READLINE' moved to the make file
2018-03-02 15:31:51 -03:00
Roberto Ierusalimschy
00008b8ed0
back to one format per argument
2018-03-02 15:25:00 -03:00
Roberto Ierusalimschy
df49384516
year in copyright changed to 2018
2018-03-02 13:30:47 -03:00
Roberto Ierusalimschy
fbea553ca2
'lua_setiuservalue' removes value from the stack even in case of error
2018-02-27 17:01:55 -03:00
Roberto Ierusalimschy
34b00c16e2
removed compatibility code with older versions
2018-02-27 15:47:32 -03:00
Roberto Ierusalimschy
12110dec0e
module has been deprecated.
2018-02-27 15:46:26 -03:00
Roberto Ierusalimschy
4105cafb84
no more 'bitlib'
2018-02-27 15:27:30 -03:00
Roberto Ierusalimschy
76ff55750e
no optimizations in test mode + no more compat with 5.2 + a few more
...
options in comments
2018-02-27 15:24:23 -03:00
Roberto Ierusalimschy
b7edf5d2d8
metamethods for 'removekey'/'keyin'
2018-02-27 14:48:28 -03:00
Roberto Ierusalimschy
ef8263f81f
better names for macros for tags and types.
...
rttype -> rawtt; ttyperaw -> withvariant; ttype -> ttypetag;
tnov -> ttype
2018-02-26 11:16:05 -03:00
Roberto Ierusalimschy
2952bc5fc9
special compact representation for userdata with no user values
...
(a common case)
2018-02-26 10:35:03 -03:00
Roberto Ierusalimschy
38d3bc8909
using 'offsetof' to compute the size of parts of a structure
2018-02-25 10:40:00 -03:00
Roberto Ierusalimschy
75efc6722b
avoid variant tags with the same value of the original type
...
(to expose bugs more easily)
2018-02-25 09:52:32 -03:00
Roberto Ierusalimschy
d766e2ae17
first (parcial) implementation of 'keyin'/'removekey'
...
(still no metamethods, no raw verssions)
2018-02-25 09:48:16 -03:00
Roberto Ierusalimschy
f055a9dffd
added check in 'obj2gco' to prevent its use in non Lua-object pointers
...
(otherwise its cast is blind, casting any value given to it)
2018-02-25 09:43:52 -03:00
Roberto Ierusalimschy
4a7fe61806
in 'clearbykeys', clear keys of just-removed entries too
2018-02-23 10:21:27 -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
477ca2fe8c
some reorganization in 'lobject.h'
...
(just moving stuff around)
2018-02-22 14:28:10 -03:00
Roberto Ierusalimschy
c72ac048b9
conditional jumps "deunified"
...
(if a jump table is used, the unification may harm jump prediction.)
2018-02-21 16:43:44 -03:00
Roberto Ierusalimschy
b03dddf9e4
removed coercion string->number in bitwise operations
...
(can be done with a Lua module)
2018-02-21 14:48:31 -03:00
Roberto Ierusalimschy
c80c7a49fd
details (comments)
2018-02-21 13:28:12 -03:00
Roberto Ierusalimschy
212095a601
new opcodes OP_GTI/OP_GEI
2018-02-21 12:49:32 -03:00
Roberto Ierusalimschy
c67603fafb
using new 'lua_newuserdatauv' instead of 'lua_newuserdata'
2018-02-21 10:48:44 -03:00
Roberto Ierusalimschy
06865aa01d
simpler implementation for 'LTintfloat'/'LEintfloat'
...
+ 'LTfloatint'/'LEfloatint'
2018-02-21 10:47:03 -03:00
Roberto Ierusalimschy
465b474899
small reorganization of 'luaV_flttointeger'/'luaV_tointeger'
2018-02-21 09:54:26 -03:00
Roberto Ierusalimschy
6353d619a5
detail (comment)
2018-02-20 17:52:50 -03:00
Roberto Ierusalimschy
ca6fe7449a
userdata can have multiple user values
2018-02-20 13:52:50 -03:00
Roberto Ierusalimschy
1afd5a152d
more generic way to handle 'gclist'
2018-02-19 17:06:56 -03:00
Roberto Ierusalimschy
422318f677
two new fields 'fTransfer'/'nTransfer' in 'lua_Debug' structure
...
(for information about values being given and returned in function calls)
2018-02-17 17:29:29 -02:00
Roberto Ierusalimschy
49dae52d08
correct way to check stack space for vararg functions
2018-02-17 17:20:00 -02:00
Roberto Ierusalimschy
104d249ffb
in return hook, 'top' must be corrected only if smaller than 'ci->top'.
...
(It may be larger when returning multiple values, and then it must
be larger to preserve that stack slice.)
2018-02-17 16:22:00 -02:00
Roberto Ierusalimschy
c7a8cba745
no more 'nfield' string
2018-02-15 16:06:24 -02:00
Roberto Ierusalimschy
0682fe8169
some simplifications/optimizations in returns from Lua functions
2018-02-15 13:34:29 -02:00
Roberto Ierusalimschy
b1379936cf
vararg back to '...' (but with another implementation)
...
new implementation should have zero overhead for non-vararg functions
2018-02-09 13:16:06 -02:00
Roberto Ierusalimschy
4e0de3a43c
details
2018-02-07 13:55:18 -02:00
Roberto Ierusalimschy
318a9a5859
new opcode 'PREPVARARG'
...
(avoids test for vararg function in all function calls)
2018-02-07 13:18:04 -02:00
Roberto Ierusalimschy
73d797ce7e
detail
...
(order of 'OT' and 'IT' bits corresponds with macro 'opmode')
2018-02-07 13:04:41 -02:00
Roberto Ierusalimschy
51280ef2ad
call hooks for Lua functions called by 'luaV_execute'
2018-02-06 17:16:56 -02:00
Roberto Ierusalimschy
fc3eaa2559
GC default mode for the stand-alone interpreter is generational mode
2018-02-06 13:32:36 -02:00
Roberto Ierusalimschy
daff7c3b4d
small corrections in generational mode
...
(cannot call finalizers in emergency collections +
should set everything before calling finalizers)
2018-02-05 15:14:54 -02:00
Roberto Ierusalimschy
a131eae925
default for minor collection intervals a little larger
2018-02-05 15:14:29 -02:00
Roberto Ierusalimschy
022abc301b
'gcemergency' should be zero before any memory allocation
2018-02-05 15:11:37 -02:00
Roberto Ierusalimschy
56e50e8bc5
'collectgarbage' returns old mode when changing mode
2018-02-05 15:10:52 -02:00
Roberto Ierusalimschy
90569630d6
detail
...
(uses a reserved-format name for an internal type in the registry)
2018-01-29 17:13:27 -02:00
Roberto Ierusalimschy
dc0ab1e8ca
warnings in VS (implicit casts from ptrdiff_t to int)
2018-01-29 14:21:35 -02:00
Roberto Ierusalimschy
e2b15aa21d
janitor work on casts
2018-01-28 13:13:26 -02:00
Roberto Ierusalimschy
89110986d7
bug in tailcall of vararg functions
...
(when adjusting missing parameters)
2018-01-28 11:39:52 -02:00
Roberto Ierusalimschy
53979dfe0d
calling a vararg function needs to check GC
...
(because it creates a new table)
2018-01-28 10:08:04 -02:00
Roberto Ierusalimschy
6710a2b0ef
detail (comment)
2018-01-28 10:07:53 -02:00
Roberto Ierusalimschy
5bd8d388de
OP_CONCAT does not move its result (to simplify its execution)
2018-01-27 14:56:33 -02:00
Roberto Ierusalimschy
28f215ecf8
comments
2018-01-18 14:24:31 -02:00
Roberto Ierusalimschy
d2fb34ac88
'OP_TAILCALL' calling C functions finishes the call and returns
...
(instead of waiting for following 'OP_RETURN')
2018-01-14 15:27:50 -02:00
Roberto Ierusalimschy
ab0a851db4
'luaD_tryfuncTM' can ensure it does not change the stack
2018-01-10 17:19:27 -02:00
Roberto Ierusalimschy
728ff94595
error handler in protected calls must be a function
2018-01-10 10:02:35 -02:00
Roberto Ierusalimschy
ad960095bf
avoid jumping into a variable scope (C++ does not allow that)
2018-01-09 12:23:40 -02:00
Roberto Ierusalimschy
33e3774f44
keep more opcode arguments byte-aligned
2018-01-09 09:24:12 -02:00
Roberto Ierusalimschy
a9295a2b8e
typos in comments
2017-12-30 18:46:18 -02:00
Roberto Ierusalimschy
c6fedc92f8
new command 'print' (to print literal strings) in mini-language
2017-12-29 13:59:37 -02:00
Roberto Ierusalimschy
68af7cc81a
another try with table resize.
...
(Old version was leaving some elements unanchored while allocating
new memory)
2017-12-29 13:58:23 -02:00
Roberto Ierusalimschy
28323aeaa6
by-one error when filling missing arguments in a tail call
2017-12-29 13:44:51 -02:00
Roberto Ierusalimschy
cf7eff45f3
keep control of stack top in Lua functions concentrated in 'luaV_execute'
2017-12-28 13:42:57 -02:00
Roberto Ierusalimschy
8691612f01
when calling a hook, cannot decrease 'ci->top' (to preserve stack
...
size if the stack is reallocated)
2017-12-28 12:17:09 -02:00
Roberto Ierusalimschy
f99f3c42ff
comment
2017-12-28 09:51:00 -02:00
Roberto Ierusalimschy
f360e7778b
assert cannot use instruction after the last
2017-12-22 14:43:59 -02:00
Roberto Ierusalimschy
4676f6599e
new macros 'isOT'/'isIT'
...
(plus exchanged parameters of OP_VARARG to make it similar to other
'isOT' instructions)
2017-12-22 12:16:46 -02:00
Roberto Ierusalimschy
1d5b885437
when running Lua code, there is no need to keep 'L->top' "correct";
...
set it only when needed.
2017-12-20 12:58:05 -02:00
Roberto Ierusalimschy
4dc0be950a
new macro 'isLuacode' (to distinguish regular Lua code from
...
hooks, where C code can run inside a Lua function).
2017-12-19 14:40:17 -02:00
Roberto Ierusalimschy
3153a41e33
no need to save 'pc' in case of allocation errors
...
(allocation errors do not call message handlers)
2017-12-19 14:18:04 -02:00
Roberto Ierusalimschy
d388c165ef
new opcodes 'FORLOOP1'/'FORPREP1' for "basic for" (integer variable
...
with increment of 1)
2017-12-18 15:53:50 -02:00
Roberto Ierusalimschy
ab07005568
new auxiliary function 'luaK_isKint' + removal of 'luaK_needclose',
...
which was not being used anywhere.
2017-12-18 13:44:44 -02:00
Roberto Ierusalimschy
7024f49c42
default now is compiling without compatibility options + smaller
...
stack size in debug mode (clang uses still more stack space when
debugging).
2017-12-18 11:01:49 -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
3064edead2
details (cleaning uses of 'exp1')
2017-12-18 10:33:54 -02:00
Roberto Ierusalimschy
f8c1c1469a
some cleaning on signed opcode parameters
2017-12-15 16:53:48 -02:00
Roberto Ierusalimschy
4b6928e7f5
(1 << 31) with signed integer has undefined behavior in C
2017-12-15 16:35:22 -02:00
Roberto Ierusalimschy
b3f924bc69
'Proto->numparams' does not include vararg parameter
...
(one less subtraction when calling functions...)
2017-12-15 11:07:10 -02:00
Roberto Ierusalimschy
e001d5aea6
'VRELOCABLE' -> 'VRELOC'
2017-12-14 12:24:02 -02:00
Roberto Ierusalimschy
e752d84ed8
bug: memory-allocation error when resizing a table can leave it
...
in an inconsistent state.
2017-12-13 16:35:03 -02:00
Roberto Ierusalimschy
86431a2f1c
new opcodes BANDK/BORK/BXORK. (They do not use immediate operands
...
because, too often, masks in bitwise operations are integers larger
than one byte.)
2017-12-13 16:32:09 -02:00
Roberto Ierusalimschy
36cf8f3a3c
Code should not change the stack level after the initialization of a
...
string buffer.
2017-12-13 10:51:42 -02:00
Roberto Ierusalimschy
725c15a4ca
when shrinking stack, always shrinks the CI list.
...
(Stack overflow is not corelated to CI overflow anymore.)
2017-12-12 09:57:30 -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
3cf340f676
allows memory-allocation errors when shrinking blocks
2017-12-11 16:55:31 -02:00
Roberto Ierusalimschy
7ad20af2cf
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-11 16:53:53 -02:00
Roberto Ierusalimschy
bfb88e99e9
'luaD_growstack' cannot raise any errors when 'raiseerror' is
...
false (+ some comments)
2017-12-11 10:43:40 -02:00
Roberto Ierusalimschy
c5ebed7399
'luaM_shrinkvector' raises an error if it cannot shrink the block
...
(several parts of Lua use array size in protos as proxies for
number of valid elements)
2017-12-11 10:27:48 -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
40f823ec90
new C instruction "rawcheckstack" (to test failing in 'lua_checkstack')
2017-12-08 13:19:13 -02:00
Roberto Ierusalimschy
7622373033
using explicit tests for allocation overflow whenever possible
2017-12-07 16:59:52 -02:00
Roberto Ierusalimschy
46bc7f2bf7
detail (comment)
2017-12-07 16:53:33 -02:00
Roberto Ierusalimschy
cc01d46247
new test function 'T.allocount' to restrict number of allocations
...
before a memory-allocation error
2017-12-07 16:51:39 -02:00
Roberto Ierusalimschy
9fa1baf6de
opcodes for order and shift can use several metamethods,
...
so it is better to use a generic description + metamethod names
in some error messages shown without '__' prefix
2017-12-07 13:44:10 -02:00
Roberto Ierusalimschy
49dfaf7447
avoid using one function for different tasks (malloc, free, etc.)
2017-12-06 16:36:31 -02:00
Roberto Ierusalimschy
348fa1ca56
bug: 'lua_pushcclosure' should not call the garbage collector when
...
'n' is zero.
2017-12-06 16:20:28 -02:00
Roberto Ierusalimschy
ae11e37e53
bug: 'lua_pushcclosure' should not call the GC when 'n' is zero
2017-12-06 16:08:03 -02:00
Roberto Ierusalimschy
c7ee7fe026
new opcodes OP_SHLI/OP_SHRI
2017-12-04 15:41:30 -02:00
Roberto Ierusalimschy
421e459684
'luaS_resize' can raise memory errors
2017-12-01 15:38:49 -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
e0bece77d6
detail
2017-12-01 13:44:51 -02:00
Roberto Ierusalimschy
d0356d5f15
another value for LUAI_MAXCCALLS (must think more about that)
2017-12-01 13:08:14 -02:00
Roberto Ierusalimschy
ac78b914b6
warnings from Visual Studio /W3
2017-11-30 13:37:16 -02:00
Roberto Ierusalimschy
10b8c99bbb
small peephole optimizations
2017-11-30 11:29:18 -02:00
Roberto Ierusalimschy
bdc751ce23
details (comments)
2017-11-30 11:16:43 -02:00
Roberto Ierusalimschy
19c6b375c3
detail (spacing)
2017-11-30 10:03:00 -02:00
Roberto Ierusalimschy
745eb41993
new opcodes OP_RETURN0/OP_RETURN1
2017-11-29 14:57:36 -02:00
Roberto Ierusalimschy
c766e4103d
'luaV_execute' gets call info as extra argument (it is always
...
available on call sites)
2017-11-29 11:02:17 -02:00
Roberto Ierusalimschy
36aecd4548
order opcodes cannot use 'K' operands
2017-11-28 13:26:15 -02:00
Roberto Ierusalimschy
1a5e8c1014
conditional jumps unified in label "condjump' + new variable 'vra'
...
to avoid excessive use of macro 's2v'
2017-11-28 12:51:00 -02:00
Roberto Ierusalimschy
ff5fe51044
using register 'k' for conditions in tests (we only need one bit there)
2017-11-28 10:58:18 -02:00
Roberto Ierusalimschy
dfd188ba12
detail (identation of switch)
2017-11-28 09:19:07 -02:00
Roberto Ierusalimschy
093c16b67b
new opcodes 'OP_LTI' and 'OP_LEI'
2017-11-27 15:44:31 -02:00
Roberto Ierusalimschy
599f1742c6
detail (typo in comments)
2017-11-23 17:29:04 -02:00
Roberto Ierusalimschy
73abfde2ef
small simplifications around 'luaT_callorderTM'
2017-11-23 17:18:10 -02:00
Roberto Ierusalimschy
194a4f9710
small simplifications in 'luaD_poscall'
2017-11-23 16:29:41 -02:00
Roberto Ierusalimschy
196c87c9ce
no more 'stackless' implementation; 'luaV_execute' calls itself
...
recursively to execute function calls. 'unroll' continues all
executions suspended by an yield (through a long jump)
2017-11-23 14:41:16 -02:00
Roberto Ierusalimschy
39f26b1480
more information from 'T.stacklevel'
2017-11-23 13:38:42 -02:00
Roberto Ierusalimschy
3c230cc825
using 'A' for register instead of 'B' in relational opcodes
...
('R(A)' is already created by default for all instructions.)
2017-11-22 17:15:44 -02:00
Roberto Ierusalimschy
41f2936d8f
new opcode 'OP_EQI' for equality with immediate numbers
2017-11-22 16:41:20 -02:00
Roberto Ierusalimschy
14c3aa12b5
more direct implementation for tail calls.
2017-11-21 12:18:03 -02:00
Roberto Ierusalimschy
f3ca52bfa9
in order comparison opcodes, fast track for floats too
2017-11-20 10:57:39 -02:00
Roberto Ierusalimschy
c47111bd4e
'io.read' accepts multiple formats in a single string argument
2017-11-16 14:28:36 -02:00
Roberto Ierusalimschy
e4e5aa85a2
detail ('signal' -> 'sign' in comments)
2017-11-16 11:19:06 -02:00
Roberto Ierusalimschy
4c0e36a46e
new instruction 'OP_EQK' (for equality with constants)
2017-11-16 10:59:14 -02:00
Roberto Ierusalimschy
5440b42f43
using 'trap' to stop 'luaV_execute' when necessary (tracing and
...
to update its copy of 'base' when the stack is reallocated)
2017-11-13 13:36:52 -02:00
Roberto Ierusalimschy
7d4828cc9f
avoid accessing wrong union field
2017-11-13 10:26:30 -02:00
Roberto Ierusalimschy
62f3b7c472
detail
2017-11-13 10:20:51 -02:00
Roberto Ierusalimschy
fb9be62f79
includes 'stdio.h' to allow prints when testing
2017-11-13 10:19:35 -02:00
Roberto Ierusalimschy
7c0175bc83
removed unused variable 'islocked'
2017-11-09 11:31:29 -02:00
Roberto Ierusalimschy
32fef60743
detail ('Protect' defined as an expression)
2017-11-08 17:01:02 -02:00
Roberto Ierusalimschy
26679ea35b
new function 'luaV_flttointeger' to convert floats to integers (without
...
string coercions) + string operands to bitwise operations handled
by string metamethods
2017-11-08 12:50:23 -02:00
Roberto Ierusalimschy
c3e5946fb2
new format for JUMP instructions (to allow larger offsets)
2017-11-07 15:20:42 -02:00
Roberto Ierusalimschy
ad0704e40c
back to 'CallInfo' (no gains with its removal)
2017-11-07 11:25:26 -02:00
Roberto Ierusalimschy
5a3f26f855
fitting a StackValue structure into 32 bytes (for 64-bit machines)
2017-11-06 15:34:06 -02:00
Roberto Ierusalimschy
93fd67b793
no more 'CallInfo' structure
2017-11-04 10:57:02 -02:00
Roberto Ierusalimschy
6bb3e40a8d
'lua_Debug' not using 'CallInfo'
2017-11-03 18:41:05 -02:00
Roberto Ierusalimschy
7612f7735d
removing uses of 'CallInfo'
2017-11-03 17:33:22 -02:00
Roberto Ierusalimschy
472c560705
no more useful fields in CallInfo
2017-11-03 15:22:54 -02:00
Roberto Ierusalimschy
54eb35a8aa
more fields moved out of 'CallInfo'
2017-11-03 10:12:30 -02:00
Roberto Ierusalimschy
ba36180fd7
new API for 'lua_resume' + cleaning the uses of the 'extra' field in
...
'CallInfo'
2017-11-02 09:28:56 -02:00
Roberto Ierusalimschy
b9e76be8a6
using 'L->func' when possible
2017-11-01 16:20:48 -02:00
Roberto Ierusalimschy
c5482468fd
baby steps to remove 'CallInfo': keeping 'L->func' correct
2017-10-31 15:54:35 -02:00
Roberto Ierusalimschy
ad5dcdcf0f
detail: in 'isinstack', check against the whole stack instead
...
of against the stack frame
2017-10-31 15:14:02 -02:00
Roberto Ierusalimschy
de9128d09d
do not mess up the debt when the collector is not running
2017-10-31 13:29:28 -02:00
Roberto Ierusalimschy
1d8920dd7f
some cleaning in GC parameters
2017-10-11 09:38:45 -03:00
Roberto Ierusalimschy
911f1e3e7f
raw operation should not convert strings to numbers
2017-10-10 17:05:40 -03:00
Roberto Ierusalimschy
a1ef58b3a5
eplicit 1-bit opcode operand 'k'
2017-10-04 18:56:32 -03:00
Roberto Ierusalimschy
283e7455ff
detail
2017-10-04 18:53:03 -03:00
Roberto Ierusalimschy
8fbe9e3470
new opcodes with immediate integer operand for all arithmetic operations
2017-10-04 12:49:24 -03:00
Roberto Ierusalimschy
9ed9f40f1e
avoid warning about 'const'
2017-10-04 12:49:05 -03:00
Roberto Ierusalimschy
940472c75c
opcode size increased to 7 bits
2017-10-02 19:51:32 -03:00
Roberto Ierusalimschy
f3b3d9b5c2
string constants (Kstr) must fit into 'B' register
2017-10-02 19:50:57 -03:00
Roberto Ierusalimschy
7f9a32ad85
new function 'printcode'
2017-10-01 16:17:51 -03:00
Roberto Ierusalimschy
bc1b0733b8
avoid the use of bit 'Bk' ('B' will lose this bit soon)
2017-10-01 16:13:43 -03:00
Roberto Ierusalimschy
722bdbe17d
no more 'getBMode'-'getCMode' (imprecise + we will need more space
...
for op mode) + better control of op modes
2017-09-28 13:53:29 -03:00
Roberto Ierusalimschy
1b10033583
new function 'luaT_trybiniTM'
...
to handle tag methods for instructions with immediate integer arguments
2017-09-27 15:59:08 -03:00
Roberto Ierusalimschy
00e728af88
binary operators use R instead of RK
...
faster + nobody uses RK(B), so B can be smaller (freeing one bit
for more opcodes, soon)
2017-09-26 15:14:45 -03:00
Roberto Ierusalimschy
13256a4173
detail
...
put explicit all cases for a switch of an enumeration
2017-09-26 14:10:49 -03:00
Roberto Ierusalimschy
abb17cf19b
new opcode OP_LOADF (load immediate float)
2017-09-19 15:38:14 -03:00
Roberto Ierusalimschy
e0c0e2ee14
comments (documentation about instruction formats)
2017-09-18 13:07:54 -03:00
Roberto Ierusalimschy
022e4427cf
detail (keep OP_LOADK and OP_LOADKX together)
2017-09-15 11:19:06 -03:00
Roberto Ierusalimschy
80d9b09f35
jumps do not close upvalues (to be faster and simpler);
...
explicit instruction to close upvalues; command 'break' not
handled like a 'goto' (to optimize removal of uneeded 'close'
instructions)
2017-09-13 16:50:08 -03:00
Roberto Ierusalimschy
029d269f4d
bug: dead keys with nil values can stay in weak tables
2017-08-31 13:14:41 -03:00
Roberto Ierusalimschy
ac65bab25f
jumps in 'for' loops don't need to be signed
2017-08-14 15:33:14 -03:00
Roberto Ierusalimschy
f185c0132e
comment in code fragment
2017-08-12 10:12:42 -03:00
Roberto Ierusalimschy
b77f792b23
comment
2017-08-12 10:12:21 -03:00
Roberto Ierusalimschy
4053eae9eb
bug: Lua does not check GC when creating error messages
2017-07-27 10:55:38 -03: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
11769b203f
new version (5.4)
2017-07-27 10:36:54 -03:00
Roberto Ierusalimschy
b1daa069ba
bug: Lua does not check GC when creating error messages
2017-07-10 14:35:12 -03:00
Roberto Ierusalimschy
4dff277255
coercion string->number in arithmetic operations moved to string
...
library
2017-07-07 13:34:32 -03:00
Roberto Ierusalimschy
07db10813c
'OP_VARARG' has the vararg parameter as an operand
2017-06-29 12:38:41 -03:00
Roberto Ierusalimschy
f96497397a
new type 'StackValue' for stack elements
...
(we may want to put extra info there in the future)
2017-06-29 12:06:44 -03:00
Roberto Ierusalimschy
5a1c8d8ef3
new constant 'LUA_GNAME' for the name of the global table "_G"
2017-06-27 15:32:49 -03:00
Roberto Ierusalimschy
124bfd2081
dumping ints and size_ts compacted
2017-06-27 11:21:12 -03:00
Roberto Ierusalimschy
b42430fd3a
'lineinfo' in prototypes saved as differences instead of absolute
...
values, so that the array can use bytes instead of ints, reducing
its size. (A new array 'abslineinfo' is used when line differences
do not fit in a byte.)
2017-06-27 08:35:31 -03:00
Roberto Ierusalimschy
60a7492d24
new type 'ls_byte' for signed bytes
2017-06-27 08:35:01 -03:00
Roberto Ierusalimschy
73ec04fcf3
no more 'DEADKEY'. Table traversals do not need to consider dead keys;
...
if the key is dead, it cannot be given to 'next'. Instead, we now
use a 'table' tag without the collectable bit, which makes it
a unique tag good enough to reserve space.
2017-06-12 11:21:44 -03:00
Roberto Ierusalimschy
d13a3fb070
detail
...
(removed empty spaces at the end of lines)
2017-06-09 16:16:41 -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
4bb30f461b
when assigning to a 'TValue', better assign only exact fields,
...
to allow us to put stuff after the 'TValuefields' if needed
2017-06-01 17:24:05 -03:00
Roberto Ierusalimschy
dad85e4131
macro 'setobj2t' may not be an expression
2017-06-01 17:23:27 -03:00
Roberto Ierusalimschy
b029e7ea20
macro 'luaV_fastget' may need protection ({}) to be used inside
...
'if's
2017-06-01 17:22:33 -03:00
Roberto Ierusalimschy
4bc33d64de
avoid overflows in computation of step size
2017-06-01 16:16:34 -03:00
Roberto Ierusalimschy
8821746841
updated GC states in function 'T.gcstate'
2017-05-31 15:54:58 -03:00
Roberto Ierusalimschy
72d82a296c
revamping the incremental collector
...
Some simplifications (not counting bytes, couting only slots visited;
no more 'gcfinnum'); more GC parameters; using vararg in 'lua_gc' to
set parameters in different GC modes
2017-05-26 16:14:29 -03:00
Roberto Ierusalimschy
4804bbd9bb
include first standard header files
...
(Some broken compiler has problems with 'signal.h' being included
without a definition for 'size_t'.)
2017-05-24 18:11:19 -03:00
Roberto Ierusalimschy
be0d951be8
bug: cannot reuse a dying upvalue
2017-05-24 15:54:54 -03:00
Roberto Ierusalimschy
a9dbc2d641
assert removed in 'luaO_arith'
...
(nobody calls it with L==NULL)
2017-05-24 10:47:11 -03:00
Roberto Ierusalimschy
c25380c28d
details (using proper version of 'setobj')
2017-05-23 09:50:11 -03:00
Roberto Ierusalimschy
03094da80c
detail (extra closing brackets)
2017-05-22 09:55:16 -03:00
Roberto Ierusalimschy
01c96ad12e
handling of inf, -inf, and NaN by string.format'%q'
2017-05-19 13:29:40 -03:00
Roberto Ierusalimschy
1bdc328c75
bug: Lua crashes when building sequences with more than 2^30 elements.
...
bug: Table length computation overflows for sequences larger than
2^31 elements..
2017-05-19 09:58:40 -03:00
Roberto Ierusalimschy
e3d52da144
BUG: in 'computesizes', 'twotoi' overflows when a sequence has
...
more than 2^30 elements.
2017-05-19 09:57:10 -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
84910e04e2
better implementation for 'hash_search', without using 'size_t'
...
(simpler to implement and to explain)
2017-05-19 09:47:00 -03:00
Roberto Ierusalimschy
de74289049
table field names for dedicated opcodes can be restricted to
...
small strings for slightly faster access
2017-05-18 16:44:19 -03:00
Roberto Ierusalimschy
92b3deaffa
details in OP_CALL + comments
2017-05-18 16:34:39 -03:00
Roberto Ierusalimschy
49f7aab62a
'lua_rawlen' returns 'lua_Unsigned' instead of 'size_t'. (Real
...
length of strings and userdata are limited by Lua integers,
but table length is hard to compute limiting it to 'size_t'.)
2017-05-18 09:34:58 -03:00
Roberto Ierusalimschy
3d879fbc5d
reimplementation of 'luaH_getn', trying to handle numeric limits
...
properly.
2017-05-16 16:07:08 -03:00
Roberto Ierusalimschy
6d95de83c6
no more field 'base' in CallInfo (base is always equal to 'func + 1',
...
with old/new vararg implementation)
2017-05-13 10:54:47 -03:00
Roberto Ierusalimschy
5c8770f896
back to old-style vararg system (with vararg table collecting extra
...
arguments)
2017-05-13 10:04:33 -03:00
Roberto Ierusalimschy
7647d5d13d
revamp of fast track for table access (table set uses the same
...
macros as table get + new macro for integer keys)
2017-05-11 15:57:46 -03:00
Roberto Ierusalimschy
7184f6343a
more integer fast tracks (for OP_LT, OP_LE, OP_SETTABLE, and OP_GETTABLE)
2017-05-10 14:32:19 -03:00
Roberto Ierusalimschy
b1b7790f7c
detail ('1' -> '1u' in unsigned operation)
2017-05-09 11:39:46 -03:00
Roberto Ierusalimschy
ab5a650029
details (direct access to 'Ck' bit in instructions)
2017-05-08 13:08:01 -03:00
Roberto Ierusalimschy
fb9de1b4d7
detail ('luaT_callbinTM' does not need to be extern)
2017-05-08 12:57:23 -03:00
Roberto Ierusalimschy
e8757a73e6
'luaV_execute' keeps local copy of program counter and hook mask,
...
to avoid excessive access to globals.
2017-05-05 14:16:11 -03:00
Roberto Ierusalimschy
4ce8d2047c
bug: Wrong code for a goto followed by a label inside an 'if'
2017-05-05 12:55:36 -03:00
Roberto Ierusalimschy
2376eb6347
barrier for prototype's cache (with new gray list 'protogray' to keep
...
prototypes to have their caches visited again) + constant 'MAXMISS'
2017-05-04 10:32:01 -03:00
Roberto Ierusalimschy
8634b2a011
added 'cachemiss' field to prototype to avoid wasting time checking
...
hits that fail too often
2017-04-30 17:43:26 -03:00
Roberto Ierusalimschy
5ecb31003f
bug: cannot "skip" labels after if-goto before the jump over the
...
'then' part
2017-04-29 15:09:17 -03:00
Roberto Ierusalimschy
a454e884e0
details in 'findsetreg'
2017-04-29 12:28:38 -03:00
Roberto Ierusalimschy
502a1d1108
new opcodes for table access with constant keys (strings and integers)
2017-04-28 17:57:45 -03:00
Roberto Ierusalimschy
173e41b2eb
new opcode OP_ADDI (for immediate integer operand) (Experimental)
2017-04-26 14:46:52 -03:00
Roberto Ierusalimschy
a3f9c1a77a
detail (using unsigned comparison in range check for LOADI)
2017-04-25 17:01:14 -03:00
Roberto Ierusalimschy
6dbae1b5d9
registers in a VINDEXED expression must be freed in order
2017-04-25 15:28:25 -03:00
Roberto Ierusalimschy
cb3d5dce30
opcodes 'OP_GETTABUP'/'OP_SETTABUP' operate only with string keys,
...
so they can use fast-track table access
2017-04-24 17:26:39 -03:00
Roberto Ierusalimschy
2caecf1b3e
type 'L_Umaxalign' replaced by macro 'LUAI_MAXALIGN', which is also added
...
to the auxlib buffer
2017-04-24 15:06:12 -03:00
Roberto Ierusalimschy
f399e6705f
ensures that "collectgarbage'step'" in generational mode does a
...
minor collection
2017-04-24 14:52:18 -03:00
Roberto Ierusalimschy
69371c4b84
'KGC_NORMAL' -> 'KGC_INC' + emergency GC signalled by flag (instead
...
of mode)
2017-04-24 13:59:26 -03:00
Roberto Ierusalimschy
6a98aa0bb0
new opcode LOADI (for loading immediate integers)
2017-04-20 16:53:55 -03:00
Roberto Ierusalimschy
c354211744
small bug in generational control
2017-04-20 15:24:33 -03:00
Roberto Ierusalimschy
f748b4bb40
macros to define default parameters for generational collection
2017-04-20 15:22:44 -03:00
Roberto Ierusalimschy
7ae180f8e8
corrected some checks about colors of old objects + new test function
...
'gcage'
2017-04-19 15:46:47 -03:00
Roberto Ierusalimschy
c7bdc0e0e8
first version of control for the generational collector
2017-04-19 14:02:50 -03:00
Roberto Ierusalimschy
a45945b6d5
new macro 'lua_pointer2str' to encapsulate use of 'l_sprintf' inside
...
the kernel
2017-04-19 13:34:35 -03:00
Roberto Ierusalimschy
9e1f1b1f62
detail in usage message for '-l' option
2017-04-19 09:49:17 -03:00
Roberto Ierusalimschy
4679294796
memory check adapted to generational mode
2017-04-18 16:42:12 -03:00
Roberto Ierusalimschy
f74b87c3c2
removed initialization of 'GCestimate' (it is initialized during
...
a GC cycle, when it start counting)
2017-04-12 15:56:25 -03:00
Roberto Ierusalimschy
16001acb15
small corrections + removal of debugging functions 'count' and
...
'printgray'.
2017-04-12 15:01:40 -03:00
Roberto Ierusalimschy
0c8a7e071b
'mainthread' lives in 'allgc' list, like everybody else
2017-04-11 16:00:27 -03:00
Roberto Ierusalimschy
a3d36fe283
Upvalues collected like everything else (with mark-sweep) instead
...
of reference count (simpler and better for generational mode)
2017-04-11 15:41:09 -03:00
Roberto Ierusalimschy
9569ad6b0d
Comments for generational collector
2017-04-10 10:33:04 -03:00
Roberto Ierusalimschy
2331e1beec
small changes in 'luaC_upvalbarrier'
2017-04-06 10:08:56 -03:00
Roberto Ierusalimschy
e4287da3a6
generational collector (still not complete)
2017-04-05 13:50:51 -03:00
Roberto Ierusalimschy
1a1b2f3d7f
added 'return' to calls to 'luaL_error' (to signal to the compiler
...
that the function cannot continue past that call)
2017-03-14 09:40:44 -03:00
Roberto Ierusalimschy
f5f3df3bd1
generational collection: new attempt (still incomplete)
2017-02-23 18:07:34 -03:00
Roberto Ierusalimschy
e6c1e6005a
comments about gray lists
2017-02-15 16:52:13 -02:00
Roberto Ierusalimschy
d266d40dea
error when calling close method without arguments (e.g.,
...
|io.stdin.close()|)
2017-02-09 12:50:05 -02:00
Roberto Ierusalimschy
e354c6355e
small updates
2017-01-31 19:17:47 -02:00
Roberto Ierusalimschy
94c1b3a8ee
Handling of LUA_PATH/LUA_CPATH moved back to 'package' library
...
to avoid incompatibilites with previous releases
2017-01-12 15:14:26 -02:00
Roberto Ierusalimschy
08199ade4a
release 5.3.4 (year 2017)
2016-12-22 13:51:20 -02:00
Roberto Ierusalimschy
2a235312f0
detail (removing spaces at end of lines)
2016-12-22 11:08:50 -02:00
Roberto Ierusalimschy
9903dd52a3
Using LUAI_UAC* types more consistently on vararg calls
2016-12-20 16:37:00 -02:00
Roberto Ierusalimschy
24f6e236a3
'moveresults' and 'luaD_poscall' moved up in the file
2016-12-13 13:52:21 -02:00
Roberto Ierusalimschy
9f594ca6f5
LUA_PATHSUFFIX -> LUA_VERSUFFIX + LUA_VERSUFFIX used in the
...
definition of LUA_INITVARVERSION, too.
2016-12-13 13:50:58 -02:00
Roberto Ierusalimschy
4df4560bf5
detail (wrong comment)
2016-12-06 12:54:31 -02:00
Roberto Ierusalimschy
b2aa2ba046
using constants for "_LOADED" and "PRELOAD"
2016-12-04 18:17:24 -02:00
Roberto Ierusalimschy
beec5af201
'luaL_tolstring' uses metatable's "__name" when available
2016-12-04 18:09:45 -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
697593d8d5
bug: When a coroutine tries to resume a non-suspended coroutine,
...
it can do some mess (and break C assertions) before detecting the error.
2016-10-19 10:34:27 -02:00
Roberto Ierusalimschy
e2dc807c6e
check whether function is finalizer when finding a name for it +
...
comments + some instructions can call functions in unespected ways
(e.g., finalizers)
2016-10-19 10:32:10 -02:00
Roberto Ierusalimschy
138d00176c
new flag in 'CallInfo.callstatus' to tell whether function is running
...
as a finalizer
2016-10-19 10:31:42 -02:00
Roberto Ierusalimschy
8edbf57fb8
detail (ANSI C does not accept empty arguments to macros)
2016-09-20 13:37:45 -03:00
Roberto Ierusalimschy
7fe1a4cff3
cleaner and more correct code for 'luaD_shrinkstack' (the old
...
test "inuse <= LUAI_MAXSTACK" for stack overflow is not correct,
as the real maximum usable size is "LUAI_MAXSTACK - EXTRA_STACK")
2016-09-08 13:36:26 -03:00
Roberto Ierusalimschy
dbb6f11e8e
bug (with compat on): 'ipairs' can work with any type that provides
...
an __index; so, 'pairsmeta' should not check for tables. ('pairs'
already checks for tables through 'next'.)
2016-09-05 16:06:34 -03:00
Roberto Ierusalimschy
aeb4c6fff1
comments + removed unused variable
2016-09-05 15:53:02 -03:00
Roberto Ierusalimschy
3b91b07fd9
detail (macro 'l_checkmode' reimplemented as function)
2016-09-01 13:14:56 -03:00
Roberto Ierusalimschy
349badabc1
wrong test in '#if' for floating-point type
2016-08-22 14:21:12 -03:00
Roberto Ierusalimschy
e4a9e6fcca
do not eliminate varargs from functions that do not use varargs
...
(confuses the debug lib and gains very little in performance)
2016-08-01 16:51:24 -03:00
Roberto Ierusalimschy
9de2bb0d62
bug: When a coroutine tries to resume a non-suspended coroutine,
...
it coud do some mess (and break C assertions) before detecting the error.
Now it tests for those errors before anything else.
2016-07-29 14:12:44 -03:00
Roberto Ierusalimschy
d55fd3455b
redefine MAXINDEXRK (for debugging, to force most values to
...
go through registers)
2016-07-19 14:13:00 -03:00
Roberto Ierusalimschy
0d1c6f4188
MAXINDEXRK can be redefined (for debugging, to force most values to
...
go through registers)
2016-07-19 14:12:21 -03:00
Roberto Ierusalimschy
fc6b32bcaa
bug: Lua can generate wrong code in functions with too many constants
2016-07-19 14:12:07 -03:00
Roberto Ierusalimschy
de96e26afc
bug: 'checkoption' could read past end of string + 'os.date' can
...
handle embedded zeros
2016-07-18 14:58:58 -03:00
Roberto Ierusalimschy
de3fd8ab83
Handling of LUA_PATH/LUA_CPATH moved from package library to stand
...
alone interpreter (so that 'lua.c' concentrates all handling of
environment variables)
2016-07-18 14:55:59 -03:00
Roberto Ierusalimschy
788109a3de
new bug: Checking a format for 'os.date' may read pass the format string
2016-07-15 14:24:09 -03:00
Roberto Ierusalimschy
09c9fa36ea
small corrections for C++ compliance
2016-06-27 10:15:08 -03:00
Roberto Ierusalimschy
dcb2998aa6
bug: expression list with four or more expressions in
...
a 'for' loop can crash the interpreter. ('adjust_assign' must
remove extra expresssions from its registers.)
2016-06-22 12:48:25 -03:00
Roberto Ierusalimschy
fac00ca023
bug: expression list with four or more expressions in
...
a 'for' loop can crash the interpreter.
2016-06-21 14:22:34 -03:00
Roberto Ierusalimschy
6487fb11fc
all 'static' variables should be 'const'
2016-06-20 16:12:46 -03:00
Roberto Ierusalimschy
644799537f
allow more bits in 'callstatus' (use no extra space due to alignments)
2016-06-16 10:36:09 -03:00
Roberto Ierusalimschy
aa66ca76ce
'lua_pushglobaltable' returns 'void'
2016-05-30 12:53:28 -03:00
Roberto Ierusalimschy
707b0ba6e2
'string.format("%q")' writes 'math.mininteger' in hexa, to ensure
...
it is read back as an integer
2016-05-20 11:13:21 -03:00
Roberto Ierusalimschy
10b0b09555
do not convert decimal constants with overflow to integers.
...
(Therefore, they will be converted as floats)
2016-05-20 11:07:48 -03:00
Roberto Ierusalimschy
4d5ab9baa6
'string.pack("cn")' does not accept strings longer than 'n'
2016-05-18 15:19:51 -03:00
Roberto Ierusalimschy
b65252b39b
'singlevaraux' returns result only in 'var->k'
2016-05-13 16:10:16 -03:00
Roberto Ierusalimschy
fbd8614bdb
comment (FALLTHROUGH)
2016-05-13 16:09:46 -03:00
Roberto Ierusalimschy
f3b52a6061
'io.read("n")' accepts both a dot and the locale point as its
...
radix character + 'MAXRN' -> 'L_MAXLENNUM' + small detail in
'test2'
2016-05-02 11:03:19 -03:00
Roberto Ierusalimschy
0232fbffbe
now that 'luaO_str2num' always accepts a dot as a radix character,
...
the lexer does not need to bother with this issue.
2016-05-02 11:02:12 -03:00
Roberto Ierusalimschy
ed110f66c5
'luaO_str2num' (and, therefore, 'lua_stringtonumber', 'number',
...
and coercions) accepts both the locale point and a dot as its
radix character
2016-05-02 11:00:32 -03:00
Roberto Ierusalimschy
22093f9c6e
'string.format("%q", number)' ensures a dot as decimal point
2016-05-02 10:58:01 -03:00
Roberto Ierusalimschy
792ffaccf2
detail (macro should "use" all its arguments)
2016-05-01 17:06:09 -03:00
Roberto Ierusalimschy
57cdb60429
no more time limits to pattern matching (at least for now)
2016-04-22 13:36:30 -03:00
Roberto Ierusalimschy
89c09c8e40
match time limit defined by variable 'string.pattlimit'
2016-04-19 09:34:08 -03:00
Roberto Ierusalimschy
48baa5e89c
'os.time(t)' normalizes 't' fields
2016-04-18 10:06:55 -03:00
Roberto Ierusalimschy
fdd7209688
error handling in 'wrap' does not coerce numbers into string messages
2016-04-11 16:19:55 -03:00
Roberto Ierusalimschy
82a8e06524
details ('error' does not coerce numbers to strings + comments)
2016-04-11 16:18:40 -03:00
Roberto Ierusalimschy
c258870c59
diff for last bug was against wrong version
2016-04-11 12:34:21 -03:00
Roberto Ierusalimschy
e8e39a277f
'string.format"%q"' now works for all basic types (nil, boolean,
...
numbers, and strings)
2016-04-08 18:15:02 -03:00
Roberto Ierusalimschy
fff7d42a69
LUA_PACKPADBYTE -> LUAL_PACKPADBYTE (it is an internal library
...
name, not something to be usually configured)
2016-04-07 12:40:07 -03:00
Roberto Ierusalimschy
783aa8a9da
new way to avoid infinite loops in empty matches: "Python rule"
...
("Empty matches for the pattern are replaced only when not
adjacent to a previous match")
2016-03-31 16:07:42 -03:00
Roberto Ierusalimschy
8d4feb504f
do not try to ensure that 'sweepgc' points to a live object
...
when entering sweep phase ('entersweep'); that may be too
expensive to be done still inside the atomic step. Walking
one single object more often than not will work.
2016-03-31 16:02:03 -03:00
Roberto Ierusalimschy
d77a7a8c26
detail (comment)
2016-03-31 16:01:21 -03:00
Roberto Ierusalimschy
e747491b96
comments
2016-03-23 15:08:26 -03:00
Roberto Ierusalimschy
acff3ad88d
bug: 'gmatch' iterator fails when called from a coroutine different
...
from the one that created it
2016-03-23 14:12:17 -03:00
Roberto Ierusalimschy
e7b2e01d43
bug: label between local definitions can mix-up their initializations
2016-03-07 16:25:39 -03:00
Roberto Ierusalimschy
03ca6385dc
call 'checkGC' *after* creating new objects (this is how 'execute'
...
does it)
(It increases the changes that 'allgc' start with a non-white
object, which helps 'entersweep')
2016-02-29 11:27:14 -03:00
Roberto Ierusalimschy
7777b412de
When available, use metafield '__name' in error messages
2016-02-26 16:20:15 -03:00
Roberto Ierusalimschy
c3e9b14d24
'\0' is a control character, no need to check it explicitly
2016-02-25 16:42:55 -03:00
Roberto Ierusalimschy
7d6b78ee79
in 'table.move', destination table can be source table even if
...
given as an explicit extra argument
2016-02-25 16:41:54 -03:00
Roberto Ierusalimschy
5f3ad5731e
simpler yet definition for 'checkoption'
2016-02-09 10:16:11 -02:00
Roberto Ierusalimschy
494e9ba0f4
simpler code for 'checkoption' + added conversion specifiers specific
...
to Windows
2016-02-08 12:42:46 -02:00
Roberto Ierusalimschy
f79b4568ae
details (removed silly use of 'luaL_opt' + better error messages
...
in cases of "table expected")
2016-02-08 10:55:19 -02:00
Roberto Ierusalimschy
fd51651684
new macro 'vmfetch' to help changing code to computed goto's (macro
...
abstracts the code to run before each instruction)
2016-02-05 17:59:14 -02:00
Roberto Ierusalimschy
994374c4df
new release number + new year
2016-01-13 15:55:19 -02:00
Roberto Ierusalimschy
62f6652d53
no more extra space in 'luaL_checkstack'. (It was already useless
...
for the first call, and function works ok without that space
anyway (just error message misses the 'msg' component)
2016-01-08 13:33:09 -02:00
Roberto Ierusalimschy
9945253d57
details (comments + text of error messages)
2016-01-06 11:43:05 -02:00
Roberto Ierusalimschy
1f259be52a
'getcode' -> 'getinstruction'
2016-01-05 14:22:37 -02:00
Roberto Ierusalimschy
1a44e82200
'luaV_fastget' only treats the real fast case (table with a non-nil
...
value at given key, so that it does not need to check metamethods)
2016-01-05 14:07:21 -02:00
Roberto Ierusalimschy
a272fa66f0
bug: Metatable may access its own dealocated field when
...
it has a self reference in __newindex + some refactoring
2016-01-04 14:44:50 -02:00
Roberto Ierusalimschy
b12b635a90
more refactoring
2016-01-04 11:40:57 -02:00
Roberto Ierusalimschy
7cd7c2e0a1
Metatable may access its own dealocated field when
...
it has a self reference in __newindex.
2016-01-04 11:35:56 -02:00
Roberto Ierusalimschy
07cf8415e3
more comments + reordeing of union inside 'expdesc' to allow
...
static initialization of a VKINT value
2015-12-30 16:16:13 -02:00
Roberto Ierusalimschy
c0836dda74
avoid empty macro arguments (invalid in C89)
2015-12-21 11:02:14 -02:00
Roberto Ierusalimschy
384d1b47b0
comments (*lots* of them) + asserts
2015-12-18 11:53:36 -02:00
Roberto Ierusalimschy
19770b03a9
comments. (More explanation about kinds of expressions.)
2015-12-17 13:44:50 -02:00
Roberto Ierusalimschy
a01eba657e
reordering of some functions + 'code_label' renamed to 'code_loadbool'
2015-12-17 13:02:44 -02:00
Roberto Ierusalimschy
b7446ea88d
detail ('while' -> 'for') in 'luaK_patchclose'
2015-12-17 12:52:53 -02:00
Roberto Ierusalimschy
a051b3323e
comments (about hooks vs signals)
2015-12-16 14:40:07 -02:00
Roberto Ierusalimschy
c4e01c568a
make 'hook' volatile (as it may be changed in signal handling)
2015-12-16 14:39:38 -02:00
Roberto Ierusalimschy
bda090b961
comments + small code changes around stack usage when 'luaL_checkstack'
...
raises an error (and needs the stack to create the error message...)
2015-12-14 09:59:27 -02:00
Roberto Ierusalimschy
e383941652
in 'table.sort': 'typedef' for type of indices + removed stack check
...
(recursion is in the C stack, not in the Lua stack!)
2015-12-14 09:57:38 -02:00
Roberto Ierusalimschy
656b3cea1b
using 'sig_atomic_t' for 'hookmask' (as it can be changed inside
...
a signal)
2015-12-14 09:54:49 -02:00
Roberto Ierusalimschy
2d1d57bc18
comments
2015-12-14 09:53:27 -02:00
Roberto Ierusalimschy
03412af06e
detail (removed fixed argument to function 'callallpendingfinalizers')
2015-12-10 16:12:30 -02:00
Roberto Ierusalimschy
542dbd4c65
detail (moving bodies of 'while' to a separate line)
2015-12-09 13:21:28 -02:00
Roberto Ierusalimschy
c25d59a6bd
format "%s" in 'string.format' accepts embedded zeros when it
...
has no modifiers
2015-11-25 14:28:17 -02:00
Roberto Ierusalimschy
5936eb16d8
randomness in 'table.sort' used only when needed (big imbalance in
...
partition result) + small refactoring
2015-11-25 10:48:57 -02:00
Roberto Ierusalimschy
7dc3ca7b8e
handling 'clock_t' and 'time_t' correctly in ISO C point of view
2015-11-24 14:54:32 -02:00
Roberto Ierusalimschy
71344b5cac
easy the way to accept other modifiers for 'mode' in 'io.open'
2015-11-23 09:36:11 -02:00
Roberto Ierusalimschy
f230898ad6
tiny code refactoring in 'luaS_hash'
2015-11-23 09:32:51 -02:00
Roberto Ierusalimschy
3feb702df8
ensure argument to 'string.format("%s")' does not contain zeros
2015-11-23 09:31:21 -02:00
Roberto Ierusalimschy
c5112f7b15
details (comments)
2015-11-23 09:30:45 -02:00
Roberto Ierusalimschy
c231a5e2b6
using unsigned int (instead of int) in 'table.sort' to avoid overflows
...
(when computing the pivot and in original table size)
2015-11-23 09:17:31 -02:00
Roberto Ierusalimschy
dc9ac5b8c2
details (merging declarations with initialization)
2015-11-23 09:09:27 -02:00
Roberto Ierusalimschy
146508b28e
randomness in pivot for 'table.sort' done by a macro (easier to change)
2015-11-20 10:30:20 -02:00
Roberto Ierusalimschy
d103312661
details (typos in comments)
2015-11-19 17:16:22 -02:00
Roberto Ierusalimschy
2e8f8a18e4
detail
2015-11-17 14:00:28 -02:00
Roberto Ierusalimschy
f5b0459aba
details
2015-11-13 15:19:46 -02:00
Roberto Ierusalimschy
d682b3c9ec
added separator for bugs in 5.3.1
2015-11-13 15:19:07 -02:00
Roberto Ierusalimschy
fc085aa627
new release number (5.3.2)
2015-11-13 15:18:42 -02:00
Roberto Ierusalimschy
9a5d6aedb7
trying to optimize a little 'luaD_poscall'
2015-11-13 11:24:26 -02:00
Roberto Ierusalimschy
89e3a84344
removed field 'n' from 'CallInfo' (not being used right now)
2015-11-13 10:16:51 -02:00
Roberto Ierusalimschy
04587b6256
macro with empty argument can be seen as macro with no argument; better
...
to avoid that
2015-11-12 16:08:58 -02:00
Roberto Ierusalimschy
bde03eeb48
in 'table.sort': tighter checks for invalid order function +
...
"random" pivot for larger intervals (to avoid attacks with
bad data)
2015-11-12 16:07:25 -02:00
Roberto Ierusalimschy
330d426ffd
avoid the use of deprecated functions 'luaL_checkunsigned'/
...
'lua_pushunsigned'
2015-11-11 17:08:09 -02:00
Roberto Ierusalimschy
02340375be
janitor work on 'table.sort': added comments, partition code moved
...
to a separated function, code conventions updated, etc. No changes
at all in the logic/algorithm
2015-11-06 14:07:14 -02:00
Roberto Ierusalimschy
5100bc8aa1
no need for a special case to get long strings (not that common)
2015-11-03 16:35:21 -02:00
Roberto Ierusalimschy
ebb2afa54b
allow 'set' macros to be used when 'L' is not available (as it was
...
needed only for assertions)
2015-11-03 16:33:10 -02:00
Roberto Ierusalimschy
7485512384
added comment and assert about dead keys
2015-11-03 16:10:44 -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
d356183402
new function 'luaS_hashlongstr'
2015-11-03 13:36:01 -02:00
Roberto Ierusalimschy
e61ee8a036
in 'luaD_call', use two functions instead of one with fixed boolean
...
argument + stack error handling in 'luaD_call' moved to a separated
function
2015-11-02 16:48:49 -02:00
Roberto Ierusalimschy
ff1289a361
in 'luaD_call', use two functions instead of one with fixed boolean
...
argument
2015-11-02 16:48:07 -02:00
Roberto Ierusalimschy
cd73f3ccc5
now that we have a counter for CallInfos, use it for a more
...
accurate value for the memory used by a thread
2015-11-02 14:19:29 -02:00
Roberto Ierusalimschy
8c1fb91802
macro 'incr_top' replaced by function 'luaD_inctop'. (It is not used
...
in critical time pathes, can save a few bytes without the macro)
2015-11-02 14:09:30 -02:00
Roberto Ierusalimschy
33b366ec32
added counters for total and individual CallInfo entries (to allow
...
better syncronization between CallInfo size and stack size)
2015-11-02 14:01:41 -02:00
Roberto Ierusalimschy
c5363a1b58
in 'luaD_precall', in vararg functions, complete missing parameters
...
only after moving them to final place (avoids checking the stack
again)
2015-11-02 12:06:01 -02:00
Roberto Ierusalimschy
332a06bbd1
'luaO_pushvfstring' now uses 'incr_top' to increment top.
2015-11-02 12:02:35 -02:00
Roberto Ierusalimschy
ffd0d1232d
using more "conventional" loops in 'luaD_poscall' (probably a little
...
more efficient?)
2015-11-02 09:48:59 -02:00
Roberto Ierusalimschy
07a2dcacbf
flag CIST_REENTRY changed to CIST_FRESH (its negation); fresh invocations
...
seem to be less frequent than reentries. (So, avoid setting flag on
the frequent case.)
2015-11-02 09:43:17 -02:00
Roberto Ierusalimschy
c874abac98
with 'fast tracks', there is no need to do raw accesses in 'ipairs'
2015-10-29 13:21:04 -02:00
Roberto Ierusalimschy
789e423b32
corrected comparisons of signed (int) with unsigned (size_t)
2015-10-29 13:11:41 -02:00
Roberto Ierusalimschy
96ec8671b1
macro 'buff2num' replaced by its body (it caused more harm than good
...
to readability)
2015-10-28 16:51:47 -02:00
Roberto Ierusalimschy
cc3a42b190
option 'c' in 'string.pack' accepts any string size (truncating
...
if larger and padding if smaller)
2015-10-28 15:56:51 -02:00
Roberto Ierusalimschy
6707ce6349
function prepares vararg only if it really uses them (chunks
...
are always declared vararg but seldom uses them)
2015-10-28 15:28:40 -02:00
Roberto Ierusalimschy
257961c601
OP_SELF can use 'luaV_fastget' specialized for strings, as it
...
is applied only to string keys
2015-10-28 12:50:09 -02:00
Roberto Ierusalimschy
ae515a346c
comments for luaD_precall/luaD_poscall
2015-10-28 10:25:36 -02:00
Roberto Ierusalimschy
3cdf1d676b
details (avoid 'case' inside block + avoid using one variable for
...
two roles)
2015-10-28 10:06:45 -02:00
Roberto Ierusalimschy
82129b9266
use macro 'hasjumps' to test whether expression has jumps...
2015-10-26 12:27:47 -02:00
Roberto Ierusalimschy
8004ab756f
hook test in 'luaV_execute' reduced to minimum (rest done in
...
'luaG_traceexec'; no difference in performance for the non-hook
case, but keeps 'luaV_execute' a little simpler) + 'base' updates
replaced by 'Protect' (which serves this rule)
2015-10-22 12:40:47 -02:00
Roberto Ierusalimschy
ee5ef0f295
hook test in 'luaV_execute' reduced to minimum (rest done in
...
'luaG_traceexec'
2015-10-22 12:40:47 -02:00
Roberto Ierusalimschy
5bdee4f810
small changes to allow 'precall' to spend time preserving 'func'
...
only when needed (that is, when stack actually changes)
2015-10-21 16:40:47 -02:00
Roberto Ierusalimschy
48098c42ff
generic definitions for float types moved to before variable definitions
...
(so that specific cases can redefine these generic definitions if
needed)
2015-10-21 16:17:40 -02:00
Roberto Ierusalimschy
3ad55386c4
'condchangemem' also may need to run 'pre'/'pos'
2015-10-21 16:15:15 -02:00
Roberto Ierusalimschy
caf8278710
added comments
2015-10-20 16:00:19 -02:00
Roberto Ierusalimschy
f7670781cf
cleaner definition for 'luaC_condGC', using 'pre'/'pos' parameters
2015-10-20 15:56:21 -02:00
Roberto Ierusalimschy
df8b996bcc
'Protect' in table operations is not needed in the fast track
...
+ removal of a few dead macros
2015-10-20 15:41:35 -02:00
Roberto Ierusalimschy
75d5a8924c
macro 'addbuff' was using external variable name, instead of using
...
its parameter name inside the macro.
2015-10-20 11:11:05 -02:00
Roberto Ierusalimschy
880f82d089
'*' as a number means stack size, so that "return *" returns
...
all values in the stack.
2015-10-12 13:38:19 -03:00
Roberto Ierusalimschy
1a741157cb
avoid (undefined behavior) integer 'overflow' in left shift
2015-10-08 12:55:35 -03:00
Roberto Ierusalimschy
0c78de0d6d
avoid calling write function with empty block
2015-10-08 12:53:49 -03:00
Roberto Ierusalimschy
df45f7118b
detail (added assertion)
2015-10-08 12:53:31 -03:00
Roberto Ierusalimschy
880df57e52
detail (removed unreacheable 'break')
2015-10-08 12:53:05 -03:00
Roberto Ierusalimschy
8949904783
allow NULL string when length is zero in 'lua_pushlstring' and
...
'luaL_addlstring'
2015-10-06 13:10:22 -03:00
Roberto Ierusalimschy
9294466234
detail (string cache a bit smaller by default)
2015-10-06 11:29:49 -03:00
Roberto Ierusalimschy
e290bd6760
in 'luaL_traceback', print correct number of levels even when
...
initial level is not 1.
2015-10-02 12:46:49 -03:00
Roberto Ierusalimschy
dc4232379d
detail (ensure subtraction is done unsigned)
2015-10-02 12:39:23 -03:00
Roberto Ierusalimschy
10fffcd80a
'gmatch' keeps its state in a userdata (keeping the same 'MatchState'
...
across calls)
2015-09-28 15:05:01 -03:00
Roberto Ierusalimschy
8264dbc2bb
implemented counter to abort non-linear behavior in pattern matching
2015-09-26 15:45:03 -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
0f1f51be4b
'table.move' tries to copy elements in increasing order
...
whenever possible
2015-09-17 12:53:50 -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
bda83e22c0
'tablib' does not try to use raw operations when possible: fast
...
track should make standard operations fast enough to forgo
raw accesses
2015-09-09 12:42:30 -03:00
Roberto Ierusalimschy
364cdbdbdb
'setobj2t' incorporated into 'luaV_fastset' + 'invalidateTMcache'
...
is not needed in the fast track (as it does not create new
entries) + small bug in 'auxsetstr' (calling barrier with wrong
object) + using 'setobj2t' without side effects in its arguments
2015-09-09 10:45:50 -03:00
Roberto Ierusalimschy
b91bc93fd3
'setobj2t' incorporated into 'luaV_fastset' + 'invalidateTMcache'
...
is not needed in the fast track (as it does not create new
entries)
2015-09-09 10:44:07 -03:00
Roberto Ierusalimschy
53be1451a8
new definition for macro 'checkliveness'
2015-09-08 13:55:43 -03:00
Roberto Ierusalimschy
eb0be12ceb
detail in macro 'checkliveness' + macro 'setobj2t' defined as an
...
expression (to be used in macro 'luaV_fastset')
2015-09-08 13:54:52 -03:00
Roberto Ierusalimschy
1198d82530
'lua_longassert' defined as an expression (instead of a command)
2015-09-08 13:53:56 -03:00
Roberto Ierusalimschy
6556fcfe5a
small janitor work
2015-09-08 12:49:25 -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
502214f8a5
added assert for NULL pointer in 'lua_pushlstring'
2015-08-25 15:50:37 -03:00
Roberto Ierusalimschy
ed19fe766c
added ';' at the end of "expression lines" ("return exp;") so that
...
an extra ";" at the end is enough to stop Lua printing the result
("return exp;;" is not valid)
2015-08-14 16:11:20 -03:00
Roberto Ierusalimschy
8f25d08637
'invalidateTMcache' not needed in all 'settable' uses
2015-08-03 17:40:26 -03:00
Roberto Ierusalimschy
3b795541c4
fast track for 'settable'
2015-08-03 16:50:49 -03:00
Roberto Ierusalimschy
20b9e59441
barrier macros rewritten as expressions
2015-08-03 16:40:42 -03:00
Roberto Ierusalimschy
935d9f7f90
new entry should not be commented out
2015-07-23 11:32:17 -03:00
Roberto Ierusalimschy
e247c3ada3
implementation of fast track for gettable operations
2015-07-20 15:24:50 -03:00
Roberto Ierusalimschy
b5dc2f9b0c
bug: 'io.lines' does not check maximum number of options
2015-07-20 13:37:12 -03:00
Roberto Ierusalimschy
5273477cb9
in 'lua_number2strx', use the call to 'l_sprintf' to add exponent
...
to result directly
2015-07-20 13:30:22 -03:00
Roberto Ierusalimschy
b9db9bd0ef
'lua_Number' added to 'L_Umaxalign' union
2015-07-15 12:57:13 -03:00
Roberto Ierusalimschy
050e8536bb
bug: 'io.lines' does not check maximum number of options
2015-07-15 11:40:28 -03:00
Roberto Ierusalimschy
2b61360d82
avoid overflows (detected with 'clang -ftrapv')
2015-07-13 10:30:03 -03:00
Roberto Ierusalimschy
5b6ac971f9
detail (comment)
2015-07-07 14:03:34 -03:00
Roberto Ierusalimschy
403e181d81
'strftime' puts its result directly into 'lua_Buffer'
2015-07-06 12:16:51 -03:00
Roberto Ierusalimschy
4af03c5ae1
better treatment for integer overflows + all errors throw an error
...
(instead of returning nil)
2015-07-04 13:35:14 -03:00
Roberto Ierusalimschy
bde17a419d
because of debt, 'totalbytes' can be negative (and therefore its
...
type must be signed)
2015-07-04 13:33:17 -03:00
Roberto Ierusalimschy
8950e0c049
avoid possibility of subtle arith. overflow
2015-07-04 13:32:34 -03:00
Roberto Ierusalimschy
8217e0d4fe
avoid subtle possibility of arithmetic overflow
2015-07-04 13:31:42 -03:00
Roberto Ierusalimschy
319ccfefbc
computations in numerical for loop must avoid overflows too
2015-07-04 13:31:03 -03:00
Roberto Ierusalimschy
6a8400ba4f
using 'clang' by default + changes in warnings ('old-style-declaration'
...
removed because it is included in 'extra' + 'strict-aliasing' removed
because it is included in 'all' + 'aggregate-return' removed because
no one would do it by mistake)
2015-07-01 14:52:09 -03:00
Roberto Ierusalimschy
2de3361c6c
detail
2015-07-01 14:47:12 -03:00
Roberto Ierusalimschy
e89763e964
simpler code for 'luaO_fb2int'
2015-06-26 16:32:07 -03:00
Roberto Ierusalimschy
be63d995c1
tiny bug: 'randomseed' was calling 'rand' (instead of 'l_rand')
...
to discard first value
2015-06-26 16:30:32 -03:00
Roberto Ierusalimschy
2b1fc1b38c
with string cache, it is not that important for 'type' to avoid
...
'lua_pushstring'
2015-06-26 16:25:45 -03:00
Roberto Ierusalimschy
f01c12c891
detail (cast to avoid mixing types in conditional expression)
2015-06-25 11:00:01 -03:00
Roberto Ierusalimschy
5aabb7a891
buffer size changed from size_t to int (it is always small) +
...
comments + assert that printf result fits in given buffer
2015-06-24 15:25:10 -03:00
Roberto Ierusalimschy
cb1e451999
detail
2015-06-24 15:23:57 -03:00
Roberto Ierusalimschy
43cff79bf7
detail
2015-06-21 10:50:29 -03:00
Roberto Ierusalimschy
95c3144393
redefine 'l_sprintf' to test correctness of buffer sizes given
...
to 'snprintf'
2015-06-18 11:27:44 -03:00
Roberto Ierusalimschy
19eb6ae580
using 'snprintf' in C99 (both for documentation of buffer sizes
...
and some complains from tools)
2015-06-18 11:26:05 -03:00
Roberto Ierusalimschy
cbe05b48bb
using 'lua_longassert' to avoid warnings
2015-06-18 11:25:26 -03:00
Roberto Ierusalimschy
e7f34ad395
better implementation for buffers (reallocated memory directly
...
with allocation function; generates much less garbage)
2015-06-18 11:23:14 -03:00
Roberto Ierusalimschy
a5cbb7c3a7
detail (i + 1 > exp is simply i >= exp)
2015-06-18 11:20:32 -03:00
Roberto Ierusalimschy
dcad08b76d
details (use original type when saving variable's value)
2015-06-18 11:19:52 -03:00
Roberto Ierusalimschy
afbf5c5dab
missing ']]' in long string
2015-06-18 11:05:28 -03:00
Roberto Ierusalimschy
a1415c0d72
bug in order NaN x int (tests must ensure that NaN does not get
...
converted to integer)
2015-06-09 12:53:35 -03:00
Roberto Ierusalimschy
2ecaf18138
using macros ('rttype' and 'settt_') to access "private" field 'tt_'
2015-06-09 11:21:42 -03:00
Roberto Ierusalimschy
cbef15f3ea
comment (FALLTHROUGH position)
2015-06-09 11:21:13 -03:00
Roberto Ierusalimschy
16e8bb360b
comment
2015-06-09 11:21:00 -03:00
Roberto Ierusalimschy
6628012e9e
new release number (5.3.1)
2015-06-03 10:03:38 -03:00
Roberto Ierusalimschy
ed1fe28bb8
When comparing integers with floats, use float as common type when
...
possible (i.e., when integer fits in a float without losses); seems
to be more efficient in architectures with native support for used
Lua numbers
2015-06-02 16:11:24 -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
02aed045de
bug: return hook may not see correct values for active local variables
...
when function returns
2015-05-22 16:32:42 -03:00
Roberto Ierusalimschy
72bd2ef6c5
dependencies updated
2015-05-22 16:29:43 -03:00
Roberto Ierusalimschy
d39bb51faa
bug: interpreter cannot pop activation frame before calling return
...
hook (as it may want to access local variables active by the end
of the function)
2015-05-22 14:48:19 -03:00
Roberto Ierusalimschy
6142e663e4
reuse of 'addinfo' by lexical errors
2015-05-22 14:45:56 -03:00
Roberto Ierusalimschy
6dc20ff293
'l <= r' for numbers has its own function, instead of using
...
'not (r < l)' (seems to be slightly more efficient)
2015-05-20 15:19:11 -03:00
Roberto Ierusalimschy
99391e24ea
new configuration macro 'l_mathlim' (simplifies some dependencies
...
on float type)
2015-05-20 14:39:23 -03:00
Roberto Ierusalimschy
0ec12c1bd1
new semantics for numerical order (following math regardless
...
representation)
2015-05-20 13:22:55 -03:00
Roberto Ierusalimschy
a71c0ab861
detail (removed useless '#include')
2015-05-20 13:22:30 -03:00
Roberto Ierusalimschy
04ba6ea83b
new semantics for equality int-float
2015-04-29 15:27:16 -03:00
Roberto Ierusalimschy
a1935b9cba
error message ("too complex" -> "too many registers") + MAXREGS
...
changed to 255 (no reason not to use maximum allowed)
2015-04-29 15:24:11 -03:00
Roberto Ierusalimschy
513c639bf9
patch for last bug corrected to be against last released version
...
(and not against last version in RCS...)
2015-04-13 13:13:25 -03:00
Roberto Ierusalimschy
69b5f7a410
some details in 'luaO_int2fb' + more consistent use of the locale
...
decimal point
2015-04-11 15:30:08 -03:00
Roberto Ierusalimschy
ae76c39712
Bug: suspended '__le' metamethod can give wrong result
2015-04-10 14:56:25 -03:00
Roberto Ierusalimschy
0d4a1f71db
re-organization of initial configuration options
2015-04-10 14:41:04 -03:00
Roberto Ierusalimschy
67bf789462
avoid using API functions inside the core
2015-04-06 09:23:48 -03:00
Roberto Ierusalimschy
48d0674c2e
more consistent use of locale radix character across Lua
2015-04-03 15:41:57 -03:00
Roberto Ierusalimschy
6ffe006f5c
detail (removed unused macro VARBITS)
2015-04-02 18:10:53 -03:00
Roberto Ierusalimschy
4998e852ec
new function 'log2' to test 'luaO_ceillog2' (if needed)
2015-04-02 18:10:21 -03:00
Roberto Ierusalimschy
65ac789565
detail (comment)
2015-04-02 18:09:51 -03:00
Roberto Ierusalimschy
cfc84c856d
'LUA_REAL_*' -> 'LUA_FLOAT_*' (everywhere else we are using 'float')
2015-03-31 09:00:07 -03:00
Roberto Ierusalimschy
63720a4290
janitor work (comments, variable names, some other details)
2015-03-30 16:51:00 -03:00
Roberto Ierusalimschy
484bf14a6b
calls to 'luaC_checkGC' in luaD_precall moved near to 'luaD_checkstack'
...
(which is what can need memory)
2015-03-30 13:05:23 -03:00
Roberto Ierusalimschy
abb2f5511d
detail ('b + base' -> 'base + b' to follow all other similar uses)
2015-03-30 12:45:01 -03:00
Roberto Ierusalimschy
fcc6e1220e
avoid expression with side effect (in debug mode) inside 'sizeof'
2015-03-30 12:43:51 -03:00
Roberto Ierusalimschy
3a91274547
details (avoid 'lint' warnings)
2015-03-30 12:42:59 -03:00
Roberto Ierusalimschy
f2a813ae10
details (avoid some 'lint' warnings)
2015-03-28 16:16:55 -03:00
Roberto Ierusalimschy
e723c75c02
details (avoid 'lint' warnings)
2015-03-28 16:14:47 -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
2b37f2150e
comments
2015-03-14 14:58:57 -03:00
Roberto Ierusalimschy
331632e8d8
code detail ('if' -> '?:')
2015-03-13 13:24:50 -03:00
Roberto Ierusalimschy
7d930ec694
use 'log2' when available
2015-03-12 11:04:04 -03:00
Roberto Ierusalimschy
0cf3b6495a
'ci_func' don't need to be exported
2015-03-11 13:10:41 -03:00
Roberto Ierusalimschy
b66fedadae
'lua_pushliteral' implemented with 'lua_pushstring' (to take
...
advantage of the cache)
2015-03-10 11:17:51 -03:00
Roberto Ierusalimschy
fd6e680e21
detail
2015-03-10 11:15:06 -03:00
Roberto Ierusalimschy
57c0db219b
line history keep lines without added 'return'
2015-03-09 18:57:05 -03:00
Roberto Ierusalimschy
4ba0cb4580
always use macros to operate on lua_Numbers
2015-03-07 16:30:16 -03:00
Roberto Ierusalimschy
a30c66f0fc
macro 'luai_apicheck'/'api_check' back with a 'lua_State' parameter
...
(some people use it)
2015-03-06 16:49:50 -03:00
Roberto Ierusalimschy
bb4baa73ea
allocation function is not exactly API (and cannot raise errors
...
like other API functions); better not use 'api_check' for cheking it.
2015-03-06 16:45:54 -03:00
Roberto Ierusalimschy
d7d44b038d
detail (use 'lua_pushliteral' to push an empty string)
2015-03-06 16:09:08 -03:00
Roberto Ierusalimschy
297512b34c
avoid using 'lua_pushliteral' in a non-zero-terminated string
2015-03-05 13:07:46 -03:00
Roberto Ierusalimschy
2ae2e6408e
avoid testing for NULL when marking objects that cannot be NULL
2015-03-04 10:51:55 -03:00
Roberto Ierusalimschy
a80cada914
new cache for interning strings
2015-03-04 10:31:21 -03:00
Roberto Ierusalimschy
a00013c8d0
'point2int' -> 'point2uint' (to reflect its actual result type)
2015-03-03 16:53:13 -03:00
Roberto Ierusalimschy
b9a1f27250
do not attempt emergency collection while building state (it is
...
useless, and state can be inconsistent)
2015-03-03 15:18:29 -03:00
Roberto Ierusalimschy
29aed28802
detail (use 'luaS_newliteral' when possible)
2015-03-03 15:17:04 -03:00
Roberto Ierusalimschy
951b562cf8
configuration for numerical types through only one #define for
...
each type
2015-03-02 13:59:01 -03:00
Roberto Ierusalimschy
6408bc0b7f
new macros 'chgfltvalue'/'chgivalue' (numerical for loop does
...
not need to set the type of its internal variable at each iteration)
2015-03-02 13:04:52 -03:00
Roberto Ierusalimschy
91efb4b895
LUA_COMPAT_5_1 needs some options deprecated from 5.2 to 5.3
2015-02-28 16:22:31 -03:00
Roberto Ierusalimschy
27c5b1b237
added patches to two bugs
2015-02-23 16:20:43 -03:00
Roberto Ierusalimschy
d51bdc166d
bug: 'string.format("%f")' can cause a buffer overflow (with long doubles)
...
bug: 'debug.getlocal' on a coroutine suspended in a hook can crash
the interpreter
2015-02-20 16:21:29 -02:00
Roberto Ierusalimschy
81245b1ad5
'numisinteger' (for table keys) replaced by 'luaV_tointeger' (old
...
'tointeger_aux'), which can do the same job.
2015-02-20 12:27:53 -02:00
Roberto Ierusalimschy
397ce11996
make 'hashfloat' configurable
2015-02-20 12:05:01 -02:00
Roberto Ierusalimschy
97f2aa5a44
bug: when manipulating other threads, there is no garanties about
...
their stack space
2015-02-19 15:06:21 -02:00
Roberto Ierusalimschy
419e2cb01d
detail (file does not need 'string.h')
2015-02-16 11:15:00 -02:00
Roberto Ierusalimschy
374f6c4612
detail ('fopen' needs 'stdio.h')
2015-02-16 11:14:33 -02:00
Roberto Ierusalimschy
4bdf9962bf
bug: suspended function can have its 'func' field not pointing to
...
its function, crashing debug functions
2015-02-13 14:01:17 -02:00
Roberto Ierusalimschy
e0306e386f
some changes in 'hashfloat' to avoid undefined (in ISO C) numerical
...
conversions
2015-02-13 11:05:34 -02:00
Roberto Ierusalimschy
2e6e53c7cc
added API checks to some unprotected 'top' increments
2015-02-11 16:47:22 -02:00
Roberto Ierusalimschy
2a57d2346e
detail
2015-02-09 16:05:46 -02:00
Roberto Ierusalimschy
7e425be975
bug (in 5.2): Chunk with too many lines can seg. fault
2015-02-09 15:57:45 -02:00
Roberto Ierusalimschy
0705e7b39f
detail (no need to write 'double' in source)
2015-02-09 15:41:54 -02:00
Roberto Ierusalimschy
4ccc4578b3
detail (use 'l_floor' instead of 'l_mathop(floor)')
2015-02-09 13:41:56 -02:00
Roberto Ierusalimschy
5e8c162b6c
detail
2015-02-05 15:50:24 -02:00
Roberto Ierusalimschy
c8d6cb0136
macros 'luai_num*' (for float arithmetic operations) moved to
...
llimits.h.
2015-02-05 15:15:33 -02:00
Roberto Ierusalimschy
0edcdf49c0
added comments documenting LUA_NOCVTN2S/LUA_NOCVTS2N
2015-02-05 14:53:34 -02:00
Roberto Ierusalimschy
b7dfd18612
make buffer for format specification a little larger (length modifier
...
can be larger than 2, e.g. "I64")
2015-02-04 10:54:31 -02:00
Roberto Ierusalimschy
8efcd411fe
own implementation for 'string.format("%a")' for C89 platforms
2015-02-04 10:52:57 -02:00
Roberto Ierusalimschy
90d016980f
detail ('luaL_getmetatable' does not return a boolean, but a tag)
2015-02-03 15:38:24 -02:00
Roberto Ierusalimschy
b3996c55f6
LUAL_BUFFERSIZE affects the API, so it is better not to change it
...
between releases of the same version. (The long double case seems
to be too rare, so that should not be a problem; moreover, that
case is related to a bug)
2015-01-16 15:26:56 -02:00
Roberto Ierusalimschy
438a9fcc78
LUAI_MAXSHORTLEN moved from 'luaconf.h' to 'llimits.h' (does not
...
affect the API and is seldom modified)
2015-01-16 15:15:52 -02: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
5b01cb39b5
larger MINSTRTABSIZE (standard Lua starts with ~230 strings, after
...
oppening the standard libraries)
2015-01-16 13:41:03 -02:00
Roberto Ierusalimschy
a0503305bd
comments
2015-01-16 11:26:55 -02:00
Roberto Ierusalimschy
965f74525b
removed macro LUAI_FIRSTPSEUDOIDX (that stuff does not need
...
to be configurable)
2015-01-13 17:50:30 -02:00
Roberto Ierusalimschy
3f2e21f0ea
Long double needs a larger LUAL_BUFFERSIZE (because
...
'string.format("%.99f", 1e4900)' can generate quite long strings),
but otherwise buffer can be 1~2K
2015-01-13 15:24:22 -02:00
Roberto Ierusalimschy
3509914916
BUG (when compiled with long double): buffer overflow when formatting
...
string.format("%.99f", 1e4930)
2015-01-13 15:18:25 -02:00
Roberto Ierusalimschy
ae27be40c9
better check for overflows in 'table.move' (removes restriction that
...
initial position should be positive)
2015-01-13 14:27:29 -02:00
Roberto Ierusalimschy
cdd26700e8
definition for 'MAXUPVAL' moved for a more "private" place and its
...
value and comment corrected to reflect current implementation
2015-01-13 13:49:11 -02:00
Roberto Ierusalimschy
a9a4bf68b0
typo in comment
2015-01-13 11:18:04 -02:00
Roberto Ierusalimschy
f31cc8e342
typo in error message
2015-01-12 17:32:32 -02:00
Roberto Ierusalimschy
3c55790ebe
'setkey' -> 'setnodekey' (to avoid conflicts with POSIX)
2015-01-05 11:52:37 -02:00
Roberto Ierusalimschy
0adfa773b9
new macro 'cast_func' adds '__extension__' (in gnu compilers) when
...
converting void* to function, to avoid warnings
2015-01-05 11:51:39 -02:00
Roberto Ierusalimschy
3317f5c6d9
includes 'stddef.h' (as it uses NULL)
2015-01-05 11:48:33 -02:00
Roberto Ierusalimschy
dbf911c516
detail (added -Wconversion as a comment, to be used ocasionally)
2015-01-02 11:03:52 -02:00
Roberto Ierusalimschy
3a29087cb7
'lua_setlocal' should not pop value when failing (to be consistent
...
with the manual and with 'lua_setupvalue')
2015-01-02 10:52:22 -02:00
Roberto Ierusalimschy
234fb7f695
clearer(?) code (also avoids a warning about 'c' being used
...
without initialization)
2015-01-02 10:50:28 -02:00
Roberto Ierusalimschy
c077d47465
does not define _XOPEN_SOURCE when LUA_USE_C89 is defined + defining
...
_XOPEN_SOURCE==0 undefines that macro
2014-12-29 14:54:13 -02:00
Roberto Ierusalimschy
8e5290d81e
all "divisions" (div,idiv,mod) by zero are not folded, to avoid
...
problems during compilation + does not fold zero results, as they
can collapse with -0.0 and the ANSI test to distinguish both needs
a division by zero (which we are trying to avoid) + removed macro
'luai_numinvalidop' (as its main use case were divisions by zero)
2014-12-29 14:49:25 -02:00
Roberto Ierusalimschy
a1c37f834a
detail (macro 'luai_numidiv' uses 'luai_numdiv' to compute the division)
2014-12-29 11:27:55 -02:00
Roberto Ierusalimschy
1a7868c1d5
bug: 'random' limit is 2^31-1, not RAND_MAX
2014-12-27 18:32:26 -02:00
Roberto Ierusalimschy
de3933480e
details
2014-12-27 18:31:43 -02:00
Roberto Ierusalimschy
50e2eb8954
change in macro 'vmcase', avoding code inside it. (Code inside the
...
macro harms tools such as debuggers.)
2014-12-27 18:30:38 -02:00
Roberto Ierusalimschy
94eb37dc73
new year (2015)
2014-12-26 15:24:27 -02:00
Roberto Ierusalimschy
900bdd5761
detail (to avoid warnings)
2014-12-26 12:46:07 -02:00
Roberto Ierusalimschy
a51069202a
removed macro 'luai_numinvalidop' (main motivation removed, as folding
...
does not handle any division by zero by default)
2014-12-26 12:44:44 -02:00
Roberto Ierusalimschy
fb6796ba06
removed useless initializations
2014-12-26 12:43:45 -02:00
Roberto Ierusalimschy
88ef06f4f3
comments were wrong (not updated about several changes)
2014-12-20 11:58:15 -02:00
Roberto Ierusalimschy
eb45f3a9b6
details in 'luaM_reallocvchar'
2014-12-19 15:26:14 -02:00
Roberto Ierusalimschy
6321041058
new macro 'luaM_reallocvchar' to allocate arrays of chars (avoids
...
uneeded tests and respective warnings)
2014-12-19 11:45:40 -02:00
Roberto Ierusalimschy
2b83711fba
new macro 'nvalue' (to convert an object to a float when we know
...
object is a number)
2014-12-19 11:36:32 -02:00
Roberto Ierusalimschy
3ae21a352c
detail (in test for 'luai_numinvalidop', use a round float)
2014-12-19 11:33:06 -02:00
Roberto Ierusalimschy
570143bf88
comment
2014-12-19 11:31:12 -02:00
Roberto Ierusalimschy
1465edf341
old Visual Studio versions did not support 'noreturn' attribute
2014-12-19 11:30:23 -02:00
Roberto Ierusalimschy
77e786d436
stupid bug in T.stacklevel (not in use by the tests)
2014-12-18 10:13:42 -02:00
Roberto Ierusalimschy
6d79752e65
Windows uses 'long long' (instead of '__int64') when present; again,
...
uses macro LLONG_MAX as a proxy for the support for 'long long'.
2014-12-16 15:17:30 -02:00
Roberto Ierusalimschy
75812a517b
added macro LUA_USE_I64 for separate control of use of Windows-specific
...
types
2014-12-16 14:20:01 -02:00
Roberto Ierusalimschy
151dc5cc5f
traverse loaded modules (instead of globals) for a name for a function +
...
removes prefix '_G.' from names (if present)
2014-12-14 16:32:26 -02:00
Roberto Ierusalimschy
0b6cfea005
comments
2014-12-13 15:57:00 -02:00
Roberto Ierusalimschy
c8da3fbc35
in traceback names, give preference to 'name' over '_G.name'
2014-12-13 15:47:58 -02:00
Roberto Ierusalimschy
c96cd1c647
reinsertion-control macro renamed: lconfig_h -> luaconf_h
2014-12-12 09:49:32 -02:00
Roberto Ierusalimschy
57e91b4159
correct computation for limit in 'getnum'
2014-12-11 12:03:07 -02:00
Roberto Ierusalimschy
ef7d29c666
better limits for 'sting.rep' and 'string.packsize'
2014-12-11 11:40:40 -02:00
Roberto Ierusalimschy
81ecaf6178
new specifiers in 'strftime' are defined in C99 (not Posix)
2014-12-10 13:42:42 -02:00
Roberto Ierusalimschy
27ab59bc16
'ipairs' needs an argument
2014-12-10 10:26:42 -02:00
Roberto Ierusalimschy
bd8ce7e331
macro 'LUA_C89_NUMBERS' makes a little easier to use C89 numerical types
2014-12-10 09:56:55 -02:00
Roberto Ierusalimschy
5c519a69d3
new function 'string.packsize'
2014-12-10 09:36:03 -02:00
Roberto Ierusalimschy
6f54b07663
give preference to global names in tracebacks
2014-12-10 09:31:32 -02:00
Roberto Ierusalimschy
741ad97e92
new parameter for testC instruction 'pcall' (error handler)
2014-12-10 09:30:51 -02:00
Roberto Ierusalimschy
b4633c586b
error handler does not need to be a function (can be a callable
...
object)
2014-12-10 09:30:09 -02:00
Roberto Ierusalimschy
5fae2a5b05
redefinition of LUAI_MAXSTACK to make stack-overflow tests run faster
2014-12-09 15:17:40 -02:00
Roberto Ierusalimschy
36efa6a6b9
no more 'preloadedlibs' when opening libraries (as it is dead code now)
2014-12-09 13:00:17 -02:00
Roberto Ierusalimschy
c6e74e41c9
handle case where function was called as a hook
2014-12-08 13:48:23 -02:00
Roberto Ierusalimschy
6909b5a2b4
In 'debug.gethook', does not query hook table (which may not exist) if
...
there is no hook set
2014-12-08 13:47:25 -02:00
Roberto Ierusalimschy
594d7266af
'assert' checks that it has (at least) one parameter + 'assert' ensures
...
it passes only one value to 'error'
2014-12-08 13:26:55 -02:00
Roberto Ierusalimschy
ab4a890d04
use 'namewhat' when building a traceback
2014-12-08 13:26:09 -02:00
Roberto Ierusalimschy
64e25a6186
avoid octal numerals
2014-12-08 13:12:07 -02:00
Roberto Ierusalimschy
460968353f
in test mode, debug library is not predefined (to allow testing
...
'preloadedlibs')
2014-12-06 18:42:58 -02:00
Roberto Ierusalimschy
32a1f54b9a
no more default size for option 'c' in pack/unpack
2014-12-04 14:25:40 -02:00
Roberto Ierusalimschy
6df197ec15
some functions from test module must be exported
2014-11-29 17:45:37 -02:00
Roberto Ierusalimschy
177807f21e
casts ('(int)' -> 'cast_int')
2014-11-29 15:38:33 -02:00
Roberto Ierusalimschy
92f02fff11
bug: lua_tounsignedx must cast to lua_Unsigned (of course...)
2014-11-29 15:24:05 -02:00
Roberto Ierusalimschy
125296c83d
next release won't be beta
2014-11-28 17:13:39 -02:00
Roberto Ierusalimschy
9c41d9d1df
removed unneeded barrier ('from' must be white)
2014-11-27 16:41:43 -02:00
Roberto Ierusalimschy
ad79eafe86
details (comments)
2014-11-25 16:21:57 -02:00
Roberto Ierusalimschy
fd179ab4b8
clearer notation for "compare" instruction
2014-11-25 12:51:33 -02:00
Roberto Ierusalimschy
bf163ea7f0
bug (' #3 ' causes seg. fault in 5.3-beta) + comments + 'codearith' ->
...
'codeexpval' (confusion about what operations function accept was
one of the reasons for the bug)
2014-11-24 12:59:22 -02:00
Roberto Ierusalimschy
075661ffde
new test for macro 'luai_numinvalidop'
2014-11-24 12:56:56 -02:00
Roberto Ierusalimschy
db5ac2fa0d
detail (buffer in 'LoadF' is related to files)
2014-11-21 10:17:58 -02:00
Roberto Ierusalimschy
1735c05ac7
avoid memory errors while a file is locked (when reading a line)
2014-11-21 10:17:33 -02:00
Roberto Ierusalimschy
5fbd40dbe5
'x//y' extended to floats
2014-11-21 10:15:57 -02:00
Roberto Ierusalimschy
049cf14cf9
'x//y' extended to floats + more comments about module and floor
...
division operations
2014-11-21 10:15:00 -02:00
Roberto Ierusalimschy
5d628519d3
simpler definition for 'luaV_tonumber_'
2014-11-19 13:05:15 -02:00
Roberto Ierusalimschy
244646bdf7
detail (LUAL_BUFFERSIZE has a larger variation among different
...
platforms)
2014-11-19 13:00:42 -02:00
Roberto Ierusalimschy
5bdfefd3a5
allows calling luaL_checkstack with no message (in runC)
2014-11-14 16:15:17 -02:00
Roberto Ierusalimschy
5873786e27
small bug (error of "chunk has too many lines" might use 't.token'
...
before reading the first token)
2014-11-14 14:06:09 -02:00
Roberto Ierusalimschy
cb59019f58
uses return value from luaL_getmetatable
2014-11-12 11:32:27 -02:00
Roberto Ierusalimschy
52c0f9575b
uses return value from lua_getfield
2014-11-12 11:31:51 -02:00
Roberto Ierusalimschy
4fde357130
details (matching parameter names with manual)
2014-11-12 11:30:15 -02:00
Roberto Ierusalimschy
e5fd1e5fe2
details (match parameter names with lua.h and manual)
2014-11-12 11:28:54 -02:00
Roberto Ierusalimschy
87b179e71d
detail (use new returned value from 'lua_getglobal' )
2014-11-11 17:41:27 -02:00
Roberto Ierusalimschy
b401d37188
detail (to avoid a "to avoid warnings" return)
2014-11-11 17:40:20 -02:00
Roberto Ierusalimschy
6624ccff26
independent code for 'printstack' + test for panic function can
...
ran code there
2014-11-11 15:15:06 -02:00
Roberto Ierusalimschy
9a38c08011
no need to ensure any stack space for panic function + some changes
...
in 'tryfuncTM' (small simplification)
2014-11-11 15:13:39 -02:00
Roberto Ierusalimschy
be87789a6c
details
2014-11-11 15:08:19 -02:00
Roberto Ierusalimschy
d1d1ddec1e
details
2014-11-10 16:41:19 -02:00
Roberto Ierusalimschy
bfa0898312
bug: memory error in panic mode does not push error message on
...
the stack + stack check in tryfuncTM + comments
2014-11-10 15:42:04 -02:00
Roberto Ierusalimschy
79b0d05480
new function 'T.checkpanic' (to check panic errors)
2014-11-10 15:41:36 -02:00
Roberto Ierusalimschy
779381fe9e
detail (comment)
2014-11-10 15:24:43 -02:00
Roberto Ierusalimschy
b6911c177d
luaL_loadbuffer replaced by luaL_loadstring (to test luaL_loadstring)
...
+ 'rawgetp'/'rawsetp' added to C interpreter
2014-11-10 12:47:29 -02:00
Roberto Ierusalimschy
9212175ffb
added missing cases for debug info about tag methods +
...
better error message for bitwise operators
2014-11-10 12:46:46 -02:00
Roberto Ierusalimschy
ad20689feb
better error message for bitwise operators (they are not arithmetic...)
2014-11-10 12:46:05 -02:00
Roberto Ierusalimschy
e320790154
using address instead of string for key for table 'CLIBS' in the
...
registry
2014-11-10 12:28:31 -02:00
Roberto Ierusalimschy
fee3aa518d
using address key (light userdata) for hook table, instead of
...
string
2014-11-10 12:27:16 -02:00
Roberto Ierusalimschy
b58602d93d
removed unneeded test (result of b_str2int is already checked
...
against length)
2014-11-10 12:25:52 -02:00
Roberto Ierusalimschy
74e10b9c3b
details (error messages)
2014-11-08 16:12:53 -02:00
Roberto Ierusalimschy
b044b8c182
detail (line break)
2014-11-08 15:57:08 -02:00
Roberto Ierusalimschy
a113e1498d
when checking thread consistency, check its entire stack (always
...
the entire stack must have valid values)
2014-11-07 16:07:17 -02:00
Roberto Ierusalimschy
17ca3b1763
cleaner test for overflow for range of 'math.random'
2014-11-07 09:31:58 -02:00
Roberto Ierusalimschy
50b18f60cb
detail
2014-11-05 16:55:43 -02:00
Roberto Ierusalimschy
ad73e5156e
more direct way to fill sign-extension extra bytes when packing
...
integers with sizes larger than lua_Integer + added comments
2014-11-05 16:50:29 -02:00
Roberto Ierusalimschy
720c68dabb
removed repeated flags (-Wall/-Wdisabled-optimization) + removed flag
...
-Wcast-align (Lua does some unconventional casts) + added flag -std=c99
+ added file lprefix.h in dependency lists
2014-11-05 11:02:26 -02:00
Roberto Ierusalimschy
81c39a5244
no need to cast '*s' to unsigned char when we know it is a digit +
...
no need to call 'luaO_hexavalue' for decimal digits
2014-11-04 17:16:25 -02:00
Roberto Ierusalimschy
cfabcbfb17
added macro for configuring padding value in 'string.pack'
2014-11-04 12:34:43 -02:00
Roberto Ierusalimschy
bde14c3adc
macro to change method of conversion from float to integer (make it
...
use floor intead of requiring an exact integral value)
2014-11-03 18:07:47 -02:00
Roberto Ierusalimschy
4b839d7c72
Definitions for Lua code that must come before any other header file
2014-11-03 13:12:44 -02:00
Roberto Ierusalimschy
c49edc4566
keep "#include <windows.h>" in this file, but without the
...
previous requirement that it must be included before any other
header file (it doesn't seem to matter)
2014-11-03 13:11:10 -02:00
Roberto Ierusalimschy
c5d52a5468
Windows uses "LONGLONG" option, even not having long long (it has __int64)
2014-11-02 17:35:39 -02:00
Roberto Ierusalimschy
e75c0148c3
comments (references to "ANSI C" changed to "ISO C", which is the
...
international name
2014-11-02 17:33:33 -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
c25072a246
'lua_load' sets _ENV for any chunk with upvalues (not just those
...
with exactly one upvalue)
2014-10-31 15:41:51 -02:00
Roberto Ierusalimschy
1a69a3ecea
LUA_WIN -> LUA_USE_WINDOWS
2014-10-31 13:54:06 -02:00
Roberto Ierusalimschy
dcfc3c9405
new option '=' (native endian) for pack/unpack
2014-10-31 13:53:31 -02:00
Roberto Ierusalimschy
4542fb9f78
comments (a few extra quotes around identifiers)
2014-10-30 16:53:28 -02:00
Roberto Ierusalimschy
80e817719d
default changed from C89 to C99 + extra tests before using C99
...
features (when possible) + LUA_32BITS use 'int' when possible
('long' can be 64 bits)
2014-10-30 16:50:03 -02:00
Roberto Ierusalimschy
96f3a31b24
Better organization of definitions in categories + removed
...
'_CRT_SECURE_NO_WARNINGS' (useless there) + LUA_ENV/luai_writestring/
luai_writeline/luai_writestringerror/LUA_INT32/LUAI_UMEM/LUAI_MEM
moved to other places (no need to be in luaconf.h) + changed definition
for LUAL_BUFFERSIZE
2014-10-29 16:01:26 -02:00
Roberto Ierusalimschy
ff6c034330
configurations for types 'lu_mem'/'l_mem'/'Instruction' moved to here
...
(from 'luaconf.h'), as they are not needed by the API and probably
will not be changed
2014-10-29 15:07:45 -02:00
Roberto Ierusalimschy
05afee0f50
definitions for 'luai_writestring'/'luai_writeline'/'luai_writestringerror'
...
moved to 'lauxlib.h' (they do not need to be stable or configurable) +
prefixes changed from 'luai_' to 'lua_' (they are not part of the core)
2014-10-29 14:12:30 -02:00
Roberto Ierusalimschy
351a446ec5
definition for 'LUA_ENV' moved from 'luaconf.h' to here (no need to
...
be visible outside Lua + no need for easy redefinitions)
2014-10-29 13:38:24 -02:00
Roberto Ierusalimschy
e9885efc7c
added comment and assert about an (impossible) division by zero
2014-10-29 13:02:53 -02:00
Roberto Ierusalimschy
59fbbf0a65
small simplifications in code for 'lua_strx2number'
2014-10-28 16:41:38 -02:00
Roberto Ierusalimschy
61c3c80177
detail
2014-10-28 16:23:31 -02:00
Roberto Ierusalimschy
9de384e27a
removed useless 'include math.h'
2014-10-28 15:27:50 -02:00
Roberto Ierusalimschy
4b526045fa
comment
2014-10-28 15:27:41 -02:00
Roberto Ierusalimschy
4870194380
small reorganization of tests around LUA_USE_C99
2014-10-27 17:21:56 -02:00
Roberto Ierusalimschy
41d0e66184
comments + Windows numeric types not used if LUA_ANSI is defined
2014-10-27 16:06:03 -02:00
Roberto Ierusalimschy
aa1bd8876c
comments
2014-10-27 16:05:37 -02:00
Roberto Ierusalimschy
7314acaa80
'T.limits' reports some more useful limits
2014-10-27 15:00:02 -02:00
Roberto Ierusalimschy
4b2521cd9e
better (and safer?) way to test native size of type 'int'
2014-10-27 14:59:31 -02:00
Roberto Ierusalimschy
491103708e
'MAXSTACK' -> 'MAXREGS' and moved to 'lcode.c' (there is no reason
...
to change that constant...)
2014-10-27 14:29:58 -02:00
Roberto Ierusalimschy
fa4d5c8689
pack/unpack do not handle final '\0' as an "option" (it streches
...
unnecessarily the switch range)
2014-10-27 11:30:24 -02:00
Roberto Ierusalimschy
aef2d711b1
detail
2014-10-26 13:45:41 -02:00
Roberto Ierusalimschy
bdf566a8a3
`name' in comments changed to 'name'
2014-10-25 09:50:46 -02:00
Roberto Ierusalimschy
c3c78030f7
avoid redeclaration of _CRT_SECURE_NO_WARNINGS + 'lua_numtointeger' ->
...
'lua_numbertointeger'
2014-10-24 09:42:47 -02:00
Roberto Ierusalimschy
ff9ca88aa6
added some casts to avoid warnings in some compilers
2014-10-24 09:42:29 -02:00
Roberto Ierusalimschy
463edee2fd
'lua_numtointeger' -> 'lua_numbertointeger'
2014-10-24 09:42:06 -02:00
Roberto Ierusalimschy
88ff582fd8
detail (using 'sizeof' instead of 'strlen' for length of a constant
...
string)
2014-10-22 14:55:57 -02:00
Roberto Ierusalimschy
6b12b82532
added 'l_' prefix for names that can be redefined externally
2014-10-22 09:44:20 -02:00
Roberto Ierusalimschy
d7a0179cd6
use 'opf' (float) variants only when explicitly allowed (LUA_USE_C99)
2014-10-21 12:38:46 -02:00
Roberto Ierusalimschy
6d613817d4
comments
2014-10-20 20:21:05 -02:00
Roberto Ierusalimschy
b8d412aa07
error in comment
2014-10-20 16:29:55 -02:00
Roberto Ierusalimschy
961760c9b6
message handler always adds a traceback to messages (even if they
...
are not strings), unless they have a __tostring method.
2014-10-20 16:19:26 -02:00
Roberto Ierusalimschy
57559547a3
in 'pack'/'unpack', endianness and alignment treated like options +
...
small changes in names and handling of internal options ('KOption')
2014-10-20 14:44:54 -02:00
Roberto Ierusalimschy
cfa84e1232
does not use 'long long' when LUA_ANSI is set
2014-10-20 14:32:05 -02:00
Roberto Ierusalimschy
0d31efb365
'lua_stringtonum' -> 'lua_stringtonumber'
2014-10-17 16:17:55 -03:00
Roberto Ierusalimschy
f97c64d7bf
macros 'LUA_QL'/'LUA_QL' deprecated
2014-10-17 13:28:21 -03:00
Roberto Ierusalimschy
ea3155e380
'debug.sizeof' removed
2014-10-17 08:07:26 -03:00
Roberto Ierusalimschy
c172a4f7c2
'dumpint' and related functions replaced by 'string.pack'/'string.unpack'
2014-10-17 07:55:28 -03:00
Roberto Ierusalimschy
f8e0d33b25
added "_CRT_SECURE_NO_WARNINGS" for Windows (to avoid warnings about
...
several standard C functions) + small changes in '#include's
2014-10-15 11:53:20 -03:00
Roberto Ierusalimschy
745618d941
'charpatt' -> 'charpattern'
2014-10-15 11:31:10 -03:00
Roberto Ierusalimschy
89602bf747
'lua_strtonum' -> 'lua_stringtonum'
2014-10-15 11:27:40 -03:00
Roberto Ierusalimschy
56d4537879
'$c' in 'lua_pushfstring' prints non-printable characters with
...
their codes
2014-10-10 19:23:04 -03:00
Roberto Ierusalimschy
18014ef2fd
better handling of systems that do not support 'long long'
2014-10-08 17:32:50 -03:00
Roberto Ierusalimschy
ffe7401ceb
avoid warnings in macro 'luaM_reallocv' + comments
2014-10-08 17:25:51 -03:00
Roberto Ierusalimschy
65ec3379b1
added some casts for the cases when lua_Number != double
2014-10-08 16:57:31 -03:00
Roberto Ierusalimschy
85fc9ecd5f
detail ('G(L)' -> 'g')
2014-10-08 09:20:26 -03:00
Roberto Ierusalimschy
2a21f6c894
'lua_Kcontext' -> 'lua_KContext'
2014-10-07 15:29:13 -03:00
Roberto Ierusalimschy
3670db99b6
comments
2014-10-06 18:34:34 -03:00
Roberto Ierusalimschy
e14a02c24f
when thread yields, real "func" is in field 'extra', not in 'func'
2014-10-06 14:06:49 -03:00
Roberto Ierusalimschy
15f4150518
alpha -> beta
2014-10-04 19:57:36 -03:00
Roberto Ierusalimschy
c5cae9362c
added two casts to avoid warnings in VS
2014-10-04 19:57:10 -03:00
Roberto Ierusalimschy
4f4e0e49bb
easier way to compile Lua 32
2014-10-03 09:55:44 -03:00
Roberto Ierusalimschy
2f4d429071
details (comments)
2014-10-03 09:54:57 -03:00
Roberto Ierusalimschy
27f7bd2e83
detail
2014-10-01 13:05:06 -03:00
Roberto Ierusalimschy
798660c9cd
deprecated "cast macros" ('luaL_checkint', 'luaL_optint', etc.)
2014-10-01 08:54:56 -03:00
Roberto Ierusalimschy
34b6664dcb
better to use 'long' to represent UTF-8 code points
2014-10-01 08:52:33 -03:00
Roberto Ierusalimschy
d35fff16d5
'ipairs' always stops at first nil element
2014-09-30 10:53:26 -03:00
Roberto Ierusalimschy
56699cd603
small change to avoid bug in some versions of the clang compiler
2014-09-26 11:09:21 -03:00
Roberto Ierusalimschy
8ede2c353c
detail in 'report' + message handler always is called with an
...
argument + 'report' already handles non-string error messages
2014-09-25 11:20:37 -03:00
Roberto Ierusalimschy
6384475ec4
'luaL_getmetafield' returns type of metafield (instead of a boolean)
2014-09-22 03:42:15 -03: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
0a6b58c3aa
weak tables that must be retraversed are kept in 'grayagain' list
...
until atomic phase (instead of going to their special lists) +
more comments
2014-09-03 13:54:41 -03:00
Roberto Ierusalimschy
979a663d2a
detail (error message from 'coroutine.status')
2014-09-01 15:00:04 -03:00
Roberto Ierusalimschy
22952d8973
'T.gccolor' classify dead objects too
2014-09-01 14:58:55 -03:00
Roberto Ierusalimschy
df608f842a
'linktable' -> 'linkgclist' (and used for all links with 'gclist')
2014-09-01 14:37:11 -03:00
Roberto Ierusalimschy
001bb46ae1
bug: Ephemeron table can wrongly collect entry with strong key
2014-09-01 13:56:01 -03:00
Roberto Ierusalimschy
9b25347a67
detail
2014-08-27 11:59:33 -03:00
Roberto Ierusalimschy
e401513086
new option 'p' for 'debug.sizeof' (size of a pointer)
2014-08-22 13:22:42 -03:00
Roberto Ierusalimschy
7f1a2ad699
new functions 'lua_geti/lua_seti' (non raw)
2014-08-21 17:07:56 -03:00
Roberto Ierusalimschy
a1ab5ab396
'table.copy' -> 'table.move' + optional parameter moved to the end +
...
several functions operate on "virtual" tables too
2014-08-21 16:13:55 -03:00
Roberto Ierusalimschy
01549fb1ed
'Csize' -> 'sizeof' + removed its 'b' option
2014-08-21 16:12:40 -03:00
Roberto Ierusalimschy
4fba117433
[un]'dumpint' -> [un]'dumpinteger'
2014-08-20 19:06:41 -03:00
Roberto Ierusalimschy
2be88d5084
'lua_Ctx' -> 'lua_Kcontext'
2014-08-01 14:33:08 -03:00
Roberto Ierusalimschy
f5c690b684
details in comments
2014-08-01 14:24:02 -03:00
Roberto Ierusalimschy
61fa462535
added cast to avoid warning
2014-08-01 14:22:57 -03:00
Roberto Ierusalimschy
fba9050d3d
release changed to (5.3) alpha
2014-07-31 10:44:30 -03:00
Roberto Ierusalimschy
d861706620
new macro 'cvt2num' to better control whether strings are convertible
...
to numbers
2014-07-30 11:42:44 -03:00
Roberto Ierusalimschy
34ac039fb8
new macro 'cvt2str' to better control whether numbers are convertible
...
to strings
2014-07-30 11:00:14 -03:00
Roberto Ierusalimschy
1aa5262634
do not assume numbers are coercible to strings
2014-07-30 10:59:24 -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
3ccbae84d2
added some casts between integral types (to avoid warnings)
2014-07-29 13:01:00 -03:00
Roberto Ierusalimschy
255d59ed5e
some janitorial work (comments, small refactoring)
2014-07-28 14:47:53 -03:00
Roberto Ierusalimschy
925d1b59f9
new function 'math.ult' (unsigned less than)
2014-07-28 14:35:47 -03:00
Roberto Ierusalimschy
03bbe1baf1
first implementation for 'table.copy'
2014-07-25 15:46:00 -03:00
Roberto Ierusalimschy
f9037ae8c1
'ipairs' respects metamethods
2014-07-24 16:33:29 -03:00
Roberto Ierusalimschy
57d8424146
extra space for new threads is initialized with a copy of the main
...
thread, not of the creator thread.
2014-07-24 13:17:56 -03:00
Roberto Ierusalimschy
baa0e23456
better support for extra user space associated with a Lua state
2014-07-24 11:00:16 -03:00
Roberto Ierusalimschy
55a710545c
detail (extra byte in LUAI_EXTRASPACE to test proper alignment of
...
a lua_State)
2014-07-23 14:16:50 -03:00
Roberto Ierusalimschy
753f2c1da4
better(?) alignment for some structures (pointers first)
2014-07-23 14:15:43 -03:00
Roberto Ierusalimschy
b3b8580606
comments + proper undef of compatibility macros + no need to undef
...
internal macros (this is the first definition)
2014-07-23 13:47:47 -03:00
Roberto Ierusalimschy
73ad16b5c6
no need for type 'pCallInfo'
2014-07-23 13:44:30 -03:00
Roberto Ierusalimschy
97e299c395
'lua_replace' implemented as a macro using 'lua_copy'
2014-07-22 15:07:47 -03:00
Roberto Ierusalimschy
c697aa30bc
more precise type for argument to 'aux_upvalue'
2014-07-21 13:02:57 -03: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
3c6d0aaa7d
'iswhite' and related macros now can work directly on any object
...
(no need to convert to 'GCObject')
2014-07-19 12:14:46 -03:00
Roberto Ierusalimschy
e43612aaf6
put the restriction that 'luaC_barrierback' works only on tables
...
in its prototype
2014-07-19 12:09:37 -03:00
Roberto Ierusalimschy
2898e2fd12
removed useless assertion (gcstate != GCSpause already implied by
...
other assertions) and wrong assertion (setmetatable uses this barrier
for tables too)
2014-07-19 11:44:19 -03:00
Roberto Ierusalimschy
8704fca0c9
in 'luaL_checkversion_' check numeric types first. (Other tests
...
depend on correct numeric type.)
2014-07-19 11:37:09 -03:00
Roberto Ierusalimschy
325e44d87e
no more "-2" for limits. (Limits should be precise; safety is in
...
the code that handles these limits.)
2014-07-18 15:29:12 -03:00
Roberto Ierusalimschy
54ac253343
detail (no need to define LUAI_USER_ALIGNMENT_T when it is not
...
defined; simpler to define 'L_Umaxalign' directly)
2014-07-18 15:18:45 -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
3511e186cd
ensure size for LUAI_USER_ALIGNMENT_T in tests is larger than the
...
structures it is aligning (in most architectures)
2014-07-18 10:27:45 -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
9aec500a26
no need for field 'gch' anymore
2014-07-17 14:27:49 -03:00
Roberto Ierusalimschy
5a9cc57a5e
change in GCObject: instead of being a union, it is now a structure
...
with the common header of all collectable objects; union is used
only for conversions. (Goal is to be able to check that the cast
'obj2gco' can have a check to ensure that object being converted
is really a collectable object.). This is the first step in the
change.
2014-07-17 14:09:50 -03:00
Roberto Ierusalimschy
1aa4f69b51
new type 'lua_Ctx' for continuation-function contexts (to allow type
...
to be configurable)
2014-07-17 10:53:37 -03:00
Roberto Ierusalimschy
8bb272a3e3
new conversion float->integer: conversion is valid only when
...
float has an exact representation as an integer
2014-07-17 09:30:53 -03:00
Roberto Ierusalimschy
c229ed597f
'requiref' checks 'package.loaded' before loading a module
2014-07-16 11:51:36 -03:00
Roberto Ierusalimschy
16b4110521
function 'type' keeps type names as upvalues to avoid creating strings
...
everytime it is called
2014-07-16 10:56:59 -03:00
Roberto Ierusalimschy
f14662fca6
detail (added placeholders for non-function fields to preallocate
...
space for them)
2014-07-16 10:56:14 -03:00
Roberto Ierusalimschy
a9af12bbe7
Table library now respects '__index'/'__newindex' metamethods
2014-07-16 09:44:52 -03:00
Roberto Ierusalimschy
5bbb4a06a6
removed unused parameter Ä'L' in macro 'api_check' and company
2014-07-15 18:26:50 -03:00
Roberto Ierusalimschy
d4fb848be7
added api check in 'lua_typename' (tag is valid)
2014-07-15 18:14:49 -03:00
Roberto Ierusalimschy
b9dcf9974d
detail (typos in comments)
2014-06-30 16:48:08 -03:00
Roberto Ierusalimschy
a77d263e86
unsigned-manipulation functions (lua_puhsunsigned, lua_tounsigned, etc.)
...
deprecated
2014-06-26 15:38:28 -03:00
Roberto Ierusalimschy
7cc40851e1
emergency collection can happen even when collector is stopped
2014-06-26 15:29:05 -03:00
Roberto Ierusalimschy
08a9c9faa3
detail (comment)
2014-06-26 15:28:24 -03:00
Roberto Ierusalimschy
84fe52dbeb
unsigned-manipulation functions (lua_puhsunsigned, lua_tounsigned, etc.)
...
deprecated
2014-06-26 14:25:11 -03:00
Roberto Ierusalimschy
10200585a7
var-arguments to the script come from 'arg' table (not from original
...
'argv' array)
2014-06-26 14:08:52 -03:00
Roberto Ierusalimschy
c94f11d783
'IntPoint' -> 'point2int' + ensure that casted value fits in
...
destination type
2014-06-26 13:17:35 -03:00
Roberto Ierusalimschy
54ac5960a8
LUA_MAXUNSIGNED was only used to define 2.0^intnumbits (and that
...
definition was not strictly portable), so it was removed and
replaced by a more correct and direct definition for 2.0^intnumbits
(only where it was needed)
2014-06-24 14:02:00 -03:00
Roberto Ierusalimschy
0e6229a953
use proper macros to convert 'GCObject' to other objects + better
...
type cheking in 'set*value' macros
2014-06-19 15:39:36 -03:00
Roberto Ierusalimschy
d2ab1aef31
detail (avoid too large macro)
2014-06-19 15:29:30 -03:00
Roberto Ierusalimschy
89b56e7d84
more precision between closure types ('LClosure' x 'CClosure')
2014-06-19 15:27:20 -03:00
Roberto Ierusalimschy
14929f5764
use appropriate macros to convert GCObject to specific types
2014-06-18 19:59:29 -03:00
Roberto Ierusalimschy
7021cc9bc8
allows different 'source' for each prototype, but inherits it from
...
parent when they are equal (only possible case for chunks created
by the parser)
2014-06-18 15:35:43 -03:00
Roberto Ierusalimschy
04da0a40c0
added assertion about sources being the same for all protos in a chunk
2014-06-18 10:54:31 -03:00
Roberto Ierusalimschy
eb67828236
changed macro for compatibility options + details
2014-06-18 10:24:01 -03:00
Roberto Ierusalimschy
94266dfdbd
source for all prototypes must be equal in a chunk; no need to store
...
each one separated
2014-06-18 10:21:12 -03:00
Roberto Ierusalimschy
e3871abe95
'math.ifloor' is back
2014-06-18 09:35:53 -03:00
Roberto Ierusalimschy
3fc25ff15b
macro 'checkobjref' accepts NULL (as all its uses checked for NULL
...
before) + user value from a userdata may not be a GC object
2014-06-17 14:13:29 -03:00
Roberto Ierusalimschy
fa3113ffbf
cleaner way to handle bit CIST_OAH (with auxiliar macros)
2014-06-12 16:07:30 -03:00
Roberto Ierusalimschy
d94bb6c273
janitor work on 'lua_resume' and related code
2014-06-11 13:01:55 -03:00
Roberto Ierusalimschy
5784331768
new items in default path for Windows
2014-06-10 16:21:20 -03:00
Roberto Ierusalimschy
88a9e51f34
bit-field CIST_YIELDED removed (it was never consulted)
2014-06-10 16:18:50 -03:00
Roberto Ierusalimschy
8b5940e7ca
must also reset CIST_OAH if necessary (CallInfo is not a fresh one)
2014-06-10 16:13:26 -03:00
Roberto Ierusalimschy
1a3656e56e
more relaxed rules for __eq metamethod (more similar to other
...
operators)
2014-06-10 15:53:18 -03:00
Roberto Ierusalimschy
542b6cfc02
no need for field 'status' in structure 'CallInfo' (after removal
...
of 'lua_getctx') + field 'old_allowhook' can be packed into a single
bit
2014-06-10 15:51:21 -03:00
Roberto Ierusalimschy
6f6fd96e3b
new type lua_KFunction + no more 'lua_getctx'
2014-06-10 14:41:38 -03:00
Roberto Ierusalimschy
35a6aad0d7
added comments
2014-06-09 13:32:18 -03:00
Roberto Ierusalimschy
23f0ff9517
lots of janitor work (including comments) + 'arg' table created
...
before running any script + changes in the parameters and return
of 'collectargs'
2014-06-05 17:42:06 -03:00
Roberto Ierusalimschy
355037528c
'math.mof' works with integers, too
2014-06-02 20:09:28 -03:00
Roberto Ierusalimschy
9e68c047ae
'assert' does not assume that the error object is a string
2014-06-02 00:06:26 -03:00
Roberto Ierusalimschy
e9d86eddf3
if numeral overflows the reading buffer, signal it as invalid input
...
(resulting in nil)
2014-06-02 00:00:51 -03:00
Roberto Ierusalimschy
11aefa4478
details (comments)
2014-06-01 21:03:16 -03:00
Roberto Ierusalimschy
5ebdd326b6
detail (to avoid warnings of unused variable)
2014-05-29 16:30:07 -03:00
Roberto Ierusalimschy
84db17b6fc
more "religious" definition for 'lua_numtointeger'
2014-05-27 10:59:03 -03:00
Roberto Ierusalimschy
456806f25c
no more 'math.ifloor' + new semantics for 'math.floor'/'math.ceil'
2014-05-26 14:13:52 -03:00
Roberto Ierusalimschy
c98f195eb9
function 'luaV_numtointeger' changed to a global macro
...
'lua_numtointeger' (tricky, small, and useful in several places)
2014-05-26 14:10:22 -03:00
Roberto Ierusalimschy
4d696c45b9
simpler handling of 'GCScallfin' state + more comments
2014-05-25 16:08:32 -03:00
Roberto Ierusalimschy
36715ab7c1
detail (comment)
2014-05-23 15:32:21 -03:00
Roberto Ierusalimschy
e966e53791
no more use of 'scanf' for reading numbers
2014-05-21 12:24:21 -03:00
Roberto Ierusalimschy
c4eff10322
small improvements concerning 'check_next'
2014-05-21 12:22:02 -03:00
Roberto Ierusalimschy
8a0acf0898
comments
2014-05-20 11:12:59 -03:00
Roberto Ierusalimschy
e2be310a85
better(?) implementation for 'pcall'/'xpcall' (regarding the insertion
...
of the boolean first result)
2014-05-16 15:54:01 -03:00
Roberto Ierusalimschy
17159b491c
more direct implementation of 'table.pack'
2014-05-16 15:53:25 -03:00
Roberto Ierusalimschy
0aa32fa0cb
small changes in field order in some structs to reduce padding
2014-05-15 17:41:27 -03:00
Roberto Ierusalimschy
8927c14317
removed macro 'luai_checknum' (as NaN trick is not doable now)
2014-05-15 17:28:39 -03:00
Roberto Ierusalimschy
3e977f02ac
added a few comments
2014-05-15 17:08:32 -03:00
Roberto Ierusalimschy
a73da6112d
deprecated library throws an error if called (instead of silently
...
not loading itself)
2014-05-15 16:28:34 -03:00
Roberto Ierusalimschy
6a5d87771f
added lots of new comments + small changes in code
2014-05-15 16:27:33 -03:00
Roberto Ierusalimschy
15e8405731
'LUA_COMPAT_ALL' -> 'LUA_COMPAT_5_1'/'LUA_COMPAT_5_2' + "@*" in
...
comments replaced by "@@". ("@*" is too distracting)
2014-05-15 12:24:32 -03:00
Roberto Ierusalimschy
fd1672ba98
avoid non-conformant pointer arithmetic in api check for 'lua_rotate'
2014-05-15 12:22:45 -03:00
Roberto Ierusalimschy
1ddb251d86
using a more conventional handling of stack space in 'io_readline'
2014-05-15 12:21:06 -03:00
Roberto Ierusalimschy
f8daddba50
added a compat option (although it will be off by default) to
...
the addition of '.0' to float->string conversions
2014-05-14 16:47:11 -03:00
Roberto Ierusalimschy
e58ef8d0bb
missing macro 'LUAMOD_API' in function to open library
2014-05-14 15:33:37 -03:00
Roberto Ierusalimschy
e3b9569e04
function 'reverse' uses appropriate variants of 'setobj' for better
...
documentation
2014-05-14 15:32:30 -03:00
Roberto Ierusalimschy
8b66040e34
several functions deprecated (cosh, sinh, atanh, pow, frexp, ldexp)
2014-05-14 13:59:27 -03:00
Roberto Ierusalimschy
965993da07
comments added to 'lua_rotate'
2014-05-14 11:20:17 -03:00
Roberto Ierusalimschy
5a5a834975
new API function 'lua_rotate'
2014-05-13 16:40:28 -03:00
Roberto Ierusalimschy
45c430eac0
addition of '.0' to float representation done by the kernel
2014-05-12 18:44:17 -03:00
Roberto Ierusalimschy
27d9219cf3
no more integer exponentiation
2014-05-12 18:22:05 -03:00
Roberto Ierusalimschy
12bd01c567
added comments to several functions
2014-05-12 16:13:32 -03:00
Roberto Ierusalimschy
626124d2d8
old POSIX systems need '<sys/types.h>' for 'off_t'
2014-05-11 11:46:19 -03:00
Roberto Ierusalimschy
5018104a60
better error message for unfinished long strings/comments
2014-05-11 11:45:43 -03:00
Roberto Ierusalimschy
ec11d132db
comments
2014-05-11 10:03:48 -03:00
Roberto Ierusalimschy
06dc893f88
in 'for' loops, make the limit an integer whenever initial value and
...
step are integers
2014-05-09 11:20:52 -03:00
Roberto Ierusalimschy
a09bd59615
'T.totalmem' accepts 0 for unlimited memory
2014-05-08 16:08:46 -03:00
Roberto Ierusalimschy
42ff788e53
comments
2014-05-08 15:58:46 -03:00
Roberto Ierusalimschy
1bd70a8e40
new function 'lua_isyieldable' (and 'coroutine.isyieldable')
2014-05-08 10:52:20 -03:00
Roberto Ierusalimschy
ef83457427
updated several 'fix' fields
2014-05-07 13:57:27 -03:00
Roberto Ierusalimschy
4833fb8273
marks for releases 5.2.2 and 5.2.3 + correction in last bug's description
2014-05-07 13:35:24 -03:00
Roberto Ierusalimschy
77e7ebca0a
better alignments (for 64-bit arquitectures) for structures 'Table' and
...
'TString'
2014-05-07 08:12:51 -03:00
Roberto Ierusalimschy
6d5324f92f
'math.fmod' handles integers as integers
2014-05-02 13:36:51 -03:00
Roberto Ierusalimschy
4fe11ae232
'lua_getuservalue' returns type of user value
2014-05-01 15:21:32 -03:00
Roberto Ierusalimschy
c549d4fe64
'lua_strtonum' (and 'luaO_str2num') now return string size, instead of
...
receiving it
2014-05-01 15:18:06 -03:00
Roberto Ierusalimschy
ddff6ecf30
function 'limittointeger' no needed (now that 'tointeger_aux' handles
...
integers too)
2014-04-30 16:29:51 -03:00
Roberto Ierusalimschy
6b630c0fa0
debug.numbits replaced by debug.Csize
2014-04-30 15:59:15 -03:00
Roberto Ierusalimschy
1a6ef098b0
'luaO_str2d' + 'luaO_str2int' replaced by 'luaO_str2num' plus proper
...
conversion from strings to integers
2014-04-30 13:50:16 -03:00
Roberto Ierusalimschy
5388aa9fc0
'luaO_str2d' + 'luaO_str2int' replaced by 'luaO_str2num' (which converts
...
to float or integer according to the string syntax)
2014-04-30 13:48:44 -03:00
Roberto Ierusalimschy
b123a88673
merge of common parts from 'limittointeger' and 'luaV_tointeger_'
2014-04-29 17:06:05 -03:00
Roberto Ierusalimschy
ffa43df3cd
'setnvalue' -> 'setfltvalue' (for consitency with 'fltvalue')
2014-04-29 15:14:16 -03:00
Roberto Ierusalimschy
9c4398de8f
'for' loop tries to convert limit to integer when initial value and
...
step are integers
2014-04-29 15:11:57 -03:00
Roberto Ierusalimschy
a0d4f0fc8a
template for 'mkstemp' is configurable (via LUA_TMPNAMTEMPLATE)
2014-04-29 14:05:13 -03:00
Roberto Ierusalimschy
68616c6669
using lua_Unsigned (instead of lua_Integer) for bit manipulation
2014-04-27 11:42:26 -03:00
Roberto Ierusalimschy
e98ba351ce
n^-m gives float result (instead of error)
2014-04-27 11:41:11 -03:00
Roberto Ierusalimschy
cbe4998bc2
'math.random(n,m)' interval restricted in size, to avoid using conversion
...
between 'double' and 'unsigned' (which can be slow and unreliable)
2014-04-17 13:09:40 -03:00
Roberto Ierusalimschy
0172c9552c
comment
2014-04-17 11:41:11 -03:00
Roberto Ierusalimschy
3d4913f703
back to larger sizes for 'dumpint/undumpint' (small Lua should
...
be able to dump/undump long-long integers)
2014-04-16 15:48:31 -03:00
Roberto Ierusalimschy
c27ef1b79c
correct integer limits for Windows + small adjustments for short
...
option
2014-04-16 15:45:51 -03:00
Roberto Ierusalimschy
4422b97472
keep 'luaL_checkversion_' with its signature in version 5.2, for
...
correct error messages in case of version mixings
2014-04-15 15:25:49 -03:00
Roberto Ierusalimschy
2f02d264e9
initial '*' in 'io.read' formats is deprecated
2014-04-15 13:46:45 -03:00
Roberto Ierusalimschy
037a70dfea
cast_u2s/cast_s2u renamed l_castS2U/l_castU2S to be configurable from
...
outside (mostly for testing)
2014-04-15 13:32:49 -03:00
Roberto Ierusalimschy
8f961da3db
macros cast_integer/cast_unsigned replaced by cast_u2s/cast_s2u, that
...
should be used only between lua_Integer and lua_Unsigned
2014-04-15 11:29:30 -03:00
Roberto Ierusalimschy
5c46b7b8cf
instructions in 'runC' sorted alphabetically + new instructions
...
'tointeger'/'tounsigned'
2014-04-14 15:42:44 -03:00
Roberto Ierusalimschy
a2c094fe2d
size of strings in 'string.rep' should be limited by the size of
...
lua_Integer, not of 'int'
2014-04-14 13:59:46 -03:00
Roberto Ierusalimschy
f767f29d87
using predefined limits (instead of computing min/max values for each
...
type) + some comments
2014-04-14 13:58:54 -03:00
Roberto Ierusalimschy
675530c4d8
maximum size of array part of a table now is restricted not only by
...
the size of an 'int', but also by the size of a 'lua_Integer'
2014-04-13 18:11:19 -03:00
Roberto Ierusalimschy
ab964ad7c6
new macro LUA_MAXUNSIGNED + support for 'short' integers (for tests only)
2014-04-12 11:51:53 -03:00
Roberto Ierusalimschy
ef789d4161
new global macro 'LUA_MAXUNSIGNED'
2014-04-12 11:45:10 -03:00
Roberto Ierusalimschy
b390d7c168
detail (avoid "casting down" in case lua_Integer is smaller than int)
2014-04-12 11:43:50 -03:00
Roberto Ierusalimschy
218f358461
errors like 1e100 << "2" were giving wrong messages
2014-04-11 17:17:39 -03:00
Roberto Ierusalimschy
bf06e22b6a
correct definition for 'MAX_SIZE' (using singed integers as the limit,
...
not unsigned ones) + new type 'l_uacInt'
2014-04-11 16:56:04 -03:00
Roberto Ierusalimschy
d99ffa920d
new type 'LUAI_UACINT' (result of an 'usual argument conversion' of
...
a lua_Integer)
2014-04-11 16:53:45 -03:00
Roberto Ierusalimschy
2771050dfa
'MIN/MAX_INTEGER' replaced by 'LUA_MIN/MAXINTEGER'
2014-04-11 16:02:16 -03:00
Roberto Ierusalimschy
e1daf10e4c
details in comments
2014-04-11 15:19:07 -03:00
Roberto Ierusalimschy
115fa77009
maximum size for dump of integers is size of lua_Integer (which
...
means that there is no overflows when undumping)
2014-04-10 16:45:43 -03:00
Roberto Ierusalimschy
561030c211
pack/unpack functions renamed dump/undump
2014-04-10 15:24:12 -03:00
Roberto Ierusalimschy
5336cc9d6a
math.random: use 'random' when available + changes to work correctly
...
for any integer interval (up to [minint,maxint])
2014-04-10 14:53:33 -03:00
Roberto Ierusalimschy
fdd137276b
more precision for PI + no more RADIANS_PER_DEGREE +
...
'min/maxint' -> 'min/maxinteger'
2014-04-09 14:29:46 -03:00
Roberto Ierusalimschy
a8aede68c7
new definition for 'luai_nummod' (using 'fmod')
2014-04-09 14:05:11 -03:00
Roberto Ierusalimschy
c7859a046d
using 'volatile' in 'tofloat' to ensure result has the same precision
...
(lua_Number) of other computations
2014-04-08 11:28:04 -03:00
Roberto Ierusalimschy
4a24883674
'GCmemtrav' does not need to track the entire collection, only each
...
single step individually
2014-04-04 14:01:04 -03:00
Roberto Ierusalimschy
9737832641
'int' -> 'lua_Integer' in several functions
2014-04-04 13:38:11 -03:00
Roberto Ierusalimschy
8b45d9806a
new constants 'math.maxint'/'math.minint'
2014-04-03 11:18:19 -03:00
Roberto Ierusalimschy
be52f784d9
new macros LUA_MAXINTEGER/LUA_MININTEGER
2014-04-03 11:18:02 -03:00
Roberto Ierusalimschy
144afa4d47
several changes in 'utf8.offset'
2014-04-03 10:45:09 -03:00
Roberto Ierusalimschy
007f66408d
bug: compiler can optimize away overflow check in 'table.concat'
2014-04-03 10:30:23 -03:00
Roberto Ierusalimschy
48c745a611
avoid constant overflow when shifting left signed integers until
...
their last bit
2014-04-03 10:29:24 -03:00
Roberto Ierusalimschy
3a044de5a1
new implementation for 'utf8.len'
2014-04-02 14:01:22 -03:00
Roberto Ierusalimschy
7d514af0bc
bug (in work version): comparisons should not try to convert
...
strings to numbers
2014-04-02 13:54:20 -03:00
Roberto Ierusalimschy
f61ceee708
LUAI_FUNC is being used only in header files
2014-04-02 13:44:42 -03:00
Roberto Ierusalimschy
5aeb57f11f
detail (error message for conversion from float to integer)
2014-04-01 15:55:06 -03:00
Roberto Ierusalimschy
493b3fdd65
added an 'api_check' for negative sizes in 'lua_checkstack'
2014-04-01 15:51:23 -03:00
Roberto Ierusalimschy
315c5bf7b7
bug: compiler could optimize away overflow check (+ changing indices
...
from 'int' to 'lua_Integer')
2014-04-01 15:50:34 -03:00
Roberto Ierusalimschy
607be77ec8
some details to avoid warnings
2014-04-01 11:39:55 -03:00
Roberto Ierusalimschy
0d745ed04c
more precise estimation (GCestimate) for total bytes in use after
...
a GC cycle
2014-04-01 11:06:59 -03:00
Roberto Ierusalimschy
3d1c6730da
detail ('1U' -> '1u', like other unsigned constants in the code)
2014-03-31 16:18:24 -03:00
Roberto Ierusalimschy
66b7b9b582
math.abs, math.max, and math.min work for integers, too.
2014-03-31 16:00:52 -03:00
Roberto Ierusalimschy
8ef9117924
fancier way to do sign extension
2014-03-31 15:38:26 -03:00
Roberto Ierusalimschy
ea69f17d98
macro 'tostring' is used only by 'luaV_concat'
2014-03-31 15:37:52 -03:00
Roberto Ierusalimschy
420cc62fac
missplelling in comments/function names (endianess -> endianness)
2014-03-27 12:58:05 -03:00
Roberto Ierusalimschy
1a3ebc203a
definition of LUA_REAL_* and LUA_INT_* moved to the beginning of
...
configurations
2014-03-21 11:27:16 -03:00
Roberto Ierusalimschy
2d5e2212d4
native lua_Number may be neither float nor double (in pack/unpackfloat)
2014-03-21 11:26:44 -03:00
Roberto Ierusalimschy
da4811238a
details (typos in comments)
2014-03-21 10:52:33 -03:00
Roberto Ierusalimschy
f96872a534
copyright year -> 2014
2014-03-20 16:42:35 -03:00
Roberto Ierusalimschy
738b3b64af
detail (to avoid warnings with '-O3')
2014-03-20 16:36:02 -03:00
Roberto Ierusalimschy
363b525c23
does not create library when it is deprecated
2014-03-20 16:22:16 -03:00
Roberto Ierusalimschy
469daa16ee
configuration for Lua type corresponding to 'time_t'
2014-03-20 16:18:54 -03:00
Roberto Ierusalimschy
7707f3e7c3
'posrelat' -> 'u_posrelat' (to avoid name conflict in 'one.c')
2014-03-20 11:11:00 -03:00
Roberto Ierusalimschy
16f8e44924
with 64-bit integers, file offsets do not need to be floats
2014-03-19 15:57:42 -03:00
Roberto Ierusalimschy
2f5f77788f
removed function 'luaS_eqstr' (not used anywhere)
2014-03-19 15:51:42 -03:00
Roberto Ierusalimschy
ed795d5ff4
detail (removed unused prototype)
2014-03-19 15:51:16 -03:00
Roberto Ierusalimschy
282d67d8fc
bitlib has been deprecated
2014-03-18 15:27:08 -03:00
Roberto Ierusalimschy
114d10cbc5
detail (comment)
2014-03-15 09:29:48 -03:00
Roberto Ierusalimschy
9f3f5b6f41
details
2014-03-14 13:54:08 -03:00
Roberto Ierusalimschy
a39489194e
changing prefix of configurable macros from "lua_" to "l_"
2014-03-13 17:07:18 -03:00
Roberto Ierusalimschy
a3addae036
lua_gettable and similars return type of gotten value
2014-03-12 17:57:40 -03:00
Roberto Ierusalimschy
ad40bb1181
detail in string.rep: allow large repetitions of the empty string (no
...
possibility of overflows)
2014-03-12 15:09:06 -03:00
Roberto Ierusalimschy
80fe8504f5
make all dumps/loads go trhough Load/DumpVector (so it is easier
...
to adapt the code to correct endianess, if needed)
2014-03-11 15:56:27 -03:00
Roberto Ierusalimschy
e976384213
keep chunk's headers compatible at least up to LUAC_VERSION (to be
...
able to detect correctly version mismatches)
2014-03-11 15:05:46 -03:00
Roberto Ierusalimschy
68f4ccdd00
make sure that LUAC_INT is a lua_Integer and that LUAC_NUM is
...
a lua_Number
2014-03-11 11:22:54 -03:00
Roberto Ierusalimschy
342a936599
detail (breaking too long lines)
2014-03-10 16:52:47 -03:00
Roberto Ierusalimschy
901da539e5
no need to avoid negative ints in 'LoadInt'
2014-03-10 16:50:19 -03:00
Roberto Ierusalimschy
197e249433
"indent -kr -i2 -br -brf -nut" plus a few manual formating
2014-03-10 14:56:32 -03:00
Roberto Ierusalimschy
2aff75f58e
small bug (from revision 2.80): LUA_OP* constants are not from
...
enumeration 'Opcode' (they are integers)
2014-03-09 16:21:34 -03:00
Roberto Ierusalimschy
cd12410195
new macro 'cast_void'
2014-03-07 13:19:00 -03:00
Roberto Ierusalimschy
c5bb3643ab
simpler code to read a line from a file (using 'getc' or, if present,
...
'getc_unlocked')
2014-03-06 14:12:02 -03:00
Roberto Ierusalimschy
5ff1c18a71
back with 'L' for macros 'luai_num*', but now with a new macro
...
'luai_numinvalidop' to protect constant folding
2014-03-06 13:15:18 -03:00
Roberto Ierusalimschy
99ac4a260f
'constfolding' passes a proper Lua state to 'luaO_arith'
2014-03-06 10:58:28 -03:00
Roberto Ierusalimschy
fa7e77fd38
detail ('codearith' uses 'LUA_OP*' constants instead of 'OP_*')
2014-03-06 10:39:05 -03:00
Roberto Ierusalimschy
f69e0ade19
no need to store a full 'size_t' fo the size of (frequent) small strings
2014-03-01 12:18:44 -03:00
Roberto Ierusalimschy
99a1c06ea3
more regularity with vectors + sizeof computed by the macros themselves
2014-02-28 13:13:01 -03:00
Roberto Ierusalimschy
93e28031de
all chars used in binary dumps are unsigned ('lu_byte')
2014-02-28 09:25:12 -03:00
Roberto Ierusalimschy
de84b3fecb
store number of upvalues of main function in front of the dump,
...
so that undump can create initial closure before reading its prototype
2014-02-27 15:56:15 -03:00
Roberto Ierusalimschy
054179c2ff
more explicit handling of headers for binary chunks
2014-02-27 13:56:20 -03:00
Roberto Ierusalimschy
986c11daa6
removal of weird construction in definition of LUA_STRFTIMEOPTIONS
...
(two empty strings concatenated as in "" "")
2014-02-26 12:55:58 -03:00
Roberto Ierusalimschy
c6c41e85b2
more uniformity for defining system-dependent features
2014-02-26 12:27:56 -03:00
Roberto Ierusalimschy
87c930676f
detail (comments)
2014-02-26 09:39:30 -03:00
Roberto Ierusalimschy
11e762dbcd
added macro MAX_UINTEGER
2014-02-26 09:38:43 -03:00
Roberto Ierusalimschy
5c9cb5f0b1
detail (comment)
2014-02-26 09:38:18 -03:00
Roberto Ierusalimschy
fed236ca7f
detail (unknown lines are marked as -1, not 0)
2014-02-25 11:31:16 -03:00
Roberto Ierusalimschy
295f7ac04e
added 'stip' parameter to lua_dump/string.dump
2014-02-25 11:30:21 -03:00
Roberto Ierusalimschy
6318de80d3
added 'strip' parameter to lua_dump/string.dump
2014-02-25 11:30:21 -03:00
Roberto Ierusalimschy
5715de344f
'read_all' does not need to grow buffer, as 'luaL_prepbuffsize'
...
already does that
2014-02-21 11:39:50 -03:00
Roberto Ierusalimschy
c86b9da022
userdata can have any Lua value as uservalue
2014-02-19 10:52:42 -03:00
Roberto Ierusalimschy
a4c6dcf999
detail (better error messages for light userdata)
2014-02-19 10:48:53 -03:00
Roberto Ierusalimschy
3f78de256e
no need to keep threads in a different GC list, now that there is the
...
'twups' list
2014-02-18 10:46:26 -03:00
Roberto Ierusalimschy
d764cc5522
new list 'twups' to allow traversal of upvalues from dead threads
...
(+ fixed some problems with cycles involving those upvalues)
2014-02-18 10:39:37 -03:00
Roberto Ierusalimschy
ffa96d988d
field 'op' renamed to 'open'
2014-02-15 11:12:01 -02:00
Roberto Ierusalimschy
6a24bd17a8
no more second result from 'collectgarbage"count"' (as Lua seldom
...
will need lua_Number to be an integer)
2014-02-14 14:45:38 -02:00
Roberto Ierusalimschy
1cce3e6842
change in the way 'collectgarbage("step", size)' interprets 'size'
...
(mimicking the way the GC itself behaves when Lua allocates 'size'
Kbytes)
2014-02-14 14:43:14 -02:00
Roberto Ierusalimschy
0b04c561f5
new syntax for Unicode escape '\u{012F}'
2014-02-14 13:23:51 -02:00
Roberto Ierusalimschy
90b0ac6495
limit to 'gcstepmul' imposed by 'lua_gc' (+ some details in 'lgc.c')
2014-02-13 15:25:20 -02:00
Roberto Ierusalimschy
de3b1c9b53
better control for number of finalizers called at each GC cycle
...
(increases progressively)
2014-02-13 12:46:38 -02:00
Roberto Ierusalimschy
733c58595b
no more local collection
2014-02-13 10:11:34 -02:00
Roberto Ierusalimschy
4a1ed6e6e5
new field '__name' in metatables to help better error messages
2014-02-11 15:39:15 -02:00
Roberto Ierusalimschy
6b30774469
detail (better presentation for 'luaC_step')
2014-02-11 10:28:47 -02:00
Roberto Ierusalimschy
ba3586cc90
keep a single list of objects to be finalized (with local and non-local
...
objects), to ensure finalization order
2014-02-11 10:18:12 -02:00
Roberto Ierusalimschy
68df7c6279
added proper headers for a standard lib file
2014-02-06 18:03:24 -02:00
Roberto Ierusalimschy
19ad78d713
C++ needs casts for arithmetic with enums
2014-02-06 17:55:55 -02:00
Roberto Ierusalimschy
6ccf150039
new library: utf8
2014-02-06 15:32:33 -02:00
Roberto Ierusalimschy
4ea60463f5
UTF-8 encoding exported as format '%U' in 'lua_pushfstring'
2014-02-06 13:59:24 -02:00
Roberto Ierusalimschy
d438e1379d
insertion of ".0" in floats with integer values done by "luaL_tolstring",
...
not by the core
2014-02-05 17:14:53 -02:00
Roberto Ierusalimschy
1721d09ac8
still accepts initial '=' for expressions, for compatibility with old
...
versions (and old habits...)
2014-02-05 12:22:55 -02:00
Roberto Ierusalimschy
2f3da00e51
added support for UTF-8 escapes
2014-02-04 16:57:34 -02:00
Roberto Ierusalimschy
5a73e3ad9e
simpler way to create messages for errors in escape sequences
2014-01-31 13:14:22 -02:00
Roberto Ierusalimschy
86dd8bf3f5
no more 'L' in macros "luai_num*" (several places that use those macros
...
cannot throw errors anyway...)
2014-01-27 11:34:32 -02:00
Roberto Ierusalimschy
67c5de9283
comment
2014-01-27 11:28:45 -02:00
Roberto Ierusalimschy
0a850e641d
larger limit + better error messages for loop detection in inheritance
2014-01-22 18:02:04 -02:00
Roberto Ierusalimschy
916bd874ad
added explicit default options to string.pack/unpack functions
2014-01-09 14:21:28 -02:00
Roberto Ierusalimschy
cd848cab6b
first implementation for string.pack/unpackfloat + try not to assume
...
that chars have 8 bits
2014-01-08 16:34:34 -02:00
Roberto Ierusalimschy
29256e8960
first implementation of string.packint/string.unpackint
2014-01-05 12:05:58 -02:00
Roberto Ierusalimschy
438c534ff4
'arg' arguments (previously called 'narg', 'nArg', 'numArg', etc.)
...
renamed all to 'arg'
2014-01-05 12:04:46 -02:00
Roberto Ierusalimschy
1ea2d20f74
first implementation of '<<', '>>', and '~' (bitwise not)
2013-12-30 18:47:58 -02:00
Roberto Ierusalimschy
f5133aa1a5
small change in handling of unary operations
2013-12-18 16:44:42 -02:00
Roberto Ierusalimschy
c0edab0f6d
first implementation of bitwise operators '&' (band), '|' (bor),
...
and '~' (bxor)
2013-12-18 12:12:03 -02:00
Roberto Ierusalimschy
a948054a19
new order for binary operations (grouping them by type of result)
2013-12-16 17:06:52 -02:00
Roberto Ierusalimschy
a8f8c7fd80
integer exponentiation with negative exponent is invalid
2013-12-16 12:30:22 -02:00
Roberto Ierusalimschy
1a19893d6f
new "calculator mode"; no need to add '=' to print expressions
2013-12-16 12:27:17 -02:00
Roberto Ierusalimschy
88e23f508c
details
2013-12-13 13:42:08 -02:00
Roberto Ierusalimschy
c8585efc78
use goto to implement a tail call in 'reallymarkobject'
2013-12-13 13:17:00 -02:00
Roberto Ierusalimschy
16493b777f
'lua_sethook' returns void
2013-12-09 12:21:10 -02:00
Roberto Ierusalimschy
cac1ebd1e0
detail ('ttisuserdata' renamed to 'ttisfulluserdata')
2013-12-04 10:15:22 -02:00
Roberto Ierusalimschy
73c5515e00
details (comments)
2013-11-21 15:23:14 -02:00
Roberto Ierusalimschy
e34c35abcf
new bug: Resuming the running coroutine makes it unyieldable
2013-11-08 16:23:16 -02:00
Roberto Ierusalimschy
7a8eb83b4a
bug: attempting to resume the running coroutine makes it unyieldable
2013-11-08 16:16:33 -02:00
Roberto Ierusalimschy
ab5fa213b3
added patch for last bug
2013-11-08 15:45:10 -02:00
Roberto Ierusalimschy
39929384c6
new macro 'luai_userstateclose' (to test it is being called correctly)
2013-11-08 15:36:05 -02:00
Roberto Ierusalimschy
de7cf8e63a
bug: should call 'luai_userstateclose' only when 'luai_userstateopen'
...
has been called before
2013-11-08 15:34:22 -02:00
Roberto Ierusalimschy
124598917f
"./?/init.lua" added to default path
2013-10-10 12:45:03 -03:00
Roberto Ierusalimschy
c5fcba1a17
detail (changing some names of macros)
2013-10-07 11:20:31 -03:00
Roberto Ierusalimschy
4c6dfc342b
CallInfo lists shrinks together with their associated stacks
2013-09-17 12:40:06 -03:00
Roberto Ierusalimschy
686e57cf9c
GC local pause configurable
2013-09-13 13:21:52 -03:00
Roberto Ierusalimschy
06156e7575
detail (setmetatable do not need to use a back GC barrier)
2013-09-11 17:15:31 -03:00
Roberto Ierusalimschy
2e2c109daf
type of 'refcount' changed to lu_mem (to ensure there will be no
...
overflows)
2013-09-11 12:17:00 -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
4eeb1831be
new names and better order for GC states (sweep first lists that
...
can have dead objects)
2013-09-11 11:47:08 -03:00
Roberto Ierusalimschy
dd373a8f66
threads are kept in a separated GC list, linked after the main thread
2013-09-11 11:09:55 -03:00
Roberto Ierusalimschy
7061fe1d56
detail: 'sweepstep' checks end of phase after calling 'sweeplist', so
...
that phases with small lists return 0 at the first call to 'sweepstep'
2013-09-11 10:24:55 -03:00
Roberto Ierusalimschy
d8aa8dd97e
objects in list 'tobefnz' have a GC life-cycle like all others
...
(specifically they are cleaned during sweep phase)
2013-09-11 09:47:48 -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
79ab21be90
more invariants added to memory check
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
0ad15fc100
better (and correct!) control of 'maybedead'
2013-09-04 12:34:24 -03:00
Roberto Ierusalimschy
aeff4f79fa
local collection now calls finalizers
2013-09-03 12:37:10 -03:00
Roberto Ierusalimschy
1bf4faec64
new GC state to sweep 'localgc' list + small changes in sweep control
2013-08-30 16:14:26 -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
4f292d753c
bug: GC can collect a long string still in use during parser
2013-08-30 12:51:12 -03:00
Roberto Ierusalimschy
26629d0af1
details (a few casts moved from macro invocation to macro definition)
2013-08-29 10:49:57 -03:00
Roberto Ierusalimschy
b5e75fde4e
bug: local collection must clear rest of stack
2013-08-29 10:34:16 -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
Roberto Ierusalimschy
af35c7f398
upvalues collected by reference count
2013-08-27 15:53:35 -03:00
Roberto Ierusalimschy
742b7377d3
Lua closures go to local, too
2013-08-26 09:41:10 -03:00
Roberto Ierusalimschy
50955e27f5
C functions and strings now go to the local list; first version
...
of the local collector
2013-08-23 10:34:54 -03:00
Roberto Ierusalimschy
33c49f7fa0
some details over new implementation of string table
2013-08-22 12:21:48 -03:00
Roberto Ierusalimschy
0df6635711
"fixed" objects kept in a separated list (instead of being kept in
...
'allgc' list with a bit marking them)
2013-08-21 17:09:51 -03:00
Roberto Ierusalimschy
ae800656c9
change in string table: string table is now independent of GC lists; all
...
strings live in 'normal' GC lists
2013-08-21 16:21:16 -03:00
Roberto Ierusalimschy
8c68863960
initial size of string table (MINSTRTABSIZE) should be large enough
...
to hold all strings needed by an empty Lua state
2013-08-21 16:02:30 -03:00
Roberto Ierusalimschy
8f6b80aa1d
GC bits SEPARATED and FINALIZEDBIT mixed in FINALIZEDBIT (with simpler
...
control)
2013-08-20 14:46:34 -03:00
Roberto Ierusalimschy
9eff921f8f
"barrier" for link prototype->cache changed to be consistent with
...
GC behavior (link is cleared to preserve invariant)
2013-08-19 11:18:43 -03:00
Roberto Ierusalimschy
8e6b7ef9ab
new function 'isgclocal' + test for GC consistency of prototype's caches
2013-08-19 11:16:33 -03:00
Roberto Ierusalimschy
caceeab750
'next' field for tables changed from pointer to integer (for better
...
alignment on 64-bit machines)
2013-08-18 13:12:18 -03:00
Roberto Ierusalimschy
3991312b94
details
2013-08-16 16:02:31 -03:00
Roberto Ierusalimschy
439d74e29f
added 'local' bit (true => object is only refered by local variables)
2013-08-16 15:55:49 -03:00
Roberto Ierusalimschy
3679d33b02
barrier conditions rewritten to test first 'isblack' and then 'iswhite'
...
(during a pause all objects are white, so 'isblack' fails much more
often than 'iswhite')
2013-08-13 14:36:44 -03:00
Roberto Ierusalimschy
78b941039d
change to allow collector to stop when it goes to the atomic phase
...
(just for debugging)
2013-08-07 12:39:09 -03:00
Roberto Ierusalimschy
623e388bb4
double-linked list of all upvalues elliminated and changed to a
...
traversal of all non-marked threads
2013-08-07 09:18:11 -03:00
Roberto Ierusalimschy
677d90165f
no more generational collection !!!
2013-08-05 13:58:28 -03:00
Roberto Ierusalimschy
4244da96bf
'debug.subtype' -> 'math.type' (to distinguish integers and floats)
2013-07-22 13:05:53 -03:00
Roberto Ierusalimschy
fcf99bf788
'math.isfloat' replaced by 'debug.subtype'
2013-07-10 17:57:05 -03:00
Roberto Ierusalimschy
98d76cdcae
bug: Wrong error message in some short-cut expressions
2013-07-10 17:32:36 -03:00
Roberto Ierusalimschy
2f8c51a552
use unsigneds for unary minus, too
2013-07-10 14:15:12 -03:00
Roberto Ierusalimschy
b5f5fcd782
use different constants (instead of different values for the same constant)
...
to define number sizes (LUA_INT_INT/LUA_INT_LONG/LUA_INT_LONGLONG and
LUA_REAL_FLOAT/LUA_REAL_DOUBLE/LUA_REAL_LONGDOUBLE) + use __int64 and
I64 instead of long long (and ll) for Windows
2013-07-09 15:31:35 -03:00
Roberto Ierusalimschy
2ef9bcfd11
avoid undefined shift of LUA_NBITS in rotate operation
2013-07-09 15:31:01 -03:00
Roberto Ierusalimschy
5fa680d47f
no need for type 'b_uint' (lua_Unsigned must have at least 32 bits)
2013-07-09 14:49:50 -03:00
Roberto Ierusalimschy
48735da0d0
When loading a file, Lua may call the reader function again after
...
it returned end of input + luac listings choke on long strings
2013-07-05 15:02:28 -03:00
Roberto Ierusalimschy
2b4bd21585
'tonumber': base must be a number
2013-07-05 11:39:15 -03:00
Roberto Ierusalimschy
beff5b078a
'tonumber': does not accept numbers when given a base + convertion from
...
strings to numbers with a base moved to a separated function (more
modular)
2013-07-05 11:35:49 -03:00
Roberto Ierusalimschy
5519c98655
'lua_cvtonum' -> 'lua_strtonum'; converts only strings to numbers
2013-07-05 11:29:51 -03:00
Roberto Ierusalimschy
cbe164191c
new function 'ifloor'
2013-07-03 14:23:19 -03:00
Roberto Ierusalimschy
66d046833d
no need to check "bad conversion number->int;" in luaL_checkversion,
...
as now Lua does not use tricks for the conversion, but there is a
need to check the sizes of number types, as they can be different
in two modules
2013-06-27 15:32:33 -03:00
Roberto Ierusalimschy
15fdbd26fe
'numbits' moved from 'math' to 'debug' library
2013-06-25 16:37:00 -03:00
Roberto Ierusalimschy
2b4975dca7
LUA_SMALL_* changed to LUA_*SIZE + added support for long double + better
...
support for ANSI systems
2013-06-25 16:04:40 -03:00
Roberto Ierusalimschy
e39da66c8c
macro 'lua_strx2number' does not need to be global
2013-06-25 15:58:32 -03:00
Roberto Ierusalimschy
483c2ccd0f
avoid using raw representation of numbers for hashing, as number may
...
not use all its space (e.g., long double can have sizeof=12 but
use only 10 bytes)
2013-06-25 15:57:18 -03:00
Roberto Ierusalimschy
982aa7058f
'luaL_len' returns lua_Integer instead of 'int'
2013-06-25 11:05:26 -03:00
Roberto Ierusalimschy
80cdf39d0e
avoid using 'modf' in the implementation of 'math.modf', to avoid
...
problems with 'double*'. (When using 'float' as lua_Number,
'float*' is not compatible with 'double*'...)
2013-06-25 11:02:18 -03:00
Roberto Ierusalimschy
45f3797a5b
'long' may have more than 32 bits in some machines; use 'int' for
...
small lua_Integer unless necessary to use 'long'
2013-06-21 14:42:28 -03:00
Roberto Ierusalimschy
de6e5a5919
small bugs uncovered in a 64-bit machine (where 'long' has 64 bits)
2013-06-21 14:27:24 -03:00
Roberto Ierusalimschy
81102d3689
try to avoid warnings when converting int to pointer
2013-06-20 18:59:13 -03:00
Roberto Ierusalimschy
6579bd4190
reorganization of warnings + update of explicit dependencies (gcc -MM)
2013-06-20 15:56:51 -03:00
Roberto Ierusalimschy
f45177f2d3
In the table that hashes constants, use a light userdata as keys
...
to integer values to avoid collisions with floats with the same
numerical value
2013-06-20 14:37:31 -03:00
Roberto Ierusalimschy
d6f5fb2d2c
avoid warning for unary minus over an unsigned value
2013-06-20 12:12:43 -03:00
Roberto Ierusalimschy
7c4cc505db
added "reasonable" limit for 'string.rep' (otherwise it is too easy
...
to crash the machine)
2013-06-20 12:06:51 -03:00
Roberto Ierusalimschy
453450d687
new macro 'l_floor' (allows 'floorf' even when other math operations
...
do not have an 'f' variant)
2013-06-20 12:02:49 -03:00
Roberto Ierusalimschy
55f566bd22
use lua_Integer for integer parameters to avoid truncation
2013-06-19 11:29:01 -03:00
Roberto Ierusalimschy
130c0e40e0
new constant 'MAX_SIZE', distinct from 'MAX_SIZET', for sizes visible
...
from Lua; these must fit in a lua_Integer
2013-06-19 11:27:00 -03:00
Roberto Ierusalimschy
c72fb1cf8e
detail (removed 'assert')
2013-06-14 17:46:40 -03:00
Roberto Ierusalimschy
138e69cc55
correct error message for floating-point values out of (integer) range
2013-06-14 15:34:49 -03:00
Roberto Ierusalimschy
53210d7e5b
correct way (I hope) to convert floats to unsigned int
2013-06-14 15:32:45 -03:00
Roberto Ierusalimschy
0394314c7a
avoid using a negative value to test 'lua_tounsigned'
2013-06-14 15:12:53 -03:00
Roberto Ierusalimschy
0beeb4f6fa
configuration of number sizes goes "mainstream"
2013-06-13 16:35:08 -03:00
Roberto Ierusalimschy
788b251157
'math.random' operates with integers when used for integer results
...
(1 or 2 parameters)
2013-06-13 16:32:52 -03:00
Roberto Ierusalimschy
318575627f
avoid adding '.0' to "numbers" like "nan" and "inf"
2013-06-07 16:02:05 -03:00
Roberto Ierusalimschy
a14992992a
new version (5.3)
2013-06-07 16:01:50 -03:00
Roberto Ierusalimschy
48adb6984c
'io.write' writes integers directly (and correctly)
2013-06-07 16:01:35 -03:00
Roberto Ierusalimschy
c5069528e1
details ('Type* id' -> 'Type *id')
2013-06-07 11:51:10 -03:00
Roberto Ierusalimschy
6fb0b11350
string contatenation handles conversion of integers to strings +
...
floats always format as floats (with decimal dot or exponent)
2013-06-04 16:36:42 -03:00
Roberto Ierusalimschy
932e7fb0e1
'lua_tounsigned' takes number modulo 2^numbits as a result when
...
number is a float
(That may change...)
2013-06-04 16:34:51 -03:00
Roberto Ierusalimschy
188192ce9a
'luai_hashnum' "inlined" into 'hashfloat'
2013-05-29 11:05:03 -03:00
Roberto Ierusalimschy
fc083f1138
removed all tricks for conversions + 'luai_hashnum' moved to ltable.c
2013-05-29 11:04:15 -03:00
Roberto Ierusalimschy
ee865b9fe7
new implementation for 'lua_strx2number' to correct small
...
problems with numbers like 0x10000...000p-100
2013-05-27 14:42:38 -03:00
Roberto Ierusalimschy
d630daca1a
"legal" way to convert a float to an integer in C
2013-05-27 09:43:37 -03:00
Roberto Ierusalimschy
8c883cb4e8
'objlen' can return integers
2013-05-26 11:47:51 -03:00
Roberto Ierusalimschy
c75cca0559
detail (case '%d' of 'luaO_pushvfstring' should use integers)
2013-05-26 11:43:35 -03:00
Roberto Ierusalimschy
1414b7123c
support for the case when 'l_mathop' does not conform to lua_Number
...
(problem with pointers to lua_Number solved by a typedef selected
automatically by 'l_mathop')
2013-05-26 10:45:24 -03:00
Roberto Ierusalimschy
3563b3f519
first version of control for number sizes (still in 'local' section)
2013-05-26 10:35:52 -03:00
Roberto Ierusalimschy
d46ed54646
no more IEEE tricks
2013-05-26 10:26:34 -03:00
Roberto Ierusalimschy
e2c8c756ee
removed 'IEEE tricks' (should not be needed in Lua with integers)
2013-05-23 18:27:06 -03:00
Roberto Ierusalimschy
5ca5086c19
'tonumber' now works with integers too
2013-05-16 15:35:57 -03:00
Roberto Ierusalimschy
2d6a0ae149
added patch to last bug
2013-05-16 13:03:50 -03:00
Roberto Ierusalimschy
b5ec26101f
new API function 'lua_cvtonum' to convert a value (number or string)
...
to a number, following the rules of the language to create integers
or floats
2013-05-14 13:00:11 -03:00
Roberto Ierusalimschy
36e8771076
'luaO_str2int' more generic: accepts white spaces around the numeral
...
and handles signal
2013-05-14 12:59:04 -03:00
Roberto Ierusalimschy
27f09415e3
new read format "*i" for reading integers
2013-05-14 12:57:43 -03:00
Roberto Ierusalimschy
4ad9970649
uses integers for time
2013-05-14 12:57:11 -03:00
Roberto Ierusalimschy
bef345a4b8
bug: Wrong error message in some short-cut expressions
2013-05-13 13:17:47 -03:00
Roberto Ierusalimschy
0ce3018109
'pushnum' pushes a "number" (float) + new C instruction 'pushint'
2013-05-07 16:01:16 -03:00
Roberto Ierusalimschy
0233ce0815
new function 'math.numbits' (not a final decision)
2013-05-06 14:22:55 -03:00
Roberto Ierusalimschy
1f2b82bf25
correct way to avoid compile-time errors in integer divisions
2013-05-06 14:22:16 -03:00
Roberto Ierusalimschy
f2043b7a58
correct error message for conversion errors from float to int
2013-05-06 14:21:59 -03:00
Roberto Ierusalimschy
2b1c2c61b0
bug: Wrong assert when reporting concatenation errors.
2013-05-06 14:21:28 -03:00
Roberto Ierusalimschy
fa6ea831b3
macro 'nvalue' removed (direct conversion from integer to double,
...
without an intermediate variable, can cause "excessive precision"
2013-05-06 14:17:09 -03:00
Roberto Ierusalimschy
b22a4280c6
macro 'nvalue' removed + cast to void added to avoid warnings
...
with 'clang'
2013-05-06 14:17:09 -03:00
Roberto Ierusalimschy
29fe3abda2
new function 'math.isfloat'
2013-05-02 14:31:54 -03:00
Roberto Ierusalimschy
6347004be9
stack overflow in vararg functions + garbage collector in recursive loops
2013-05-02 13:13:27 -03:00
Roberto Ierusalimschy
67532d5a10
constant folding and API arithmetic with integers
2013-05-02 09:37:24 -03:00
Roberto Ierusalimschy
6920a7f2e3
new macro 'intop' (to perform integer arithmetic on unsigned types)
2013-05-02 09:31:26 -03:00
Roberto Ierusalimschy
88bf2f83c0
new function 'tointeger' + 'luaV_arith' replaced by 'luaT_trybinTM'
2013-04-29 14:12:50 -03:00
Roberto Ierusalimschy
8fff05f6d0
integer division operates only on integers
2013-04-29 14:12:12 -03:00
Roberto Ierusalimschy
9b9becf384
added 'const' to parameters of 'luaG_concaterror'
2013-04-29 13:58:10 -03:00
Roberto Ierusalimschy
00744a2729
'luaO_arith' -> 'luaO_numarith'
2013-04-29 13:57:48 -03:00
Roberto Ierusalimschy
b4be507578
new function 'luaT_trybinTM'
2013-04-29 13:56:50 -03:00
Roberto Ierusalimschy
360587f319
favoring 'tonumber' over 'nvalue'
2013-04-26 16:51:17 -03:00
Roberto Ierusalimschy
eee51492e2
dumping and undumping integers
2013-04-26 15:48:35 -03:00
Roberto Ierusalimschy
c37b7b3cca
bug: garbage collector can trigger too many times in recursive loops,
...
because it was not computing the size of CallInfo structures in threads
2013-04-26 15:26:49 -03:00
Roberto Ierusalimschy
f79584faca
detail
2013-04-26 13:06:53 -03:00
Roberto Ierusalimschy
4abe99dc34
new interface for 'tonumber'
2013-04-26 13:03:50 -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
a2f5c28a80
new operation '//' (integer division)
2013-04-26 10:08:29 -03:00
Roberto Ierusalimschy
a80a2b5e56
new cast macros for lua_Integer and lua_Unsigned
2013-04-25 18:15:37 -03:00
Roberto Ierusalimschy
bb1851ce98
'for' loop uses integers when possible
2013-04-25 16:50:02 -03:00
Roberto Ierusalimschy
5951c79ae1
default increment for 'for' loop is an integer (1, not 1.0)
2013-04-25 16:35:19 -03:00
Roberto Ierusalimschy
e381c582de
integer handling for order comparisons, power, and modulo operations
2013-04-25 16:12:41 -03:00
Roberto Ierusalimschy
9600c60df3
functions 'get_equalTM' and 'call_orderTM' moved to other files
...
to make 'lvm.c' smaller
2013-04-25 13:07:52 -03:00
Roberto Ierusalimschy
32bf6c9b27
functions 'traceexec', 'callTM', and 'call_binTM' moved to other
...
files to make 'lvm.c' a little smaller
2013-04-25 12:59:42 -03:00
Roberto Ierusalimschy
9c43d6a24e
new format "%I" in 'lua_pushfstring' for lua_Integer
2013-04-25 10:53:13 -03:00
Roberto Ierusalimschy
01b6fe0cbf
new API function 'lua_isinteger'
2013-04-25 10:52:49 -03:00
Roberto Ierusalimschy
944709c77b
more definitions to support integer formatting
2013-04-25 10:52:13 -03:00
Roberto Ierusalimschy
52cb90ec75
detail
2013-04-24 16:41:48 -03:00
Roberto Ierusalimschy
fa3b126a23
BUG: stack overflow in vararg functions with many fixed
...
parameters called with few arguments
2013-04-19 18:05:04 -03:00
Roberto Ierusalimschy
1294b09d8e
first implementation of literal integers (no constant folding yet)
2013-04-16 15:46:28 -03:00
Roberto Ierusalimschy
d4f0c4435d
a few more operations supporting integers (minus, umin, mult)
2013-04-16 15:43:05 -03:00
Roberto Ierusalimschy
44358e0206
extra trim applied to 'replace' argument (in case lua_Unsigned is
...
larger than 32 bits)
2013-04-16 15:39:37 -03:00
Roberto Ierusalimschy
07f861385e
first steps in the support of integers: basic representation + table indexing + basic API ops (tointeger/pushinteger) + equality + a few extra stuff
2013-04-15 12:44:46 -03:00
Roberto Ierusalimschy
7a543cfae6
2013-04-15 12:43:34 -03:00
Roberto Ierusalimschy
24689927f2
dependencies updated (with 'gcc -MM')
2013-04-15 11:13:38 -03:00
Roberto Ierusalimschy
8f8665fffa
'ttypenv' -> 'ttnov'
2013-04-12 16:07:09 -03:00
Roberto Ierusalimschy
49c1607157
_FILE_OFFSET_BITS usually also needs _LARGEFILE_SOURCE + easier to
...
use default definition for 'l_fseek' in ansi systems
2013-04-11 15:34:06 -03:00
Roberto Ierusalimschy
c8e96d6e91
logic for checking mode for 'fopen' moved to macro 'lua_checkmode'
2013-03-21 10:57:27 -03:00
Roberto Ierusalimschy
af8efcc762
detail (avoid unnecessary "unconst" in cast)
2013-03-21 10:54:57 -03:00
Roberto Ierusalimschy
3f6f78ea0b
detail (error message)
2013-03-20 16:40:07 -03:00
Roberto Ierusalimschy
e3a7104b40
detail (avoiding warnings)
2013-03-19 10:19:12 -03:00
Roberto Ierusalimschy
76492b4bb2
macro 'lua_checkmode' + typos in comments
2013-03-16 18:10:18 -03:00
Roberto Ierusalimschy
75250a237c
typos in comments
2013-03-16 18:10:18 -03:00
Roberto Ierusalimschy
437a49be5e
cast to avoid warnings
2013-03-15 15:33:36 -03:00
Roberto Ierusalimschy
4f0c716c8e
added two more commented warning options (just to know about them)
2013-03-15 11:00:08 -03:00
Roberto Ierusalimschy
70b0ee6310
export 'lua_ident' to avoid it being removed by C++ linker
2013-03-15 10:04:22 -03:00
Roberto Ierusalimschy
8830901a9c
second parameter to 'ldexp' is an integer
2013-03-07 15:21:32 -03:00
Roberto Ierusalimschy
15a3738b49
no need to handle 0 as a special case in 'table.remove'
2013-03-07 15:17:24 -03:00
Roberto Ierusalimschy
a83ed55f1e
added 'return' (when possible) to calls to error functions
2013-02-21 10:44:53 -03:00
Roberto Ierusalimschy
b559aed2d3
'l_tg' was renamed to 'l_mathop' and this use was not corrected at
...
the time
2013-02-20 11:08:56 -03:00
Roberto Ierusalimschy
d0c038da07
typo in comment
2013-02-20 11:08:21 -03:00
Roberto Ierusalimschy
db424053e8
new release number + copyright year
2013-02-19 15:39:04 -03:00
Roberto Ierusalimschy
ad56721948
details (5.2 corrected to 5.2.0)
2013-02-07 13:57:47 -02:00
Roberto Ierusalimschy
f4e762f688
better error checking for 'table.insert' and 'table.remove'
2013-02-06 16:29:03 -02:00
Roberto Ierusalimschy
1ce57628b2
comments
2013-02-06 11:37:39 -02:00
Roberto Ierusalimschy
181a837cac
small improvement in the support of 'float' as lua_Number
2013-01-29 14:00:40 -02:00
Roberto Ierusalimschy
0730a56d38
detail
2013-01-08 12:06:55 -02:00
Roberto Ierusalimschy
eecc1491f3
added some comments
2012-12-05 17:57:00 -02:00
Roberto Ierusalimschy
7ea68d84c4
added comment
2012-12-05 17:49:55 -02:00
Roberto Ierusalimschy
0e9167bc72
missing brackets in 'if' body (no bug, only 'luaC_checkfinalizer' is
...
called to do nothing)
2012-12-05 17:09:23 -02:00
Roberto Ierusalimschy
65e31fb179
Bug: load/loadfile returns wrong result when given an environment
...
for a binary chunk with no upvalues
2012-12-03 18:18:02 -02:00
Roberto Ierusalimschy
f993771c70
avoids warning with 'clang' + comment explaining macro
2012-11-14 15:21:34 -02:00
Roberto Ierusalimschy
52f9ccd298
removed unreacheable 'lua_unlock'
2012-11-04 18:08:17 -02:00
Roberto Ierusalimschy
a799ed5af9
more precise control for GC pause (based on threshold)
2012-10-19 16:00:33 -03:00
Roberto Ierusalimschy
4082c77ff2
error message for 'bad self' includes original 'extramsg'
2012-10-19 12:55:01 -03:00
Roberto Ierusalimschy
bc84180d12
error message in 'os.rename' does not include file name, because error
...
may be caused both by 'fromname' or 'toname'
2012-10-19 12:54:02 -03:00
Roberto Ierusalimschy
ad5da6ba14
API functions get acceptable indices except when not possible (when
...
they modify the value at that index) + new macro 'ispseudo' +
specific test 'api_checkstackindex'
2012-10-19 12:52:46 -03:00
Roberto Ierusalimschy
86b39206d9
open upvalues cannot be old if thread is not old; when thread is old,
...
their list is not traversed anymore, and therefore can contain dead
elements.
2012-10-03 09:36:46 -03:00
Roberto Ierusalimschy
fdae4b9453
removed commented-out line (for debugging)
2012-10-03 09:36:17 -03:00
Roberto Ierusalimschy
84b6581287
cast to avoid warning in some compilers (size_t x unsigned int)
2012-10-02 14:41:50 -03:00
Roberto Ierusalimschy
c6b6024a9d
cast in 'luai_makeseed' now casts to needed type
2012-10-02 14:40:53 -03:00
Roberto Ierusalimschy
d58ce8106e
macro 'lua_number2unsigned' also needs proper definition if
...
lua_Number is float
2012-10-02 14:32:44 -03:00
Roberto Ierusalimschy
31f7d553e4
LUA_CORE condition removed from definition of some 'tricks' (as it
...
controlled only a few other defines) + MS_ASMTRICK renamed to
LUA_MSASMTRICK
2012-10-01 11:14:45 -03:00
Roberto Ierusalimschy
adaba04059
'pcall' may not restore previous error function when
...
inside coroutines + Check for garbage collector in function calls
does not cover all paths
2012-10-01 11:05:31 -03:00
Roberto Ierusalimschy
b157f3546e
BUG: 'pcall' may not restore previous error function when
...
inside coroutines
2012-10-01 11:05:04 -03:00
Roberto Ierusalimschy
ab7086e209
pops the string from 'get_prompt' only after using it
2012-09-29 17:07:06 -03:00
Roberto Ierusalimschy
7a3de1aba3
typo in comment
2012-09-24 19:57:26 -03:00
Roberto Ierusalimschy
8287a0db55
detail
2012-09-11 16:37:16 -03:00
Roberto Ierusalimschy
cf160abcf9
no more macro 'changenvalue'
2012-09-11 15:21:44 -03:00
Roberto Ierusalimschy
ae1d318822
small bug: generational mode is always in 'propagate' mode only
...
outside the collector: during collection of course it must go to
other modes.
2012-09-11 09:53:08 -03:00
Roberto Ierusalimschy
2038073975
more regularity for field 'fix'
2012-09-11 09:42:14 -03:00
Roberto Ierusalimschy
2dc91ca5ee
checks garbage collector every time it calls a function (as the
...
stack can grow and so allocates more memory)
2012-08-28 15:30:45 -03:00
Roberto Ierusalimschy
a3e1c40d6d
remove of unecessary luaD_checkstack. (In some cases, C should
...
ensure stack space; in others, Lua can use the extra slots for
temporary values.)
2012-08-16 14:34:28 -03:00
Roberto Ierusalimschy
c1a2a646c8
details (no need to use lua_pushfstring for plain strings)
2012-08-16 14:32:20 -03:00
Roberto Ierusalimschy
53480f1163
details (remove of some extra spaces)
2012-08-14 15:12:34 -03:00
Roberto Ierusalimschy
233eac4d3a
detail (avoid being picky about conversion from 'unsigned char'
...
to 'int')
2012-08-06 10:36:34 -03:00
Roberto Ierusalimschy
6625cbecd1
Bug: Some patterns can overflow the C stack, due to recursion
...
(Took the opportunity to refactor function 'match')
2012-07-31 14:48:42 -03:00
Roberto Ierusalimschy
4ac55997ec
typo
2012-07-13 11:54:14 -03:00
Roberto Ierusalimschy
763f84c84c
Some patterns can overflow the C stack, due to recursion.
2012-07-13 11:53:38 -03:00
Roberto Ierusalimschy
e4f609d0ee
collector in generational mode must be in 'propagate' state when
...
not running a collection
2012-07-04 12:52:38 -03:00
Roberto Ierusalimschy
5ac56a94dd
collector in generational mode should never be in 'pause' state
2012-07-02 12:38:36 -03:00
Roberto Ierusalimschy
4fc15bbfb7
major collections in generational mode are triggered by comparison with
...
the memory estimate from last major collection
2012-07-02 10:40:05 -03:00
Roberto Ierusalimschy
f7ec36ab16
comment
2012-07-02 10:37:04 -03:00
Roberto Ierusalimschy
b926472312
change in error message
2012-06-29 16:23:33 -03:00
Roberto Ierusalimschy
78d9865900
bugs: Internal Lua values may escape through the debug API +
...
Problems when yielding from debug hooks
2012-06-11 14:49:37 -03:00
Roberto Ierusalimschy
cc2a60ecb7
bugs in yields inside debug hooks
2012-06-08 12:14:04 -03:00
Roberto Ierusalimschy
43bfb60ac8
new auxiliary function 'luaI_printinst' (to print a single instruction)
2012-06-07 15:52:47 -03:00
Roberto Ierusalimschy
c510d94549
includes counts from 'sweeptolive' in cost of atomic step
2012-05-31 18:28:59 -03:00
Roberto Ierusalimschy
4dd0622d0c
bug in luaL_getsubtable (calling lua_absindex not with original stack)
2012-05-31 17:28:45 -03:00
Roberto Ierusalimschy
ab2c3d5cde
small bug in error handling of finalizers (cannot call lua_tostring
...
inside the core) + small bug in luaC_checkfinalizer (when avoiding
remove object being sweeped from sweep list) + small changes in GC
pace control (for the atomic part)
2012-05-31 17:26:14 -03:00
Roberto Ierusalimschy
01e5f358bd
small improvement in lua_checkmemory (only allow dead objects in
...
part of the sweep list not yet sweeped)
2012-05-31 17:25:42 -03:00
Roberto Ierusalimschy
69c775de21
update of 'lua_checkmemory'
2012-05-30 13:40:29 -03:00
Roberto Ierusalimschy
6fcdfc6d4f
bug: object being moved to 'finobj' list might not be sweeped by
...
the collector
2012-05-30 13:01:10 -03:00
Roberto Ierusalimschy
b77a90681e
typos in comments
2012-05-30 09:33:44 -03:00
Roberto Ierusalimschy
6efffb9acd
only count in 'atomic' objects marked for the first time
2012-05-29 14:52:17 -03:00
Roberto Ierusalimschy
51e8f08e60
more efficient way to apply 'stepmul' + some changes in GC parameters
2012-05-28 17:41:00 -03:00
Roberto Ierusalimschy
5adb5a4812
definition for 'MAX_LMEM'
2012-05-28 17:32:28 -03:00
Roberto Ierusalimschy
e29f3a5751
definition of 'GCSTEPSIZE' moved to header file + small changes
2012-05-23 12:43:14 -03:00
Roberto Ierusalimschy
21ed264a38
compensate for 'GCSTEPSIZE' in GC steps
2012-05-23 12:42:27 -03:00
Roberto Ierusalimschy
e131eb0d9a
removed debug code
2012-05-23 12:41:53 -03:00
Roberto Ierusalimschy
054c20cd5b
spaces -> tabs in #defines
2012-05-23 12:37:09 -03:00
Roberto Ierusalimschy
8e7149f496
detail ('char' should be 'const char')
2012-05-22 15:38:56 -03:00
Roberto Ierusalimschy
086da10dac
merge of fields 'lastmajormem' (used in gen. mode) and 'estimate'
...
(used in inc. mode)
2012-05-22 14:50:39 -03:00
Roberto Ierusalimschy
b36b4b521f
try to avoid sweeping new objects created with new white (and
...
therefore not collectable in the current cycle)
2012-05-22 14:32:25 -03:00
Roberto Ierusalimschy
398811a313
simpler macro 'luaC_condGC' + better 'step' in 'lua_gc' +
...
micro bug in 'luaC_checkfinalizer' (current sweep object could be
removed from 'allgc' list)
2012-05-21 10:18:10 -03:00
Roberto Ierusalimschy
2a66b34f72
revamp of the GC pace control; more like 5.1: any X Kbytes allocated
...
makes the GC handle f(X) Kbytes of objects
2012-05-20 17:36:44 -03:00
Roberto Ierusalimschy
8d0e1ed52f
extend optimization of 'if a then break end' for the case
...
'if a then break; end'
2012-05-20 11:51:23 -03:00
Roberto Ierusalimschy
3ac595da8a
allow "long double" precision for PI constant if needed
2012-05-18 14:47:53 -03:00
Roberto Ierusalimschy
ea980fdeef
removed 'stringmark' trick
2012-05-14 14:52:56 -03:00
Roberto Ierusalimschy
5654763797
macro 'checkGC' takes care of setting 'top' to limit stack live values
2012-05-14 14:50:49 -03:00
Roberto Ierusalimschy
edfa9e007d
details (header comments)
2012-05-14 10:34:18 -03:00
Roberto Ierusalimschy
31829ad177
test for whether collector is running moved from function to
...
macro 'luaC_condGC'.
2012-05-11 16:22:33 -03:00
Roberto Ierusalimschy
c2361e0b61
definition for 'LUAI_MAXSHORTLEN' moved to luaconf.h (too important)
2012-05-11 11:14:42 -03:00
Roberto Ierusalimschy
77cbd817d1
better(?) handling of '#define's for IEEE-related tricks + avoid using
...
IEEE trick for 64-bit integer types (lua_Integer on 64-bit machines)
2012-05-11 11:10:50 -03:00
Roberto Ierusalimschy
4ec7d6de95
bug: wrong handling of 'nCcalls' in coroutines
2012-05-11 11:10:28 -03:00
Roberto Ierusalimschy
f6a12948ca
useless parameter in macro 'luai_makeseed'
2012-05-11 11:06:07 -03:00
Roberto Ierusalimschy
3cadc37f47
no more 'Proto' objects on the stack. Protos are anchored on outer
...
Protos or on a Closure, which must be created before the Proto.
2012-05-08 10:53:33 -03:00
Roberto Ierusalimschy
bb1146dc39
wrong error message when 'coroutine.create' or 'coroutine.wrap' are
...
called with no arguments (new thread is assumed to be the missing
argument).
2012-04-27 15:59:04 -03:00
Roberto Ierusalimschy
fc24a3a6c4
small bug: a reader function should not modify the Lua stack
2012-04-27 11:13:19 -03:00
Roberto Ierusalimschy
a94ce68e0a
bug: wrong handling of 'nCcalls' in coroutines
2012-04-26 17:41:18 -03:00
Roberto Ierusalimschy
ec22fc963a
detail (separate code to create 'searchers' table into a new function)
2012-04-26 16:38:52 -03:00
Roberto Ierusalimschy
c54f5f64c9
primaryexp -> suffixedexp; prefixexp -> primaryexp + more 'syntactical'
...
way to distinguish between function calls and assignments
2012-04-20 16:20:05 -03:00
Roberto Ierusalimschy
4cca1a436d
details (using lua_setglobal/lua_getglobal instead of explicit
...
use of the global table)
2012-04-20 14:05:17 -03:00
Roberto Ierusalimschy
8df0198178
release 5.2.1
2012-04-20 10:18:26 -03:00
Roberto Ierusalimschy
048be9cf27
different scheme to check arguments to '%d', '%x', etc. Old scheme
...
did not work well when lua_Number is an integer.
2012-04-20 10:16:48 -03:00
Roberto Ierusalimschy
1485ea2ee7
Finalizers may call functions from a dynamic library after
...
the library has been unloaded
2012-04-12 13:25:25 -03:00
Roberto Ierusalimschy
b10dbe5c72
bug: C libraries must be unloaded after all other finalizers have run,
...
because a finalizer may use a C function from a C library
2012-04-11 13:35:32 -03:00
Roberto Ierusalimschy
462375ba47
'if' to avoid empty 'memcpy' (may be expensive)
2012-04-03 16:06:19 -03:00
Roberto Ierusalimschy
cfbe2333a4
string hash may not use all bytes (but this is configurable now) +
...
small other changes
2012-03-28 15:28:25 -03:00
Roberto Ierusalimschy
afc3fcf952
definition for 'LUA_MAXSHORTLEN' moved to 'lstring.c' (used only there)
2012-03-28 15:27:25 -03:00
Roberto Ierusalimschy
99bd1a000f
error function can be 'l_noret'
2012-03-19 19:58:09 -03:00
Roberto Ierusalimschy
3e66d3b4be
cleaner code (avoids loop with empty body)
2012-03-19 19:57:14 -03:00
Roberto Ierusalimschy
29a28693e5
'luaL_checkversion' called by 'luaL_setfuncs'
2012-03-18 13:52:49 -03:00
Roberto Ierusalimschy
678c1255c9
random seed used in the hash of all strings to avoid intentional
...
collisions
2012-02-01 19:57:15 -02:00
Roberto Ierusalimschy
a4b96ce9a3
first implementation of long strings
2012-01-25 19:05:40 -02:00
Roberto Ierusalimschy
291f564485
field 'reserved' -> 'extra' (may be used for other purposes too)
2012-01-23 21:05:51 -02:00
Roberto Ierusalimschy
9f1a8dbdd3
'eqstr' -> 'luaS_eqstr'
2012-01-23 21:05:18 -02:00
Roberto Ierusalimschy
d19f1da6ef
new macro 'isreserved' + 'eqstr' -> 'luaS_eqstr' (may be a function)
2012-01-23 21:04:07 -02:00
Roberto Ierusalimschy
f88806a1fb
"default: lua_assert(0)" in switches helps debugging + uses
...
non-variant types in binary files
2012-01-23 21:02:10 -02:00
Roberto Ierusalimschy
fb6eee2805
Lua never uses Ã'assert' (it is always 'lua_assert')
2012-01-23 20:59:02 -02:00
Roberto Ierusalimschy
0010ec68b1
documentation comment (small correction about strings being
...
gray)
2012-01-23 18:29:12 -02:00
Roberto Ierusalimschy
28f8ed9113
new macro 'checktype'
2012-01-20 20:47:11 -02:00
Roberto Ierusalimschy
fd22ccd6d0
object tag keeps variant bits too -> no need for 'isC' field in
...
Closures + more strick typing for closure variants
2012-01-20 20:05:50 -02:00
Roberto Ierusalimschy
76eab106df
bug: Lexical gets confused with some combination of arithmetic
...
operators and hexadecimal numbers
2012-01-20 16:35:36 -02:00
Roberto Ierusalimschy
81ed85ecfb
BUG: memory hoarding when creating Lua hooks for coroutines
...
BUG: Lexical gets confused with some combination of arithmetic
operators and hexadecimal numbers
2012-01-20 16:32:13 -02:00
Roberto Ierusalimschy
7dcc02b165
BUG: coroutine hooks were not collected together with coroutine
2012-01-19 18:14:44 -02:00
Roberto Ierusalimschy
e2fc2ce8df
new way to handle -E option (write a mark in the registry to avoid
...
reading environment variables)
2011-12-12 14:34:03 -02:00
Roberto Ierusalimschy
a241b6cb3c
removed redundant definition for FILEHANDLE
2011-12-08 10:11:37 -02:00
Roberto Ierusalimschy
f0d143f30f
avoid a few warnings (casts)
2011-12-07 16:03:47 -02:00
Roberto Ierusalimschy
c82087b8dd
cast from 'bool' to 'int' (for C++)
2011-12-07 12:43:55 -02:00
Roberto Ierusalimschy
138be5b843
no more explicit support for 'luaall_c': unifying file can do
...
the work
2011-12-06 14:58:36 -02:00
Roberto Ierusalimschy
e320b5b672
small bug: format '%d' for lua_Number argument
2011-12-06 14:33:55 -02:00
Roberto Ierusalimschy
ca9c405fef
some compilers (e.g., gcc C++) do not accept NULL as a pointer in
...
that context
2011-12-02 11:26:54 -02:00
Roberto Ierusalimschy
e2feb886d6
macro 'luaL_getmetatable' seems more appropriate when getting
...
metatables in registry
2011-12-02 11:25:57 -02:00
Roberto Ierusalimschy
5999e14ad9
old error messages may be misleading
2011-12-02 11:23:56 -02:00
Roberto Ierusalimschy
01747f2c24
error message: "tag method" -> "metamethod"
2011-12-02 11:18:41 -02:00
Roberto Ierusalimschy
7377fbdebc
function prototype did not match one in .h
2011-11-30 17:30:16 -02:00
Roberto Ierusalimschy
f1d2ac3a98
allow non-integer arguments to integer formats (%d, %x, etc.),
...
but check range
2011-11-30 16:24:56 -02:00
Roberto Ierusalimschy
c5da4f4cd0
unused variable removed
2011-11-30 11:03:24 -02:00
Roberto Ierusalimschy
7bcb2462e4
comments
2011-11-30 10:58:57 -02:00
Roberto Ierusalimschy
0bd99b327b
avoid "unreachable" 'break'
2011-11-30 10:44:26 -02:00
Roberto Ierusalimschy
6d8b672094
more uses of 'l_noret'
2011-11-30 10:43:51 -02:00
Roberto Ierusalimschy
e21b26a964
avoid 'return' "to avoid warnings"
2011-11-30 10:42:49 -02:00
Roberto Ierusalimschy
0f388193b3
'lUA' -> 'LUA'
2011-11-30 10:35:05 -02:00
Roberto Ierusalimschy
7948b8568e
when available, use '*_r' versions of 'gmtime' and 'localtime'
2011-11-29 15:15:42 -02:00
Roberto Ierusalimschy
61b1d9a466
another try to avoid warnings about unreachable 'return' after 'exit'
2011-11-29 13:55:51 -02:00
Roberto Ierusalimschy
3617e04e97
'lua_load' has an extra argument 'mode'
2011-11-29 13:55:08 -02:00
Roberto Ierusalimschy
8c62bde36f
comment
2011-11-29 13:54:38 -02:00
Roberto Ierusalimschy
51650eac78
small change to avoid warnings of non-specified order of access
...
to volatile fields
2011-11-29 13:39:48 -02:00
Roberto Ierusalimschy
aea68e5c54
explicit option RTLD_LOCAL instead of 0 (Posix does not fix
...
a default for dlopen)
2011-11-28 15:27:51 -02:00
Roberto Ierusalimschy
ece042fef0
'table.pack' does not return 'n' (may be confusing when
...
using table.pack as last argument in a call)
2011-11-28 15:26:30 -02:00
Roberto Ierusalimschy
217b65e6d9
avoid some warnings about converting 32-bit shifts into 64-bit results
2011-11-28 15:25:48 -02:00
Roberto Ierusalimschy
8119374e74
avoid warnings of unreacheable 'break's
2011-11-28 15:25:16 -02:00
Roberto Ierusalimschy
3a997eefb5
MS_ASMTRICK is only valid on MS compilers (not any Windows compiler)
2011-11-25 10:52:27 -02:00
Roberto Ierusalimschy
5184ff2096
'LUA_DL_DLL' is not yet defined before the inclusion of 'lua.h'
2011-11-25 10:52:03 -02:00
Roberto Ierusalimschy
b0cbe77816
'_fseeki64' and family not available in all Windows platforms
2011-11-25 10:50:03 -02:00
Roberto Ierusalimschy
6e899850b9
details
2011-11-24 11:25:41 -02:00
Roberto Ierusalimschy
fded7bef19
options for 'collectgarbage' renamed: "inc" -> "incremental";
...
"gen" -> "generational"
2011-11-23 15:29:04 -02:00
Roberto Ierusalimschy
b5d7255034
small changes to avoid some warnings
2011-11-16 16:51:36 -02:00
Roberto Ierusalimschy
6cce5c0601
new function 'luaL_loadfilex'
2011-11-14 15:10:24 -02:00
Roberto Ierusalimschy
eb70f58279
'luaIO_Stream' -> 'luaL_Stream'
2011-11-14 14:55:35 -02:00
Roberto Ierusalimschy
ef900f224c
strutcture for file handles exported in 'lauxlib.h'
2011-11-11 17:59:17 -02:00
Roberto Ierusalimschy
3105febf9a
using Lua buffers to build error messages
2011-11-10 09:42:58 -02:00
Roberto Ierusalimschy
7133e20c94
make treatment of 'pcall' and 'xpcall' more similar
2011-11-09 17:38:00 -02:00
Roberto Ierusalimschy
888d39ea75
refactoring of common parts of 'pcall' and 'xpcall' + avoids
...
stack errors on these functions (return error code instead)
2011-11-09 17:28:27 -02:00
Roberto Ierusalimschy
eef22fa4ce
create error messages with a single concat, to avoid problems with
...
creating strings piecemeal
2011-11-09 17:11:20 -02:00
Roberto Ierusalimschy
eda87f1156
in 'luaL_checkstack', include extra stack space in test to allow
...
correct execution of error routines, if necessary
2011-11-09 17:08:55 -02:00
Roberto Ierusalimschy
e0e406ead3
extra argument to instruction 'checkstack' (in 'testC')
2011-11-09 17:08:07 -02:00
Roberto Ierusalimschy
30cea671a7
configurable 'directory separator' in 'package.searchpath'
2011-11-09 13:18:04 -02:00
Roberto Ierusalimschy
a716ae1f50
avoids including 'stdio.h' everywhere (because of definitions for
...
luai_writestring/luai_writeline)
2011-11-09 12:47:14 -02:00
Roberto Ierusalimschy
ea382b0be1
small bug: error message in 'io.lines' is not the error number
2011-11-09 12:10:43 -02:00
Roberto Ierusalimschy
6d8d282e0f
avoid calling "extra value" as if it were a function option
2011-11-06 11:59:12 -02:00
Roberto Ierusalimschy
00c8a17a2d
by default, do not use Windows' goodies in Windows CE build
2011-11-05 13:29:05 -02:00
Roberto Ierusalimschy
166ce15512
cannot apply macro 'getstr' over NULL
2011-10-31 15:48:51 -02:00
Roberto Ierusalimschy
87cf2bf711
extra comments about what fields are optional debug information
2011-10-31 15:48:22 -02:00
Roberto Ierusalimschy
fd8a849621
detail (avoid applying macro 'getstr' with a function-call argument)
2011-10-31 15:46:04 -02:00
Roberto Ierusalimschy
5a568a3b01
detail (comment)
2011-10-25 10:01:20 -02:00
Roberto Ierusalimschy
475e6c5352
'lua_setglobal/lua_getglobal' implemented as functions to avoid
...
problems with stack indices
(e.g., lua_getglobal(L, lua_tostring(L, -1)) )
2011-10-24 14:53:05 -02:00
Roberto Ierusalimschy
af00a0772c
new functions lua_rawsetp/lua_rawgetp
2011-10-24 12:54:05 -02:00
Roberto Ierusalimschy
6819c2a98a
silly bug in 5.2 beta: assignment conflict code did not test to check
...
whether variable was a table element
2011-10-24 12:51:44 -02:00
Roberto Ierusalimschy
1dd8af67b6
BUG: parser may collect a prototype while building it.
2011-10-21 17:34:23 -02:00
Roberto Ierusalimschy
1350a2bcb5
more macros to try to make NaN trick work with other sizes of
...
IEEE float numbers. (It has not been tested with such different
sizes...)
2011-10-17 12:46:13 -02:00
Roberto Ierusalimschy
217e67cb22
new type 'l_noret' for function that do not return
2011-10-07 17:45:19 -03:00
Roberto Ierusalimschy
9bbfe9f3fd
avoid the word 'TRICKLE' in macro name (as it has nothing to do
...
with its meaning)
2011-10-07 16:53:05 -03:00
Roberto Ierusalimschy
788a0ecd27
'luaC_separateudata' renamed to 'separatetobefnz' and called only
...
from 'lgc.c'
2011-10-03 14:54:25 -03:00
Roberto Ierusalimschy
6d86b937e4
'luaC_separateudata' called from 'luaC_freeallobjects' + removed
...
extra 'luaF_close' (already being called by 'close_state')
2011-10-03 14:54:25 -03:00
Roberto Ierusalimschy
bc90cf4b83
retraverse all gray lists together to avoid traversing some weak
...
tables twice (as they may change lists when traversed)
2011-10-03 13:22:05 -03:00
Roberto Ierusalimschy
d79190e27f
missing 'LUA_CORE' definition
2011-10-03 13:19:23 -03:00
Roberto Ierusalimschy
9caf5b4f79
lint (unused definition)
2011-09-30 09:46:06 -03:00
Roberto Ierusalimschy
50cddefeeb
lint (wrong identation)
2011-09-30 09:45:45 -03:00
Roberto Ierusalimschy
e24f1ee9ff
lint (unreachable code)
2011-09-30 09:44:45 -03:00
Roberto Ierusalimschy
f3b0eb3ecf
lint (unused macros)
2011-09-30 09:44:19 -03:00
Roberto Ierusalimschy
162ce8256e
lint (unused struct field)
2011-09-30 09:43:54 -03:00
Roberto Ierusalimschy
ad90447eb6
detail: new macros for non-valid values
2011-09-26 17:17:27 -03:00
Roberto Ierusalimschy
87912786af
dead objects are not collectable.
2011-09-24 18:12:01 -03:00
Roberto Ierusalimschy
5645a84368
detail about 'trick' function (nil turn it off)
2011-09-24 18:11:29 -03:00
Roberto Ierusalimschy
95ed6c1127
better(?) scheme for cleaning weak tables; all ressurected objects
...
are removed from weak values before finalization
2011-09-24 18:00:40 -03:00
Roberto Ierusalimschy
12ab78aca6
detail in extra trace code: total bytes is given by 'gettotalbytes',
...
not by 'totalbytes' counter.
2011-09-20 16:25:23 -03:00
Roberto Ierusalimschy
45c346645c
avoid clearing ephemeron tables that have nothing to be cleaned
...
(no white elements)
2011-09-19 14:03:38 -03:00
Roberto Ierusalimschy
68ce878292
cannot compute 'mainposition' before checking whether key is nil
2011-09-15 14:09:02 -03:00
Roberto Ierusalimschy
500336efd0
small bug in if-goto optimization: block must be closed ('leaveblock')
...
*before* the jump out ('escapelist')
2011-09-14 14:40:26 -03:00
Roberto Ierusalimschy
5ea8f108e1
using 'long' versions of 'fseek'/'ftell' when available
2011-09-13 18:09:04 -03:00
Roberto Ierusalimschy
2275030b86
details (and missing 'break's)
2011-09-13 15:05:59 -03:00
Roberto Ierusalimschy
05de314701
upvalue names always can be NULL (if debug info was removed), so
...
always check for that case
2011-09-13 14:40:20 -03:00
Roberto Ierusalimschy
d281d23f8d
detail (make 'lua_assert' a valid expression even when turned off)
2011-09-13 14:39:23 -03:00
Roberto Ierusalimschy
ec431ce5db
comment
2011-09-12 17:33:03 -03:00
Roberto Ierusalimschy
c8f47c2934
optimization for |if cond then goto|
2011-08-30 13:38:58 -03:00
Roberto Ierusalimschy
ca458f1f52
'luaK_goiffalse' exported
2011-08-30 13:26:41 -03:00
Roberto Ierusalimschy
121dc8af66
cleaner code for 'if' construct
2011-08-25 10:45:24 -03:00
Roberto Ierusalimschy
a8675966ec
detail: centralize all tests for Windows on variable 'LUA_WIN'
2011-08-23 14:25:42 -03:00
Roberto Ierusalimschy
3dc5475e23
'nCcalls' should be local to each thread, as each thread may have its
...
own C stack (with LuaThreads or something similar)
2011-08-23 14:24:34 -03:00
Roberto Ierusalimschy
8a008a2057
bug: __newindex metamethod may not work if metatable is its own
...
metatable.
2011-08-17 17:38:51 -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
166dd0261a
new option '-E' to avoid environment variables
2011-08-17 17:19:52 -03:00
Roberto Ierusalimschy
51471ba748
comments about use of 'luaH_set'
2011-08-15 16:41:58 -03:00
Roberto Ierusalimschy
0b65cb74cd
new implementation for 'getobjname': first search for relevant
...
instruction (new function 'findsetreg') and then try to build
a meaningful name
2011-08-12 17:01:44 -03:00
Roberto Ierusalimschy
ea46b750dc
comment
2011-08-11 14:06:12 -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
b5bf7d9ef4
'string.format' checks whether values for integer formats are
...
actually integers
2011-08-09 17:58:29 -03:00
Roberto Ierusalimschy
6a5d89b39f
detail (using array instead of several variables to keep track of
...
enabled command-line options)
2011-08-04 15:16:16 -03:00
Roberto Ierusalimschy
ae14adc272
better error message when trying to open files
2011-08-02 15:00:01 -03:00
Roberto Ierusalimschy
ff98f17d27
detail: factoring in common code for opening files and checking for
...
errors
2011-07-28 15:41:15 -03:00
Roberto Ierusalimschy
59bcd137ae
reducing even more use of C stack by the parser: struct 'FuncState'
...
does not need field 'L' + number of labels/gotos in a chunk may be
limited to SHRT_MAX. (Also removed some non-needed 'unsigned's.)
2011-07-27 15:09:01 -03:00
Roberto Ierusalimschy
5ab6d36d99
no more field 'L' in 'FuncState'
2011-07-27 15:07:37 -03:00
Roberto Ierusalimschy
43c873895f
tonumber: base 10 is not special, no base is
2011-07-27 09:14:06 -03:00
Roberto Ierusalimschy
03a078493e
refuse things like 'inf' or 'Nan' as numerals
2011-07-27 09:13:08 -03:00
Roberto Ierusalimschy
bae57ea088
'M_IX86' -> '_M_IX86'
2011-07-25 14:20:47 -03:00
Roberto Ierusalimschy
2557107e91
removed unused variable 'found' (in 'findfield') + removed legacy
...
test for 'what' being "tail"
2011-07-25 14:18:49 -03:00
Roberto Ierusalimschy
32a12e2f3f
detail (cleaned whitespaces at end of lines)
2011-07-15 09:50:29 -03:00
Roberto Ierusalimschy
559bb554c9
no more 'zungetc' (better not to read next char)
2011-07-15 09:48:03 -03:00
Roberto Ierusalimschy
fd5e810e08
macro 'char2int' replaced by 'cast_uchar' (used by other files)
2011-07-15 09:35:32 -03:00
Roberto Ierusalimschy
067f761739
better code for numerical escapes
2011-07-15 09:30:41 -03:00
Roberto Ierusalimschy
7978a8d8b2
added '_M_IX86' in NaN trick
2011-07-08 17:07:11 -03:00
Roberto Ierusalimschy
32e09c2a16
detail
2011-07-08 17:01:38 -03:00
Roberto Ierusalimschy
df19931ddc
error on invalid escape sequences
2011-07-08 16:17:30 -03:00
Roberto Ierusalimschy
b5084fdafe
detail (comment)
2011-07-06 13:45:14 -03:00
Roberto Ierusalimschy
d8200d5f3c
'\*' -> '\z' + '\?' is not an official escape sequence
2011-07-05 16:13:45 -03:00
Roberto Ierusalimschy
79cbc3468c
removed and deprecated functions really removed from the code base
2011-07-05 09:49:35 -03:00
Roberto Ierusalimschy
9e89a55a4f
NILCONSTANT also depends no endianess (with NaN trick)
2011-07-04 17:29:02 -03:00
Roberto Ierusalimschy
b707e81c3d
comments about some compiler options that should be tested once in a while
2011-07-04 13:10:15 -03:00
Roberto Ierusalimschy
ee37ee50d6
'table.pack' also returns 'n' + 'deprecated' changed to 'removed'
2011-07-02 13:01:44 -03:00
Roberto Ierusalimschy
ad1a54b5c0
reordering of some defines (more logical grouping)
2011-07-02 13:00:15 -03:00
Roberto Ierusalimschy
88c29c0cd5
compilation warning about integer size x pointer size
2011-07-02 12:59:17 -03:00
Roberto Ierusalimschy
d93df22bf6
small simplifications (and assert was wrongly written)
2011-07-02 12:58:14 -03:00
Roberto Ierusalimschy
5017cc6ba2
simpler 'luai_apicheck' (and avoids compilation error...)
2011-07-02 12:57:25 -03:00
Roberto Ierusalimschy
2f125ebc33
'deprecated' x 'removed' (they are not the same thing)
2011-07-02 12:56:43 -03:00
Roberto Ierusalimschy
49a01c0991
'package.loaders' -> 'package.searchers'
2011-06-28 14:14:12 -03:00
Roberto Ierusalimschy
17526ed2fe
no more errors on accesses to 'string' and strings
2011-06-28 14:13:52 -03:00
Roberto Ierusalimschy
f180822fa6
back to internal table for 'ctype', no more locale manipulation
2011-06-28 12:42:04 -03:00
Roberto Ierusalimschy
594220c624
use standard "underscore + uppercases" for reserved keys in the registry
2011-06-27 16:42:31 -03:00
Roberto Ierusalimschy
3dd68624dc
comments
2011-06-27 15:27:18 -03:00
Roberto Ierusalimschy
f9eea453b7
avoid "magic constant" 32 (the difference from 'A' to 'a')
2011-06-27 15:22:46 -03:00
Roberto Ierusalimschy
374773748b
back to "one-label-per-block"
2011-06-27 15:18:59 -03:00
Roberto Ierusalimschy
29644366fc
useless assignments removed (macros already do the assignment)
2011-06-24 11:36:21 -03:00
Roberto Ierusalimschy
6eadedbfa1
resort to standard C ctype for non-ASCII systems + 'ltoupper' replaced
...
by 'ltolower'
2011-06-24 09:25:33 -03:00
Roberto Ierusalimschy
1978094b3a
resort to standard C ctype for non-ASCII systems
2011-06-24 09:25:33 -03:00
Roberto Ierusalimschy
5acc5b0c1e
using 'tolower' instead of 'toupper' (slightly simpler to implement)
2011-06-24 09:25:02 -03:00
Roberto Ierusalimschy
59547c6cda
macro 'ltoupper' instead of 'lisupper' (more usefull for Lua)
2011-06-23 13:01:06 -03:00
Roberto Ierusalimschy
3d3355b4f3
label syntax changed to '::label::'
2011-06-23 11:54:48 -03:00
Roberto Ierusalimschy
801f43f09a
change in the representation of file handles
2011-06-21 10:43:48 -03:00
Roberto Ierusalimschy
719c01359f
label syntax changed to '::label::'
2011-06-20 13:52:48 -03:00
Roberto Ierusalimschy
43f13729a2
comment
2011-06-20 13:50:59 -03:00
Roberto Ierusalimschy
136f8e148d
added cast to void to calls to 'setlocale' (to easy redefining it as
...
a constant)
2011-06-20 13:36:03 -03:00
Roberto Ierusalimschy
f90a130b07
typo in message
2011-06-20 13:35:23 -03:00
Roberto Ierusalimschy
cb4950a6d8
parser must work with C locale, but external locale must be preserved
2011-06-18 14:08:58 -03:00
Roberto Ierusalimschy
fdede85419
label names must be unique inside a function
2011-06-16 13:36:39 -03:00
Roberto Ierusalimschy
beab626061
correct length for LUA_COPYRIGHT (without trailing '\0')
2011-06-16 11:30:58 -03:00
Roberto Ierusalimschy
817f8674af
avoid warning about -unsigned value
2011-06-16 11:14:31 -03:00
Roberto Ierusalimschy
cf0562e1e7
detail (missing cast to unsigned char when converting char to int)
2011-06-16 11:13:22 -03:00
Roberto Ierusalimschy
22e1c5ebad
avoid conversion from 'const char*' to 'void *' (warning about 'const')
2011-06-16 11:12:24 -03:00
Roberto Ierusalimschy
470dd56a89
'os.execute' (and similars) should return 'exit' and code in case
...
of success, too.
2011-06-16 11:11:04 -03:00
Roberto Ierusalimschy
20d30bcd33
declarations should be present only when implementations are
2011-06-16 11:10:12 -03:00
Roberto Ierusalimschy
44b6f496b5
just in case, avoid side effects in 'ctype' macros
2011-06-15 11:35:55 -03:00
Roberto Ierusalimschy
fd80e63468
configuration for NaN trick big-endian + macro 'luai_checknum' to
...
ensure numbers comming from C are not "improper" (some kinds of
signaling NaNs)
2011-06-13 11:13:06 -03:00
Roberto Ierusalimschy
f62565abea
avoid warnings with -Wstrict-overflow
2011-06-09 15:24:22 -03:00
Roberto Ierusalimschy
c9d1d9f9c6
better way to test overflows with string indices
2011-06-09 15:22:47 -03:00
Roberto Ierusalimschy
35391d9b1a
macro 'NNMARK' (mark for non-number values using the NaN trick)
2011-06-09 15:21:25 -03:00
Roberto Ierusalimschy
99b1b8e918
first version with 'NANTRICK' (packing all Lua values inside a 'double')
2011-06-07 16:02:33 -03:00
Roberto Ierusalimschy
3b44821334
stricter control (using tag variants) over closure kinds (Lua x C)
2011-06-02 16:31:40 -03:00
Roberto Ierusalimschy
0214dab989
yet another macro ('num_')
2011-05-31 16:15:01 -03:00
Roberto Ierusalimschy
821bd7025e
more uniform names for 'equalobj'-related functions
2011-05-31 15:27:56 -03:00
Roberto Ierusalimschy
9b7dddad7d
no need for two different implementations for equality (one raw and
...
one with metamethods)
2011-05-31 15:24:36 -03:00
Roberto Ierusalimschy
3f04a9f2c0
code is simpler without 'goto' here
2011-05-30 13:36:38 -03:00
Roberto Ierusalimschy
2a59a999d4
yet another macro abstracting TValue representation
2011-05-26 14:12:31 -03:00
Roberto Ierusalimschy
ee7d0c2649
new macro 'luai_writeline' to print newlines (and flush 'stdout')
2011-05-26 13:09:40 -03:00
Roberto Ierusalimschy
aa13c591f5
avoid use of 'ifdef/ifndef'; use 'defined' instead (simpler and
...
more powerful)
2011-05-25 11:12:28 -03:00
Roberto Ierusalimschy
6c8a32217a
changes by lhf (better control of chars x bytes)
2011-05-17 09:42:43 -03:00
Roberto Ierusalimschy
cb09f4fef4
details
2011-05-06 13:00:23 -03:00
Roberto Ierusalimschy
3cf1729a02
new macro 'lua_longassert' that is equivalent to an assertion without
...
a stringfication of the condition, to avoid too long string literals
(limited by C90 to ~510 characters)
2011-05-05 16:43:14 -03:00
Roberto Ierusalimschy
74b0bb3a45
macro 'checkconsistency' moved to this file, as it is used only
...
here
2011-05-05 16:42:25 -03:00
Roberto Ierusalimschy
e4076fe6d9
break long assertion in two shorter ones
2011-05-05 13:18:53 -03:00
Roberto Ierusalimschy
81952e6884
avoid using expression as argument to unsafe macro 'l_isfalse'
2011-05-05 13:16:33 -03:00
Roberto Ierusalimschy
25b4e35ee8
new macros abstracting TValue representation (to easy change to
...
other representations)
2011-05-05 12:53:23 -03:00
Roberto Ierusalimschy
7e1facaa4e
detail in assertion
2011-05-04 14:04:06 -03:00
Roberto Ierusalimschy
ad2531a0ee
more complete (and hopefuly more correct) handling of 'sizeof(char)'
2011-05-03 13:01:57 -03:00
Roberto Ierusalimschy
bc1c718cc0
removed TOKEN_LEN (useless)
2011-05-03 12:51:16 -03:00
Roberto Ierusalimschy
c9ce754e38
comment
2011-05-02 14:33:01 -03:00
Roberto Ierusalimschy
d34271fe42
MacOS 'strtod' handles hexa formats too
2011-04-29 10:56:28 -03:00
Roberto Ierusalimschy
d120ec29ca
bug in OP_SELF when method name goes to a register
2011-04-28 11:00:11 -03:00
Roberto Ierusalimschy
2aff901c93
Mac OS defines LUA_USE_AFORMAT and LUA_USE_LONGLONG by default
2011-04-20 15:25:54 -03:00
Roberto Ierusalimschy
bad231c481
'LUA_USELONGLONG' -> 'LUA_USE_LONGLONG'
2011-04-20 13:36:28 -03:00
Roberto Ierusalimschy
a2b1c279f1
'LUA_USELONGLONG' on by default on Linux + LUA_USE_HEXAFLOAT renamed
...
to LUA_USE_STRTODHEX (as Lua 5.2 always *uses* hexa floats)
2011-04-19 15:31:30 -03:00
Roberto Ierusalimschy
2f128c5130
'luaL_setfuncs' does not need to accept a NULL list. (If there is
...
no list, there is no reason to call this function.)
2011-04-19 15:29:41 -03:00
Roberto Ierusalimschy
4758113043
change in opcode OP_LOADNIL: B is used as a counter instead of a
...
register. (Avoids an assignment to R(B), not present in any other
instruction.)
2011-04-19 13:22:13 -03:00
Roberto Ierusalimschy
a4e644add2
small bug (masked by wrong entry for OP_TEST in opcodes.c)
2011-04-18 16:49:13 -03:00
Roberto Ierusalimschy
05ca63642b
added macro for code checking
2011-04-18 16:48:53 -03:00
Roberto Ierusalimschy
f17e3624ef
local function name only visible to debug info after being initialized
2011-04-18 16:48:24 -03:00
Roberto Ierusalimschy
2e9b8476ca
detail ('luai_apicheck' should be used always through macro 'api_check')
2011-04-18 12:02:37 -03:00
Roberto Ierusalimschy
c31f4946e9
copyright updated to 2011
2011-04-18 11:15:48 -03:00
Roberto Ierusalimschy
c86586e866
small corrections in description of OP_TEST and OP_LOADKX
2011-04-12 14:27:35 -03:00
Roberto Ierusalimschy
19fbdf6cae
'luaL_findtable' -> 'luaL_getsubtable'
2011-04-08 16:17:36 -03:00
Roberto Ierusalimschy
427ee519db
new instruction OP_LOADKX (to replace OP_LOADK with extra argument)
2011-04-07 15:14:12 -03:00
Roberto Ierusalimschy
a958b711f5
cleaner scheme of bits for variant types (light C functions) and
...
collectable types
2011-04-07 13:11:57 -03:00
Roberto Ierusalimschy
1ffdd0bc7a
detail (should use macro 'ttisdeadkey')
2011-04-05 15:32:28 -03:00
Roberto Ierusalimschy
5286650894
new macro 'ttisequal'
2011-04-05 15:32:06 -03:00
Roberto Ierusalimschy
0fb1644c60
2nd operand for unary tag methods does not need to be 'nil'
2011-04-05 11:26:23 -03:00
Roberto Ierusalimschy
119d5e46d5
lua_arith gets no fake operand for unary minus
2011-04-05 11:26:23 -03:00
Roberto Ierusalimschy
83abbac946
all names used internally by macros end with '_'
2011-04-05 11:24:07 -03:00
Roberto Ierusalimschy
a25416a8d5
use of 'luaL_tolstring' for option '%s' in 'string.format'
2011-03-18 16:02:33 -03:00
Roberto Ierusalimschy
682cce3813
macro 'mark' renamed 'EOFMARK' ('mark' is too easy to confict, e.g.
...
in alllua.c)
2011-03-14 12:39:42 -03:00
Roberto Ierusalimschy
d806710ab5
returns for file-related functions and process-related functions
...
unified in 'auxlib'
2011-03-03 13:34:46 -03:00
Roberto Ierusalimschy
e049abb69a
loaders receive an extra argument returned by the searcher
...
(typically the file name)
2011-03-01 14:01:53 -03:00
Roberto Ierusalimschy
98816d0ce5
small problems with 'luaone.c'
2011-02-28 14:32:10 -03:00
Roberto Ierusalimschy
7482e8f914
no need of lookahead in Zio
2011-02-23 10:13:10 -03:00
Roberto Ierusalimschy
03b769053a
correct interpretation of return value from pclose
2011-02-21 16:12:54 -03:00
Roberto Ierusalimschy
3c710f056b
small bug: may call reader function again after it returned end
...
of input
2011-02-17 15:34:16 -02:00
Roberto Ierusalimschy
c0a865fa54
error for repeated label + jumps allowed to labels followed by
...
'no-op' statements
2011-02-14 14:36:34 -02:00
Roberto Ierusalimschy
0009ac1f3a
'break' does not need to be last statement in a block +
...
'explist1' -> 'explist' + moving a few functions around
2011-02-14 12:59:28 -02:00
Roberto Ierusalimschy
7b968bb514
p-close returns "correct" status plus type of termination
2011-02-10 13:35:50 -02:00
Roberto Ierusalimschy
bf8b08295a
'break' coded as 'goto' + small bug when closing multiple gotos
...
to the same label
2011-02-10 12:50:41 -02:00
Roberto Ierusalimschy
3f5b56c48b
simpler code for repeat-until
2011-02-09 15:03:18 -02:00
Roberto Ierusalimschy
e7192dfdbb
corrected 'follow' for checking whether label is last statement
...
in a block
2011-02-09 14:51:28 -02:00
Roberto Ierusalimschy
0539f48661
small changes in goto-related error messages
2011-02-09 12:45:19 -02:00
Roberto Ierusalimschy
e7a9c45a48
trying to avoid assumption that sizeof(char)==1
2011-02-07 17:15:24 -02:00
Roberto Ierusalimschy
fd6c1f4898
ensures that all local variables are declared inside some block,
...
opening a new block at 'open_func'
2011-02-07 17:00:30 -02:00
Roberto Ierusalimschy
f079749287
some reorganization of dynamic data structures used by the parser
2011-02-07 15:14:50 -02:00
Roberto Ierusalimschy
f8d677f94c
no more 'OP_CLOSE' instructions (use jumps to close upvalues)
2011-02-07 10:28:27 -02:00
Roberto Ierusalimschy
094a7d0290
detail in 'print_usage'
2011-02-07 10:27:13 -02:00
Roberto Ierusalimschy
7cc0e63d8a
first implementation of 'goto'
2011-02-04 15:34:43 -02:00
Roberto Ierusalimschy
a4a8914c20
new reserved word 'goto'
2011-02-02 12:55:17 -02:00
Roberto Ierusalimschy
06c7efb4a9
avoid extra increment to 'savedpc' when jumping
2011-02-01 16:32:55 -02:00
Roberto Ierusalimschy
dd547c55c8
new scheme to close upvalues in 'break'; jump instructions may
...
do the close, avoiding the need for a OP_CLOSE instruction
2011-02-01 16:03:10 -02:00
Roberto Ierusalimschy
f6bd8b1147
better control for GC running or stopped
2011-02-01 14:52:38 -02:00
Roberto Ierusalimschy
a7faa557fa
bug: problem with optimizations of short-circuit logic
2011-01-31 12:52:32 -02:00
Roberto Ierusalimschy
026a7e92be
bug in some short-circuit optimizations
2011-01-31 12:28:41 -02:00
Roberto Ierusalimschy
c4ea0c3b29
detail (cleaning trailing spaces)
2011-01-26 14:30:02 -02:00
Roberto Ierusalimschy
7106c491dd
'sep' argument to 'string.rep' + 'string.rep' preallocates entire
...
buffer before creating resulting string
2011-01-12 18:36:01 -02:00
Roberto Ierusalimschy
a10d495b18
'luaL_findtable' returns boolean about whether it created a new
...
table (to easy initializing table)
2011-01-10 13:51:42 -02:00
Roberto Ierusalimschy
c2e3cc4c89
using 'luaL_findtable' to manage hook table
2011-01-10 13:51:19 -02:00
Roberto Ierusalimschy
67feed49f1
optional argument 'sep' to 'searchpath'
2011-01-07 16:54:49 -02:00
Roberto Ierusalimschy
b63b0928cf
prototype for 'luaO_ceillog2' was different from definition
2011-01-07 13:46:27 -02:00
Roberto Ierusalimschy
511679313f
new function 'rawlen'
2011-01-07 10:41:48 -02:00
Roberto Ierusalimschy
868ff40339
full collection does not restart collector + avoid changing GC
...
state if an error happens in a step
2010-12-29 16:00:23 -02:00
Roberto Ierusalimschy
aa6faa6331
own implementation of 'tunumber', so that it works correctly with
...
numbers outside the 'int' range
2010-12-27 16:00:38 -02:00
Roberto Ierusalimschy
0b3f4e254e
more efficient hash for numbers in IEEE754 machines
2010-12-23 13:38:28 -02:00
Roberto Ierusalimschy
551b076f1c
change in the relationship between totalbytes and GCdebt - luaM_realloc_
...
is too critical to update two counters
2010-12-20 17:40:07 -02:00
Roberto Ierusalimschy
737f119187
better control for GC running or stopped
2010-12-20 16:17:46 -02:00
Roberto Ierusalimschy
8980c630bf
error when indexing strings with invalid keys
2010-12-20 15:25:36 -02:00
Roberto Ierusalimschy
8d579c5bc5
'debug.setmetatable' returns object (like 'setmetatable')
2010-12-20 15:24:15 -02:00
Roberto Ierusalimschy
d51743b0c7
removed 'newproxy'
2010-12-17 13:14:58 -02:00
Roberto Ierusalimschy
1a92c2b354
allows number of bits used by the library to be changed from outside
2010-12-17 11:26:38 -02:00
Roberto Ierusalimschy
fe0d54d37e
table library respects '#' metamethods
2010-12-17 10:15:34 -02:00
Roberto Ierusalimschy
c9af0768fc
GC does not mark dead registers inside activation record
2010-12-17 10:05:37 -02:00
Roberto Ierusalimschy
7e0caa7d61
new closures are always created on "next" register (so that GC knows
...
stack limit)
2010-12-17 10:03:41 -02:00
Roberto Ierusalimschy
a40768e5ea
new macro 'luaC_condGC' to allow extra code to be run in case
...
of GC steps
2010-12-17 10:02:29 -02:00
Roberto Ierusalimschy
4a83fe569c
comment
2010-12-15 17:13:29 -02:00
Roberto Ierusalimschy
b83b6ba015
'loadin' -> 'load'
2010-12-13 14:38:00 -02:00
Roberto Ierusalimschy
af119c8b55
official support for floating hexa numerals
2010-12-10 17:03:46 -02:00
Roberto Ierusalimschy
1aead7f553
'hexafloat' moved to 'lobject.c' (hexa conversion needs it too)
2010-12-10 12:53:15 -02:00
Roberto Ierusalimschy
75d8470f0f
new macro 'cast_uchar'
2010-12-10 11:40:22 -02:00
Roberto Ierusalimschy
81646af13b
'loadstring' deprecated; use 'load' instead
2010-12-08 10:58:04 -02:00
Roberto Ierusalimschy
233b71c092
comment
2010-12-07 09:40:42 -02:00
Roberto Ierusalimschy
ccc4fc9cf0
detection of erroneous numeric strings with \0 (such as "1\0")
2010-12-06 19:08:36 -02:00
Roberto Ierusalimschy
c79b4a97aa
using 'strspn' to skip spaces in 'tonumber'
2010-12-06 14:25:48 -02:00
Roberto Ierusalimschy
ac3afc7cd4
'printf' replaced by 'luai_writestring'
2010-12-03 15:20:50 -02:00
Roberto Ierusalimschy
350cc4bcb6
'micro' bug: when closing state, old objects are finalized (breaking
...
assertion)
2010-12-03 09:48:25 -02:00
Roberto Ierusalimschy
35931bbed4
comments
2010-12-02 17:51:15 -02:00
Roberto Ierusalimschy
12779b2b71
getlocal/setlocal can access vararg parameters
2010-11-30 15:17:51 -02:00
Roberto Ierusalimschy
7ca1bd639f
new functions 'extract' and 'replace'
2010-11-29 13:19:28 -02:00
Roberto Ierusalimschy
9b7a12c46d
finalizers (__gc) for tables
2010-11-26 12:32:31 -02:00
Roberto Ierusalimschy
5b33e39855
removed deprecated functions getn-foreach-foreachi
2010-11-23 15:21:14 -02:00
Roberto Ierusalimschy
a64cf8fac9
'test' -> 'btest'
2010-11-22 16:06:33 -02:00
Roberto Ierusalimschy
092fa71ddd
conventional names for bitwise operators
2010-11-22 14:39:20 -02:00
Roberto Ierusalimschy
a2eaad5d81
'gfind' was deprecated in 5.1
2010-11-19 14:25:51 -02:00
Roberto Ierusalimschy
54771c5afa
keep 'seminfo->ts' even for reserved words, just in case
...
(some lhf's tools need this)
2010-11-18 16:38:44 -02:00
Roberto Ierusalimschy
bcce769d29
avoid "unreacheable code" warnings
2010-11-18 16:38:27 -02:00
Roberto Ierusalimschy
24baa919c1
small bug: 'find' did not detect magic chars after a \0 in a pattern
...
and did a plain search in those cases
2010-11-16 18:39:41 -02:00
Roberto Ierusalimschy
d1c0efdb7d
comment about compatibility-only functions
2010-11-16 17:20:01 -02:00
Roberto Ierusalimschy
566758de79
'getuservalue' accepts any type of argument
2010-11-16 16:01:28 -02:00
Roberto Ierusalimschy
50334faad6
no more compatibility with (veryyyy) old ref system
2010-11-16 15:43:29 -02:00
Roberto Ierusalimschy
cee7a8e1ec
-DLUA_COMPAT_ALL is the default
2010-11-16 09:39:42 -02:00
Roberto Ierusalimschy
8c21f463ed
'debug' library is loaded by default
2010-11-12 13:48:30 -02:00
Roberto Ierusalimschy
a1952d9c41
'l_tvar' renamed to 'l_tg'
2010-11-12 13:47:34 -02:00
Roberto Ierusalimschy
1a46a713d2
new macro 'l_tvar' to easy the use of mathlib with other floating
...
types (float and long double)
2010-11-11 13:39:12 -02:00
Roberto Ierusalimschy
23b9ceb0a4
allows larger array parts in tables (no need to restrict it to 2^26)
2010-11-11 13:38:43 -02:00
Roberto Ierusalimschy
0a6a6b9d9d
no more sentinel to detect loops in module dependencies;
...
usual message for infinite recursion is good enough.
2010-11-10 18:00:04 -02:00
Roberto Ierusalimschy
1b54197491
better error message when light userdata is used instead of a
...
full userdata
2010-11-10 16:06:10 -02:00
Roberto Ierusalimschy
c97aa9485c
new function 'luaL_setmetatable'
2010-11-10 16:05:36 -02:00
Roberto Ierusalimschy
e885b91326
'luaL_typeerror' deprecated
2010-11-10 15:38:10 -02:00
Roberto Ierusalimschy
fa1f724378
when reading blocks with given size, try to read whole block
...
at once
2010-11-09 14:57:49 -02:00
Roberto Ierusalimschy
2a966116b1
detail (message)
2010-11-09 09:04:15 -02:00
Roberto Ierusalimschy
43ec354722
added support for conditional use of %Lg when using long double
2010-11-08 15:38:37 -02:00
Roberto Ierusalimschy
700b003fb5
when reading large files, double buffer size at each iteration
2010-11-08 15:27:22 -02:00
Roberto Ierusalimschy
f722ba6890
code should not use "defined" types, but "typedef"s types when they
...
are available (i.e., after including lua.h) + small changes to make
conversions more portable across diferent types for lua_Number
(long double) and lua_Unsigned (long long unsigned)
2010-11-08 14:33:20 -02:00
Roberto Ierusalimschy
c7d4da8746
correction to allow lua_Unsigned larger than usigned int
2010-11-08 14:31:22 -02:00
Roberto Ierusalimschy
f1629217f1
code for conversion macros moved from luaconf to llimits + 'uint'
...
renamed to 'unsigned' in those macros
2010-11-03 13:16:17 -02:00
Roberto Ierusalimschy
fdd5f2f7a3
comment typos
2010-10-29 15:52:46 -02:00
Roberto Ierusalimschy
c6ef3e2672
bug: by-one error when creating short source names (luaO_chunkid)
2010-10-29 13:54:55 -02:00
Roberto Ierusalimschy
ba8dca00ac
detail (ununsed parameter)
2010-10-29 12:35:09 -02:00
Roberto Ierusalimschy
9be89a1864
'luaL_checkversion' also checks convertions (number to integer types)
2010-10-29 10:52:21 -02:00
Roberto Ierusalimschy
b9f371a3c2
added another option for ieeeendian
2010-10-29 09:13:21 -02:00
Roberto Ierusalimschy
4834de8427
comment typo
2010-10-29 09:13:14 -02:00
Roberto Ierusalimschy
94043a3a1a
more robust implementation for 'luaO_str2d'
2010-10-28 13:39:03 -02:00
Roberto Ierusalimschy
e642cc4206
correct handling of negative numbers in non-10 bases by 'tonumber'
...
(e.g., tonumber(-34, 8))
2010-10-28 13:36:30 -02:00
Roberto Ierusalimschy
da57477c3d
added more platforms for ieeeendianess + small comments
2010-10-28 13:18:25 -02:00
Roberto Ierusalimschy
f39034889d
stricter control over number of bits in each operation
2010-10-28 13:17:29 -02:00
Roberto Ierusalimschy
6b053a63cb
added check for architectures with known endianess (only i386 now)
2010-10-27 15:16:37 -02:00
Roberto Ierusalimschy
572e5e6b28
new names for bit functions (mimicking assembler)
2010-10-27 14:50:32 -02:00
Roberto Ierusalimschy
6098e06e09
better organization for coercion functions between lua_Number and
...
integer types + IEEE trick to be used in most platforms, by default
2010-10-26 17:32:19 -02:00
Roberto Ierusalimschy
c6b64ffe65
new type lua_Unsigned and corresponding projection/injection functions
2010-10-25 18:31:11 -02:00
Roberto Ierusalimschy
4590a89b32
corrected warnings from different compilers (mostly casts and small
...
details)
2010-10-25 17:01:37 -02:00
Roberto Ierusalimschy
1475cb59bf
version from lhf
2010-10-25 12:33:38 -02:00
Roberto Ierusalimschy
9e8e60dd5f
bitlib renamed to 'bit32' + new function for arithmetic shift
2010-10-25 12:32:36 -02:00
Roberto Ierusalimschy
d72ec210c7
POS_A replaced by POS_Ax (which is more "precise")
2010-10-25 10:24:55 -02:00
Roberto Ierusalimschy
c77baf752c
comment
2010-10-25 10:24:36 -02:00
Roberto Ierusalimschy
a122688091
better error message for 'lua -e -i'
2010-10-18 14:06:33 -02:00
Roberto Ierusalimschy
f3026c36c2
details in opcode list
2010-10-13 13:45:54 -03:00
Roberto Ierusalimschy
cd0ebd0a80
'proto->source' may be NULL (if dump strips debug information)
2010-10-11 17:24:42 -03:00
Roberto Ierusalimschy
8bc33a088c
'os.exit' acceps booleans as status (for EXIT_SUCESS and EXIT_FAILURE)
2010-10-05 09:18:03 -03:00
Roberto Ierusalimschy
c3eb89544f
'luaL_loadlib' accepts Utf8 BOM in the beginning of files
2010-10-01 15:53:00 -03:00
Roberto Ierusalimschy
ffff9a49da
'nresults' in CallInfo now refers to number of results that the current
...
function returns (and not what it expects from a call)
2010-09-30 14:21:31 -03:00
Roberto Ierusalimschy
b22356e5c5
hexadecimal constants may be floating values too
2010-09-13 18:49:58 -03:00
Roberto Ierusalimschy
a289a62717
'loadin' should not check whether upvalue is called '_ENV',
...
because its name may be unknown when there is no debug information.
2010-09-07 16:38:36 -03:00
Roberto Ierusalimschy
e3eabcf913
'lua_[gs]etupvalue' may work even without debug information
...
(that is, without upvalue names)
2010-09-07 16:35:04 -03:00
Roberto Ierusalimschy
0df2238063
name "_ENV" configurable through 'luaconf.h'
2010-09-07 16:21:39 -03:00
Roberto Ierusalimschy
6828f6d427
new parameter 'majorinc' to control frequency of major collections
...
in generational mode
2010-09-03 11:14:01 -03:00
Roberto Ierusalimschy
daa5fe3e31
'loadin' should accept any value for the environment (not only tables) +
...
it should check whether chunk has upvalue named '_ENV'
2010-08-23 15:03:11 -03:00
Roberto Ierusalimschy
8d9ea59d28
'pushclosure' -> 'codeclosure' (as there is another 'pushclosure' in
...
'lvm.c) + small detail
2010-08-23 14:32:34 -03:00
Roberto Ierusalimschy
5e7dbd0b8b
api checks to ensure that thread is OK when using lua_call/lua_pcall
2010-08-04 15:40:28 -03:00
Roberto Ierusalimschy
cd6c276e41
use index 0 for header of list of free references
2010-08-03 17:21:16 -03:00
Roberto Ierusalimschy
fd4b4a2a68
detail: registry._PRELOAD must be a table, no need to check
2010-08-02 14:14:48 -03:00
Roberto Ierusalimschy
d447945685
'module'/'luaL_register' and associates are deprecated
2010-07-28 12:51:59 -03:00
Roberto Ierusalimschy
78f9635111
several new comments
2010-07-26 12:53:23 -03:00
Roberto Ierusalimschy
8b7cf8c62d
'lua_[gs]etenv' -> 'lua_[gs]etuservalue'
2010-07-25 12:18:19 -03:00
Roberto Ierusalimschy
73b0a3451d
environment variables consulted by Lua may be version-specific
2010-07-25 12:03:37 -03:00
Roberto Ierusalimschy
85c1461422
new macros LUA_VERSION_{MAJOR/MINOR/RELEASE}
2010-07-25 12:02:41 -03:00
Roberto Ierusalimschy
5ba556d27a
using curly brackets to mark blocks of '#if/#else/#endif's
2010-07-18 11:34:45 -03:00
Roberto Ierusalimschy
81dd13f4c6
new way to distinguish between indexing tables in registers and
...
tables in upvalues (+ fixed small bug when checking conflicts in
multiple assignments)
2010-07-07 13:27:29 -03:00
Roberto Ierusalimschy
6a02bbe1e2
better organization for fields in struct 'expdesc'
2010-07-02 17:42:40 -03:00
Roberto Ierusalimschy
7631c29b2f
comand-line option '-l' creates global with given name after
...
requiring module
2010-07-02 14:36:32 -03:00
Roberto Ierusalimschy
a9dc7c8828
functions lua_tonumber/lua_tointeger replaced by lua_tonumberx/lua_tointegerx
...
that have an extra out parameter with conversion status
2010-07-02 14:35:06 -03:00
Roberto Ierusalimschy
7192afafee
new module policy: C modules do not create globals and do not register
...
themselves with 'require' (let 'require' do its work); new auxiliary
functions luaL_newlib/luaL_newlibtable/luaL_setfuncs/luaL_requiref.
Old luaL_register will be deprecated.
2010-07-02 08:38:13 -03:00
Roberto Ierusalimschy
a139e2e003
old (and complex) luaL_findtable now used only in compatibility code
...
inside lauxlib.c
2010-06-30 14:40:27 -03:00
Roberto Ierusalimschy
a71c5f6f53
typo in comments
2010-06-30 11:11:17 -03:00
Roberto Ierusalimschy
d9ea6eca7c
macro 'key2tal' replaced by 'gkey' (as both were equal)
2010-06-25 09:18:10 -03:00
Roberto Ierusalimschy
ca3865cf1b
'getlocal' gets information about parameters of Lua functions
2010-06-21 13:30:12 -03:00
Roberto Ierusalimschy
bef5980744
no more support for old Mac OS systems
2010-06-18 14:23:02 -03:00
Roberto Ierusalimschy
409741e900
'what' may be NULL in 'kname'
2010-06-16 10:44:36 -03:00
Roberto Ierusalimschy
b98de30b8f
'ipair' is back
2010-06-13 16:41:34 -03:00
Roberto Ierusalimschy
9f48712c15
use ANSI versions of DLL functions in Windows
2010-06-13 16:36:17 -03:00
Roberto Ierusalimschy
bd262d591f
'coroutine' library separated from 'baselib'
2010-06-10 18:30:26 -03:00
Roberto Ierusalimschy
0d116c3ada
unused '#include' removed
2010-06-10 18:27:09 -03:00
Roberto Ierusalimschy
79f11fb2bb
back with #-comments for binary files
2010-06-09 14:53:59 -03:00
Roberto Ierusalimschy
fabe4ec487
better barrier for prototypes
2010-06-07 13:55:34 -03:00
Roberto Ierusalimschy
575074fd85
Lua closures are cached for reuse
2010-06-04 10:25:10 -03:00
Roberto Ierusalimschy
545f43065f
'luaF_newLclosure' gets prototype of new closure as argument
2010-06-04 10:06:15 -03:00
Roberto Ierusalimschy
3819c30e55
better names for barrier macros
2010-06-04 10:05:29 -03:00
Roberto Ierusalimschy
e94fac8956
bug: generational collection was not running collector! (must write
...
a test for this...)
2010-06-02 15:36:58 -03:00
Roberto Ierusalimschy
2c1a5d678d
factoring out common code in 'module' and 'luaL_openlib'
2010-05-31 13:34:19 -03:00
Roberto Ierusalimschy
bd619b9311
new macro MAXUPVAL (maximum number of upvalues per closure)
2010-05-31 13:08:55 -03:00
Roberto Ierusalimschy
aca84ee1a0
correct definition for 'lua_cpcall' (tested)
2010-05-28 11:27:07 -03:00
Roberto Ierusalimschy
5038e3c58c
corrected compatibility macro 'lua_cpcall' (untested)
2010-05-27 09:06:42 -03:00
Roberto Ierusalimschy
5a7dee0c5d
added class '%g' in patterns (for graphical characters)
2010-05-24 16:34:57 -03:00
Roberto Ierusalimschy
ddf1f2a053
GC should not run when stopped, even in hard tests
2010-05-24 16:29:46 -03:00
Roberto Ierusalimschy
e34d3c06b0
it is better to call open functions with lua_call to not mess
...
the caller stack
2010-05-20 09:57:59 -03:00
Roberto Ierusalimschy
e8a2c36909
more comments
2010-05-18 14:32:19 -03:00
Roberto Ierusalimschy
3c39a0e8cb
bug: loadfile of binary files read first character twice
2010-05-18 14:21:24 -03:00
Roberto Ierusalimschy
3d45a8eb1c
really stop collection during finalizers
2010-05-17 17:39:31 -03:00
Roberto Ierusalimschy
3d80aeab5a
lua_pushstring may reallocate the stack, making 'o' a dangling
...
pointer
2010-05-17 17:10:17 -03:00
Roberto Ierusalimschy
3811e23b32
detail (comment)
2010-05-17 15:30:27 -03:00
Roberto Ierusalimschy
12c764ed1e
semicolons now represent the empty statement
2010-05-15 10:32:02 -03:00
Roberto Ierusalimschy
e99e9a9473
patches for last two bugs (string.format and io.read)
2010-05-14 12:34:57 -03:00
Roberto Ierusalimschy
f35ac38e1d
updated depenency lists + eliminated duplication of definitions
...
for MYCFLAGS, MYLDFLAGS, and MYLIBS.
2010-05-14 12:08:10 -03:00
Roberto Ierusalimschy
058279d548
comments
2010-05-14 12:03:43 -03:00
Roberto Ierusalimschy
69ba1ac441
new "instruction" 'absindex'
2010-05-14 10:15:54 -03:00
Roberto Ierusalimschy
4a925c1552
in 'absindex', do not need to call gettop (can inline it)
2010-05-14 10:15:26 -03:00
Roberto Ierusalimschy
cf531912f2
one more macro (mvdispatch) to easy experiments with alternative
...
dispatch methods
2010-05-13 16:53:05 -03:00
Roberto Ierusalimschy
0d00729e31
detail (breaking a long line)
2010-05-13 09:03:26 -03:00
Roberto Ierusalimschy
b6e9fcbd70
use of macro ('vmcase') to format all cases in main switch of
...
'luaV_execute' (to facilitate experiences with direct threading)
2010-05-12 17:40:35 -03:00
Roberto Ierusalimschy
8554baeacf
small changes in 'luaV_execute' to make cases more regularly formatted
2010-05-12 17:31:33 -03:00
Roberto Ierusalimschy
f5b7f077ec
added comments to '#else' and '#endif' in long conditionals
2010-05-12 11:17:36 -03:00
Roberto Ierusalimschy
e924a7f9ea
new API function 'lua_absindex'
2010-05-12 11:09:20 -03:00
Roberto Ierusalimschy
4fd76b8148
avoid "strong" cast
2010-05-11 17:49:26 -03:00
Roberto Ierusalimschy
de0f51a02c
wrong type being assigned (not detected because of obj2gco macro)
2010-05-11 17:48:36 -03:00
Roberto Ierusalimschy
0567221848
udata in 'tobefnz' list be have old bit on (it will be cleared
...
when udata is moved to 'allgc' list)
2010-05-10 15:24:36 -03:00
Roberto Ierusalimschy
1c1a98e872
corrected some places where an old object could end up in front
...
of a new one + minimal documentation about this problem
2010-05-10 15:23:45 -03:00
Roberto Ierusalimschy
c006f085d9
new macro 'resetoldbit'
2010-05-10 13:46:49 -03:00
Roberto Ierusalimschy
a48e330f37
macros 'lua_number2int' and 'lua_number2uint' for Visual Studio
...
corrected and tested
2010-05-10 13:38:58 -03:00
Roberto Ierusalimschy
dcc070683c
avoid reserving LUA_RIDX_LAST slots in any table used by reference
...
system. Store free list in a field indexed by a unique name,
instead of using a numerical index.
2010-05-10 12:25:02 -03:00
Roberto Ierusalimschy
2d81cfa4e1
corrected definition of 'lua_register' (there is no LUA_ENVIRONINDEX
...
anymore)
2010-05-10 10:50:20 -03:00
Roberto Ierusalimschy
0bccf03d7e
slightly better definition for 'changenvalue'
2010-05-07 15:44:46 -03:00
Roberto Ierusalimschy
ad2b5decc8
'lua_assert' can be empty when assertions are off
2010-05-07 15:44:12 -03:00
Roberto Ierusalimschy
32c1764b5d
slightly better definition for 'isgray'
2010-05-07 15:43:51 -03:00
Roberto Ierusalimschy
de97177744
avoid 'else assert' (which may result in an empty else)
2010-05-07 15:43:24 -03:00
Roberto Ierusalimschy
fa2ddb070a
details (to avoid too long strings in assertions)
2010-05-07 15:23:17 -03:00
Roberto Ierusalimschy
0fac33da9e
bug: incremental sweep was not cleaning old bits (as it stopped in the
...
first old object) + bug: moving udata to 'udgc' list might put old
object in front a new one + some new macros + generational mode may
be in 'pause' state (it just skips 'markroot')
2010-05-07 15:19:36 -03:00
Roberto Ierusalimschy
8e1bdda66a
stupid bug when calling 'luaC_changemode' (in function lua_gc)
2010-05-07 15:10:01 -03:00
Roberto Ierusalimschy
9c1347e647
more tests in 'lua_checkmemory' + more information in function
...
'gccolor'
2010-05-07 15:09:23 -03:00
Roberto Ierusalimschy
b373a40133
new macro 'isgenerational' + new macro 'isold' + better deffinition
...
for 'isdead', compatible with the code used by 'sweeplist'
2010-05-07 15:08:05 -03:00
Roberto Ierusalimschy
25951e0ea5
some cleaning in 'sweeplist' (threads do not need to be traversed
...
if they are going to be collected + use of bit masks to unify
differences in generational and incremental modes)
2010-05-06 15:18:07 -03:00
Roberto Ierusalimschy
a4f20e3c8b
comments
2010-05-06 15:17:22 -03:00
Roberto Ierusalimschy
8c583c61a3
more tests in 'lua_checkmemory'
2010-05-06 15:16:57 -03:00
Roberto Ierusalimschy
d2ea5b00b7
new function 'luaC_changemode' +
...
bug: objects entering the 'allgc' list must have their OLDBIT cleared
(upvalues being cleared) + bug: in 'checkSizes', KGC_EMERGENCY is
stored in 'gckind' field, not in 'gcstate' + current white changes when
entering sweep phase (so there are dead objects only in that phase)
2010-05-05 15:58:36 -03:00
Roberto Ierusalimschy
d77898597e
new function 'luaC_changemode'
2010-05-05 15:53:41 -03:00
Roberto Ierusalimschy
237f755dca
typos in comments
2010-05-05 15:49:56 -03:00
Roberto Ierusalimschy
7444b5a1d5
better documentation of GC costs
2010-05-05 10:39:58 -03:00
Roberto Ierusalimschy
e7ce7e1850
changes in patch to monitor garbage collection
2010-05-04 15:10:02 -03:00
Roberto Ierusalimschy
3e662cec89
full GC must run finalizers only after finishing everything else
...
(including a return to generational mode if needed)
2010-05-04 15:09:06 -03:00
Roberto Ierusalimschy
fde866e303
details (comments)
2010-05-04 14:25:19 -03:00
Roberto Ierusalimschy
2d7a81a204
missing parentheses in declaration
2010-05-04 14:21:08 -03:00
Roberto Ierusalimschy
658ea8752b
no need to handle '\0' differently from other control chars in
...
format '%q'
2010-05-04 14:20:33 -03:00
Roberto Ierusalimschy
aa73403ba4
no need of a KGC_FORCED collection kind; it has the same behavior of
...
a normal collection
2010-05-03 14:39:48 -03:00
Roberto Ierusalimschy
0c27de2e7b
no more 'finalize' phase in GC; finalizers are called along the
...
entire cycle
2010-05-03 14:33:39 -03:00
Roberto Ierusalimschy
d25f7f9d78
items in 'tobefnz' are kept black (as before recent change) and changed
...
to white only when needed (being moved to 'allgc' when not keeping
invariant).
2010-05-03 08:55:40 -03:00
Roberto Ierusalimschy
85555646e3
invariant must be kept in atomic 'phase' too
2010-05-03 08:24:30 -03:00
Roberto Ierusalimschy
4d871ee973
"gray lists" only need to be valid when 'keepinvariant' is true
2010-04-30 15:37:14 -03:00
Roberto Ierusalimschy
b9e1dec2cb
added comment explaining a bit about the invariants of the collector
2010-04-30 15:36:45 -03:00
Roberto Ierusalimschy
dc2b8a0073
detail
2010-04-30 15:36:22 -03:00
Roberto Ierusalimschy
9a9fe42deb
wrong comment
2010-04-30 15:17:24 -03:00
Roberto Ierusalimschy
0062db1e06
default PAUSE should be 200 (differences may be corrected in
...
internal multiplers)
+ check for unbilt stack equal the one used by lgc.c
2010-04-30 11:22:23 -03:00
Roberto Ierusalimschy
23001d8607
nasty GC bug: upvalue must be turned white when not keeping invariant,
...
but barrier was not being called when uv->v were already white.
2010-04-29 18:43:36 -03:00
Roberto Ierusalimschy
5d79c6684b
removed commented-out debugging code
2010-04-29 18:42:33 -03:00
Roberto Ierusalimschy
3410dcd375
new way to control GC speed
2010-04-29 14:35:10 -03:00
Roberto Ierusalimschy
5a7a0c72d8
'luaC_linkupval' embedded into call site
2010-04-29 14:34:35 -03:00
Roberto Ierusalimschy
ee7478e884
improved 'lua_checkmemory', with better control over gray objects
2010-04-29 14:33:51 -03:00
Roberto Ierusalimschy
aaa5d7adab
'luaC_linkupval' moved into 'lfunc.c' code + new way to control GC speed
2010-04-29 14:32:40 -03:00
Roberto Ierusalimschy
3eb1788bb4
new way to control GC speed (keeping a 'debt' counter)
2010-04-29 14:31:31 -03:00
Roberto Ierusalimschy
00114a95b2
lots of new comments + small changes in loop controls + other small
...
"janitor work"
2010-04-26 14:58:00 -03:00
Roberto Ierusalimschy
4aaf0ef75c
"to-be-finalized" objects marked and sweeped like all other objects
2010-04-20 17:15:30 -03:00
Roberto Ierusalimschy
ed720d09f3
upvalue barriers for Lua functions must act on the upvalue itself,
...
not on its closure
2010-04-20 17:14:50 -03:00
Roberto Ierusalimschy
376e939ef6
missing parentheses around 'luaL_pushresultsize' declaration
2010-04-19 15:52:15 -03:00
Roberto Ierusalimschy
9d28e2b3e5
bug with io.read(op, "*n")
2010-04-19 15:04:58 -03:00
Roberto Ierusalimschy
49ca1f7083
allows thread switches (when/if there are thread switches) in the same
...
places that finalizers can run (so they should be safe...)
2010-04-19 14:58:46 -03:00
Roberto Ierusalimschy
4db6f20770
ensure that 'luai_userstatethread' is always called (even if
...
'stack_init' throws a memory error)
2010-04-19 14:40:13 -03:00
Roberto Ierusalimschy
cca71912e6
'gcinfo' was deprecated in version 5.0.
2010-04-19 14:02:02 -03:00
Roberto Ierusalimschy
8003e9544d
'string.format' may get buffer as an argument when there are
...
missing arguments and format string is too long
2010-04-19 13:39:25 -03:00
Roberto Ierusalimschy
973d81efb3
complete control over number of each kind of object allocated
2010-04-19 13:38:25 -03:00
Roberto Ierusalimschy
26d4a73962
with light C functions, 'pairs' does not need to keep 'next' as an
...
upvalue.
2010-04-19 13:36:06 -03:00
Roberto Ierusalimschy
99a39f6f4a
tells the allocation function that the first block is a thread
2010-04-19 13:34:46 -03:00
Roberto Ierusalimschy
1bb407e494
in lua_gc/step, 'luaC_step' changes GCthreshold, so there was little
...
control over the real step size.
2010-04-19 13:33:19 -03:00
Roberto Ierusalimschy
53f9499f7f
"light C function" is a better name than "C-function pointer"
2010-04-18 10:22:48 -03:00
Roberto Ierusalimschy
575befc394
comparsion tag methods follow the same rule as other binary TMs
2010-04-18 10:15:11 -03:00
Roberto Ierusalimschy
e7ffb1b501
macro LUA_USE_LONGJMP allows choosing longjmp when compiling Lua as
...
C++ code
2010-04-18 09:41:35 -03:00
Roberto Ierusalimschy
c066ac10a9
better line numbers for function calls and unary/binary operators +
...
null statement + no more "ambiguous syntax" restriction
2010-04-17 09:46:32 -03:00
Roberto Ierusalimschy
1e6940f291
'gcstate' now also runs collector until given state + small changes
...
in 'testC' to test 'lua_topointer' and 'lua_tocfunction'
2010-04-16 14:42:49 -03:00
Roberto Ierusalimschy
d8d81ba891
new escape sequence '\*' + several comments + moving options from
...
switch default into cases (as now locale is fixed)
2010-04-16 09:31:07 -03:00
Roberto Ierusalimschy
cf22133b69
no need to avoid calling ctype functions as now they are implemented
...
by us (no inefficiencies due to accessing locale information)
2010-04-15 16:44:43 -03:00
Roberto Ierusalimschy
b7be05ad27
invalid instructions "cannot" happen
2010-04-15 16:43:43 -03:00
Roberto Ierusalimschy
afdb19ac82
no more 'ccall' nor 'cpcall' functions. (With light C functions they
...
are obsolete.)
2010-04-14 12:14:21 -03:00
Roberto Ierusalimschy
7dfa4cd655
first implementation of light C functions
2010-04-14 12:13:48 -03:00
Roberto Ierusalimschy
fc6203ee43
BUG: 'string.format' may get buffer when there are missing arguments
2010-04-12 13:13:02 -03:00
Roberto Ierusalimschy
b2dd246b7a
better control in 'totalmem' over choosing counters
2010-04-12 13:07:39 -03:00
Roberto Ierusalimschy
d20ff60615
new macro LUA_NUMTAGS
2010-04-12 13:07:29 -03:00
Roberto Ierusalimschy
d41b467320
check memory allows strings to live in the main GC list (it should
...
work ok).
2010-04-12 09:42:07 -03:00
Roberto Ierusalimschy
4541243355
patterns now accept '\0' as a regular character
2010-04-12 09:00:50 -03:00
Roberto Ierusalimschy
9100f7479a
new implementation for Generic Buffer manipulation (using userdata as
...
temporary buffer space)
2010-04-09 13:14:46 -03:00
Roberto Ierusalimschy
055104f5b6
keep memory-error message in the global state, so that its use
...
does not depend on Lua internalizing strings to avoid a string
creation on memory errors
2010-04-08 14:16:46 -03:00
Roberto Ierusalimschy
28aa733c15
macro 'eqstr' was being used to compare non-string entities
2010-04-08 14:06:33 -03:00
Roberto Ierusalimschy
6abde1b05a
no need to keep "_ENV" name in global state (can be kept in lex state)
2010-04-05 13:35:37 -03:00
Roberto Ierusalimschy
d394d5536a
new macro 'eqstr'
2010-04-05 13:26:37 -03:00
Roberto Ierusalimschy
a2f98314a3
'lua_pushstring' now uses 'luaS_new'
2010-04-05 11:21:38 -03:00
Roberto Ierusalimschy
a09c8d7beb
cannot sweep main thread in sweepstring phase
2010-04-05 11:15:35 -03:00
Roberto Ierusalimschy
f80ff7a336
'luaS_new' changed from macro to function
2010-04-03 17:24:18 -03:00
Roberto Ierusalimschy
a08fc34ee4
avoid using 'luaS_new' when can use 'luaS_newlstr'
2010-04-02 12:39:07 -03:00
Roberto Ierusalimschy
d00d2eaf51
small changes in 'luaO_pushvfstring'
2010-04-02 12:30:27 -03:00
Roberto Ierusalimschy
11126422d9
option to return GC to normal (incremental, non generational) mode
2010-04-02 12:19:19 -03:00
Roberto Ierusalimschy
e54668b696
added proper code to trace garbage collection
2010-04-02 11:37:41 -03:00
Roberto Ierusalimschy
9eb832de54
work related to hooks moved from 'luaV_execute' to 'traceexec'
2010-03-29 17:45:49 -03:00
Roberto Ierusalimschy
82a1f5d354
comments
2010-03-29 14:44:31 -03:00
Roberto Ierusalimschy
a8d3aa14fd
global table now is only kept in the registry
2010-03-29 14:43:14 -03:00
Roberto Ierusalimschy
064e406f67
no more fenvs!
2010-03-26 17:58:11 -03:00
Roberto Ierusalimschy
5c87f61e6b
major collections in generational mode
2010-03-25 16:37:23 -03:00
Roberto Ierusalimschy
3aa9598177
'mainthread' is not inserted in the 'allgc' list anymore, but swept
...
separately.
2010-03-25 10:06:36 -03:00
Roberto Ierusalimschy
64d39ed1b6
generational mode no longer sweep old objects
2010-03-24 12:51:10 -03:00
Roberto Ierusalimschy
4433dbb5f5
userdata with finalizers are kept in a separated list ('udgc'), instead
...
of at the end of 'rootgc' (which was renamed to 'allgc', as it is not
"root" in the usual meaning for collectors)
2010-03-24 10:07:01 -03:00
Roberto Ierusalimschy
5cb128ea54
BUG: emergency collector might resize 'strt' (string table) when
...
creating a new string
+ atomic and markroot steps has some cost
+ full collection must leave collector in proper state when mode
is generational
2010-03-23 17:16:06 -03:00
Roberto Ierusalimschy
74123e9686
draft version of a generational mode for garbage collection. (Not well
...
tested; no major collections; ...)
2010-03-22 15:28:03 -03:00
Roberto Ierusalimschy
9c196bebad
detail (wrong comment about LUAI_GCPAUSE)
2010-03-22 14:45:55 -03:00
Roberto Ierusalimschy
28b2566c97
'lua_assert' not visible from libraries
2010-03-22 14:28:31 -03:00
Roberto Ierusalimschy
caf74dd731
'cpcall' renamed to 'ccall' as it does not do a protected call
2010-03-19 18:04:17 -03:00
Roberto Ierusalimschy
62840c5fad
'ipairs' is deprecated
2010-03-19 12:52:48 -03:00
Roberto Ierusalimschy
5ca7cdd709
for compatibility only: 'module' changes the first upvalue of
...
calling function to affect its environment
2010-03-19 12:02:34 -03:00
Roberto Ierusalimschy
1514e49d43
avoid using function environments in C libraries (as it probably will
...
be deprecated)
2010-03-17 18:37:37 -03:00
Roberto Ierusalimschy
22ef84b6c8
'_ENV' name permanently stored in global state for easier access
2010-03-13 12:55:42 -03:00
Roberto Ierusalimschy
63a2b62468
must include 'string.h' because a macro uses 'strlen'
2010-03-13 12:55:01 -03:00
Roberto Ierusalimschy
489253d753
better definitions for lua_[gs]etglobal + less uses of ENVIRONINDEX
2010-03-13 00:57:46 -03:00
Roberto Ierusalimschy
25c557ec63
first version of _ENV; no more global variables
2010-03-12 16:14:06 -03:00
Roberto Ierusalimschy
f292760f12
small optimization in luaL_addlstring (avoid adding chars one by one)
...
(suggested by Chuck Coffing)
2010-03-12 15:59:32 -03:00
Roberto Ierusalimschy
1124cb1247
first step towards _ENV: all chunks have an puvalues _ENV with the
...
global table
2010-03-08 13:55:52 -03:00
Roberto Ierusalimschy
c295147874
when finding a 'name' for a function, handle the case when the function
...
is a for iterator
2010-03-05 11:01:29 -03:00
Roberto Ierusalimschy
e560ac4862
when searching for a variable name, look existing upvalues before
...
goingg to upper levels
2010-03-04 15:12:57 -03:00
Roberto Ierusalimschy
915a9a912c
just in case, better to flush error messages
2010-03-03 15:53:02 -03:00
Roberto Ierusalimschy
ae0a5e2142
new option '*L' for io.read + options for io.lines
2010-03-03 15:48:57 -03:00
Roberto Ierusalimschy
347f0c33d1
avoid 'continue' unless necessary
2010-02-27 18:16:24 -03:00
Roberto Ierusalimschy
622e448710
removed useless test (argv[i] cannot be NULL when i<argc)
2010-02-27 18:15:36 -03:00
Roberto Ierusalimschy
0fe2576a39
new instructions to optimize indexing on upvalues
2010-02-26 17:40:29 -03:00
Roberto Ierusalimschy
d08d237a49
detail: in loadfile read function, no need to return NULL on EOF;
...
size ==0 is enough to signal EOF.
2010-02-18 17:37:57 -02:00
Roberto Ierusalimschy
64a7ec987c
avoid using 'ungetc' in loadfile
2010-02-18 17:32:41 -02:00
Roberto Ierusalimschy
4274738e81
new macro 'luai_writestringerror'
2010-02-18 17:18:41 -02:00
Roberto Ierusalimschy
0d7d559dcc
no need to flush either stderr or \n-terminated outputs
2010-02-11 15:12:27 -02:00
Roberto Ierusalimschy
af512ad6da
use of 'conventional' names for shift and rotate operations +
...
right/left versions for them
2010-02-11 13:55:29 -02:00
Roberto Ierusalimschy
d27108ccd5
removed support for '#fist-line comment' on binary files (as binary
...
files do not have lines...)
2010-02-11 13:52:50 -02:00
Roberto Ierusalimschy
a838b3b496
better usage messages, showing entire offending argument
2010-02-09 09:58:57 -02:00
Roberto Ierusalimschy
4c54cd3a10
when yielding, original 'func' value must be kept and restored so
...
that 'poscall' puts results in the right slot.
2010-02-09 09:56:29 -02:00
Roberto Ierusalimschy
c8ff7de7f0
field 'oldtop' renamed to 'extra', as it can be used for other
...
purposes
2010-02-09 09:55:37 -02:00
Roberto Ierusalimschy
3bae8e047c
typo (thanks to Gavin)
2010-02-05 17:09:09 -02:00
Roberto Ierusalimschy
4f5f2fe367
new function 'luaL_cpcall'
2010-01-21 14:49:21 -02:00
Roberto Ierusalimschy
01586d539e
typo in comment
2010-01-21 14:31:24 -02:00
Roberto Ierusalimschy
c8ab34ab7a
better messages for invalid options
2010-01-21 14:31:06 -02:00
Roberto Ierusalimschy
36ab1ee10c
__unm metamethod gets nil as its 2nd parameter
2010-01-15 14:23:58 -02:00
Roberto Ierusalimschy
193ce46970
table.pack was locking last result, avoiding its collection
2010-01-13 17:59:10 -02:00
Roberto Ierusalimschy
b678f246a4
HINSTANCE -> HMODULE (they are the same thing, but the MS documentation
...
uses the latter) + LoadLibrary -> LoadLibraryEx with optional arguments,
to allow the option LOAD_WITH_ALTERED_SEARCH_PATH
2010-01-13 14:30:27 -02:00
Roberto Ierusalimschy
f270e7f044
warnings that are not compatible with C++ separated from other warning
...
options
2010-01-13 14:19:54 -02:00
Roberto Ierusalimschy
070d3743a7
"no value" added to array luaT_typenames + occurrences of "userdata"
...
in that array unified in a single address
2010-01-13 14:18:25 -02:00
Roberto Ierusalimschy
0c7de97d47
correct error message when yielding from outside a coroutine
2010-01-13 14:17:32 -02:00
Roberto Ierusalimschy
900b7d4514
on 64-bit machines, an address may not fit into a 'long', so it
...
is better to convert from pointer to void to pointer to function
directly, even if ANSI C does not like it.
2010-01-13 14:09:05 -02:00
Roberto Ierusalimschy
91f0b20a0e
missing standard defines
2010-01-12 17:40:02 -02:00
Roberto Ierusalimschy
e4b4623abc
'searchpath' changes dots into directory separators
2010-01-11 15:55:25 -02:00
Roberto Ierusalimschy
cef96b73e1
added casts from int to enumerations to follow C++ rules
2010-01-11 15:38:30 -02:00
Roberto Ierusalimschy
427e01eb63
removed useless initialization
2010-01-11 15:37:59 -02:00
Roberto Ierusalimschy
d320c908d0
conversion from pointer to void to pointer to function seems more
...
"correct" if done through an integral type (because conversions
between pointers and numbers are allowed, only "implementation
defined").
2010-01-11 15:34:59 -02:00
Roberto Ierusalimschy
8bfc696676
missing 'external' in variable declaration
2010-01-11 15:33:09 -02:00
Roberto Ierusalimschy
97a35e70af
pathes corrected to 5.2
2010-01-11 15:15:30 -02:00
Roberto Ierusalimschy
03b556b963
corrected copyright notice to 2010
2010-01-11 15:15:11 -02:00
Roberto Ierusalimschy
572b94bbcb
include of 'windows.h' moved to where it is needed
2010-01-11 15:11:24 -02:00
Roberto Ierusalimschy
692209fa8d
Dynamic C functions should be created with the global table as their
...
initial environments
2010-01-11 15:06:31 -02:00
Roberto Ierusalimschy
953d499ea2
changed macro lua_number2int for Windows (added brackets; some recent
...
compilers complain about the old format) + added missing definition
for 'lua_number2int' in Windows case.
2010-01-11 14:35:20 -02:00
Roberto Ierusalimschy
a541ada194
"-"-trick in C packages now accept name-v13...
2010-01-11 14:10:47 -02:00
Roberto Ierusalimschy
55d3138397
removed old prototype for 'luaI_openlib' (which does not exist anymore)
2010-01-11 14:00:45 -02:00
Roberto Ierusalimschy
e74e56f2b1
better may to force recompilation when makefile changes
2010-01-08 18:05:36 -02:00
Roberto Ierusalimschy
1ebf109c53
'setobj' must assing fields one by one, to allow trick of using
...
pad space in table keys
2010-01-08 18:00:20 -02:00
Roberto Ierusalimschy
f75be1cb28
removed parentheses around some function names in their definitions
2010-01-08 13:16:56 -02:00
Roberto Ierusalimschy
16d2ad88fe
some changes in compatibility macros: added LUA_COMPAT_ALL + compatibility
...
macros from lua.h and lauxlib.h moved to luaconf.h
2010-01-06 13:15:04 -02:00
Roberto Ierusalimschy
f3a6815000
compatibility code removed or moved to luaconf.h
2010-01-06 13:14:15 -02:00
Roberto Ierusalimschy
19f8c87375
compatibility code moved to luaconf.h
2010-01-06 13:08:00 -02:00
Roberto Ierusalimschy
5bcfe0c700
new debug info 'isvararg' and 'nparams'
2010-01-06 12:42:35 -02:00
Roberto Ierusalimschy
8cd395564c
no need to use two different defines (LUA_DL_DLOPEN and LUA_USE_DLOPEN)
2010-01-06 12:35:17 -02:00
Roberto Ierusalimschy
389c890ed3
again changing macro to function to save a few bytes
2010-01-06 09:48:02 -02:00
Roberto Ierusalimschy
e3866afa97
macro 'luaY_checklimit' changed into a function (and renamed 'checklimit').
...
It makes no sense to trade space for time in the parser.
2010-01-05 16:46:58 -02:00
Roberto Ierusalimschy
25189b420d
field 'nups' in struct 'lua_Debug' changed from 'int' to 'unsigned
...
char' to save some space (even C functions cannot have more than
maxchar upvalues).
2010-01-05 16:33:26 -02:00
Roberto Ierusalimschy
cec25167d1
new api_check that 'pcallk' cannot be called inside hooks
2010-01-04 16:17:51 -02:00
Roberto Ierusalimschy
1fd4c482a0
reorganization of switch in function 'match' (details)
2010-01-04 14:37:19 -02:00
Roberto Ierusalimschy
35e729fa6d
comments + small details
2010-01-04 14:36:39 -02:00
Roberto Ierusalimschy
0dc09cb42e
'unpack' moved to table library (and therefore "renamed" to
...
'table.unpack'.
2009-12-28 14:30:31 -02:00
Roberto Ierusalimschy
cc1cbd19a0
'lua_cpcall' is deprecated + other small changes in 'pmain' (comments
...
and reordering to check arguments before running any Lua code)
2009-12-22 14:47:12 -02:00
Roberto Ierusalimschy
cb3f95d516
'lua_cpcall' is deprecated
2009-12-22 14:47:00 -02:00
Roberto Ierusalimschy
f84b575cfa
no more pseudoindex LUA_GLOBALSINDEX; global table now accessible
...
through registry
2009-12-22 13:32:50 -02:00
Roberto Ierusalimschy
3cb343efd6
code for error message for 'setn' removed
2009-12-18 14:53:12 -02:00
Roberto Ierusalimschy
ec0fc1a13b
missing parentheses around 'lua_version' + moving typdef's before
...
the extra include
2009-12-18 13:32:36 -02:00
Roberto Ierusalimschy
c3a6f3fa1c
'lua_objlen' replaced by 'lua_rawlen', 'lua_len', and 'luaL_len'
2009-12-17 14:20:01 -02:00
Roberto Ierusalimschy
0bbdddc86b
allocator function receives the tag of object being allocated in 'osize'
...
when 'ptr' is NULL.
2009-12-17 13:46:44 -02:00
Roberto Ierusalimschy
b3b8dfaaea
yet more options moved from luaconf.h into internal files
2009-12-17 11:08:51 -02:00
Roberto Ierusalimschy
adc6a4865b
macro name change: LUA_INIT->LUA_INIT_VAR
2009-12-17 11:07:41 -02:00
Roberto Ierusalimschy
2108754e46
macro name change: LUA_PATH->LUA_PATH_VAR, LUA_CPATH->LUA_CPATH_VAR,
...
LUA_PATHSEP->LUA_PATH_SEP, LUA_EXECDIR->LUA_EXEC_DIR
2009-12-17 11:06:47 -02:00
Roberto Ierusalimschy
46f1429936
more options moved from luaconf.h into internal files
2009-12-17 10:50:20 -02:00
Roberto Ierusalimschy
e0f9d1c8f5
removed export of function only for coco
2009-12-17 10:28:57 -02:00
Roberto Ierusalimschy
de6fc75d63
several configuration options that do not change often moved out of
...
luaconf.h and into more internal files
2009-12-17 10:26:09 -02:00
Roberto Ierusalimschy
2af0d3b459
allocator function receives the tag of object being allocated in 'osize'
...
when 'ptr' is NULL.
2009-12-16 14:42:58 -02:00
Roberto Ierusalimschy
9fbe0690fb
base-level C use global table as its environment
2009-12-15 09:25:36 -02:00
Roberto Ierusalimschy
a25b8ff69c
detail ('lua_tolstring' instead of lua_objlen)
2009-12-15 09:25:16 -02:00
Roberto Ierusalimschy
15b823ce4f
cleaner way to add extra space in a lua state.
2009-12-14 13:27:30 -02:00
Roberto Ierusalimschy
8da245bfd2
better to keep GC state numbers sequential, to optimize switch in
...
'singlestep'
2009-12-11 19:31:14 -02:00
Roberto Ierusalimschy
a2a2abcba4
new function 'luaC_runtilstate' to advance GC until a "valid" state
2009-12-11 17:14:59 -02:00
Roberto Ierusalimschy
2e51792596
avoid using deprecated macros lua_[gs]etglobal
2009-12-11 11:40:44 -02:00
Roberto Ierusalimschy
3a9ae612a4
macro 'ngcotouv' is the same as 'gco2uv', so it was removed
2009-12-11 11:39:34 -02:00
Roberto Ierusalimschy
9db693a57c
detail (comment)
2009-12-10 17:00:33 -02:00
Roberto Ierusalimschy
1375435e4a
several new features in testC to allow better testing of lua_resume
...
at the C API level
2009-12-10 16:21:28 -02:00
Roberto Ierusalimschy
2bb19ccf08
reordering of some functions + cleaner way to code lua_resume/resume +
...
small bug in lua_resume (in case of calling errors lua_resume should
remove only new arguments from the stack and push error message).
2009-12-10 16:20:07 -02:00
Roberto Ierusalimschy
64d5df7772
detail (lua_resume should empty coroutine stack even if they do not
...
fit into caller stack)
2009-12-10 16:17:37 -02:00
Roberto Ierusalimschy
2643da67c6
error messages from 'lua_resume' must be generated in protected mode,
...
to avoid raising memory errors
2009-12-08 16:59:24 -02:00
Roberto Ierusalimschy
ed117bb42a
lua_checkstack does not raise memory errors (instead it signals them)
2009-12-08 14:15:43 -02:00
Roberto Ierusalimschy
a4472490bc
new 'table.pack' function
2009-12-07 13:50:27 -02:00
Roberto Ierusalimschy
86312e1a7d
lua_objlen calls __len metamethod on tables (if present)
2009-12-07 13:49:47 -02:00
Roberto Ierusalimschy
df1dc3f1f5
strings in C scripts may be delimited by quotes + new functionality to
...
set C scripts as C hooks
2009-12-01 14:49:48 -02:00
Roberto Ierusalimschy
513d0258d9
details
2009-12-01 14:31:04 -02:00
Roberto Ierusalimschy
cfa8bc3ca4
continuations may be upvalues too
2009-11-27 13:39:31 -02:00
Roberto Ierusalimschy
a654e82f5c
coroutines may have C bodies
2009-11-27 13:38:51 -02:00
Roberto Ierusalimschy
3e41afcec5
extra api checks for number of returns of C functions and for lua_yield
2009-11-27 13:37:59 -02:00
Roberto Ierusalimschy
3acf5ec5a1
update of file dependencies (gcc -MM)
2009-11-27 12:39:31 -02:00
Roberto Ierusalimschy
93695db903
'table.maxn' deprecated
2009-11-26 15:35:13 -02:00
Roberto Ierusalimschy
9107dd115c
no more compatibility code for 'string.gfind'
2009-11-26 14:49:28 -02:00
Roberto Ierusalimschy
dc4c459546
a few new warnings
2009-11-26 14:36:55 -02:00
Roberto Ierusalimschy
19a6c38745
detail in 'currentpc' (only needs to work for Lua functions)
2009-11-26 13:34:15 -02:00
Roberto Ierusalimschy
3c4d970a7b
comment typos
2009-11-26 09:39:20 -02:00
Roberto Ierusalimschy
b0f2b288a6
new scheme for debug info about tail calls: no more 'fake' stack entries,
...
but stack entry knows whether it was tail called
2009-11-25 13:27:51 -02:00
Roberto Ierusalimschy
2b25489b47
'notail' -> 'noextrachars' ('notail' may confuse with tail calls)
2009-11-24 16:05:12 -02:00
Roberto Ierusalimschy
a6f465f558
new mark LUAMOD_API for all luaopen_* functions
2009-11-24 10:05:44 -02:00
Roberto Ierusalimschy
9a41506b8f
'os.exit' should close state only when second argument is true
2009-11-23 16:20:38 -02:00
Roberto Ierusalimschy
9a6d9ea57a
GC may get stuck during a parser and avoids proper resizing of the
...
string table, making its lists grow too much and degrading performance.
2009-11-23 12:59:30 -02:00
Roberto Ierusalimschy
062e809e54
new macros 'LUAI_DDEC'/'LUAI_DDEF' to better control declarations and
...
definitions of non-static variables
2009-11-19 17:06:52 -02:00
Roberto Ierusalimschy
b4c1824824
'luaV_arith' must be marked 'LUAI_FUNC' (as all non-static functions)
2009-11-19 17:04:58 -02:00
Roberto Ierusalimschy
2e5ef6a9fb
new macro 'isdummy'
2009-11-19 15:54:07 -02:00
Roberto Ierusalimschy
1dea393058
small corrections for 'luaall.c'
2009-11-19 14:26:52 -02:00
Roberto Ierusalimschy
45dec34597
comments
2009-11-19 14:26:29 -02:00
Roberto Ierusalimschy
b40a38a8ac
remove declaration of removed function
2009-11-19 14:24:41 -02:00
Roberto Ierusalimschy
ac899a6307
'debug.joinupvalue' -> 'debug.upvaluejoin'
2009-11-18 13:50:18 -02:00
Roberto Ierusalimschy
ce444bff33
(huge) simplification of GC management
2009-11-18 11:13:47 -02:00
Roberto Ierusalimschy
2d5931ebc8
ensure that reader function cannot yield during parsing
2009-11-17 14:46:44 -02:00
Roberto Ierusalimschy
35fa276099
parser/scanner keep GC running
2009-11-17 14:33:38 -02:00
Roberto Ierusalimschy
b51d76ce8d
when doing hard memory tests, perform a full GC at every possible step
2009-11-17 09:56:03 -02:00
Roberto Ierusalimschy
95020afb63
'module' returns the new module (to be used with lexical environments)
2009-11-16 13:51:19 -02:00
Roberto Ierusalimschy
c5050b1c41
functions 'getfenv' and 'setfenv' are deprecated
2009-11-16 13:51:03 -02:00
Roberto Ierusalimschy
b9063a08f5
new function 'loadin'
2009-11-13 15:01:40 -02:00
Roberto Ierusalimschy
7fe405739c
renaming: 'lua_upvaladdr' -> 'lua_upvalueid',
...
'lua_upvaljoin' -> 'lua_upvaluejoin'
2009-11-09 17:10:48 -02:00
Roberto Ierusalimschy
1ce819333d
new option 'isrunning' for 'lua_gc' (and 'collectgarbage')
2009-11-09 16:55:17 -02:00
Roberto Ierusalimschy
88eb901f81
registry and global table may be changed through the API without a
...
write barrier, so GC should visit them in the atomic phase.
2009-11-09 16:29:21 -02:00
Roberto Ierusalimschy
2583bac3d3
several small changes to simplify changing TValue if needed
2009-11-06 15:09:27 -02:00
Roberto Ierusalimschy
63a3b1a1eb
macro 'checkvalref' redefined as function (to avoid too long macros)
2009-11-06 15:08:43 -02:00
Roberto Ierusalimschy
fbf866a1a5
macro 'gkey' returns a "real" TValue*
2009-11-06 15:07:48 -02:00
Roberto Ierusalimschy
49a67c6d3f
new macro 'NILCONSTANT' to initialize nil constants
2009-11-06 15:07:12 -02:00
Roberto Ierusalimschy
a921d81033
avoid using 'ttype' when there is an explicit test + macro 'checkdeadkey'
...
to avoid repetitions
2009-11-06 15:06:19 -02:00
Roberto Ierusalimschy
155dd01163
avoid using 'ttype' when there is an explicit test
2009-11-06 15:05:34 -02:00
Roberto Ierusalimschy
599789a907
better to enclose macros in 'if' bodies with brackets
2009-11-06 15:03:37 -02:00
Roberto Ierusalimschy
9756f56354
better control over accesses to TValue fields
2009-11-05 15:43:54 -02:00
Roberto Ierusalimschy
b7d5f18d71
api functions to manipulate upvalues do not need to check their
...
arguments (the caller must check them before calling)
2009-11-05 15:26:00 -02:00
Roberto Ierusalimschy
5598b2bc55
new functions to identify and join upvalues
2009-11-05 14:48:31 -02:00
Roberto Ierusalimschy
77077b39d5
comment explaining OP_VARARG was wrong (and corresponding code was not
...
very clear)
2009-10-28 10:20:07 -02:00
Roberto Ierusalimschy
5bc91c6405
no more one environment per thread: all threads share a single global
...
environment
2009-10-23 17:12:19 -02:00
Roberto Ierusalimschy
f5073de0a7
'ipairs' goes until length of array instead of stopping at the first nil
2009-10-23 10:50:25 -02:00
Roberto Ierusalimschy
f6ed285cf2
new hash for doubles based on frexp, to avoid low-level tricks
2009-10-23 10:31:12 -02:00
Roberto Ierusalimschy
1448e736f0
better documentation for constructor syntax
2009-10-14 13:43:11 -03:00
Roberto Ierusalimschy
6e415e9387
local function definition does not need to correct debug information
2009-10-13 16:35:42 -03:00
Roberto Ierusalimschy
b114c99a60
two small bugs: 'debug.getinfo' did not consider negative indices as out
...
of range + 'debug.[gs]etlocal' crash on tail calls
2009-10-13 16:07:40 -03:00
Roberto Ierusalimschy
916587508c
parser keeps list of active local variables in a single dynamic array,
...
therefore saving C stack space
2009-10-11 17:02:19 -03:00
Roberto Ierusalimschy
a5382b763c
new function lua_copy
2009-10-05 13:44:33 -03:00
Roberto Ierusalimschy
ba21aa8b2b
'cpcall' must ensure correct environment for called function
2009-09-30 17:49:47 -03:00
Roberto Ierusalimschy
d119cf3035
a few more instructions to testC (func2udata and getfield)
2009-09-30 17:49:25 -03:00
Roberto Ierusalimschy
0ac3d07ea6
first implementation of lexical environments
2009-09-30 12:38:37 -03:00
Roberto Ierusalimschy
5938212748
information about upvalues (where they come from) kept in Proto structure,
...
instead of sequence of pseudo-opcodes after OP_CLOSURE
2009-09-28 13:32:50 -03:00
Roberto Ierusalimschy
1829911d7c
some operations may shrink g->totalbytes so g->estimate must be
...
more flexible
2009-09-28 10:50:34 -03:00
Roberto Ierusalimschy
bed2cb725a
initialize g->estimate (just in case)
2009-09-28 10:50:19 -03:00
Roberto Ierusalimschy
ab75bd23ee
handle extended opcodes (with OP_EXTRAARG) when checking metamethod
...
calls
2009-09-28 09:37:17 -03:00
Roberto Ierusalimschy
cee94df6e0
function list in luaL_register may be NULL for an empty list
2009-09-28 09:36:40 -03:00
Roberto Ierusalimschy
fcc46467fa
limit of constants per function changed to 2^26 using extra arguments
...
to opcodes LOADK, GETGLOBAL, and SETGLOBAL
2009-09-23 17:33:05 -03:00
Roberto Ierusalimschy
f8e354e240
detail (space between function name and its parameter list)
2009-09-23 17:14:00 -03:00
Roberto Ierusalimschy
a650378822
'cpcall' reimplemented as a predefined value in the registry
2009-09-21 09:09:52 -03:00
Roberto Ierusalimschy
99182c6872
references must start after predefined values in the registry
2009-09-18 15:58:45 -03:00
Roberto Ierusalimschy
67cae2854c
'lua_mainthread' replaced by new preregistered value LUA_RIDX_MAINTHREAD
2009-09-17 15:04:21 -03:00
Roberto Ierusalimschy
0e45ffb8e4
first implementation of 'lua_yieldk' (yield with continuation)
2009-09-14 11:30:39 -03:00
Roberto Ierusalimschy
071e54ae0b
extra facilities to testC: comments + commands print, callk and yield +
...
Cfunc with extra upvalues
2009-09-09 17:44:10 -03:00
Roberto Ierusalimschy
a68494fb32
'debug.[gs]etupvalue' should be able to access C upvalues too
2009-09-09 17:32:19 -03:00
Roberto Ierusalimschy
4b44793dc5
"bug": lua_createtable with sizes changed (array <-> record)
2009-09-07 11:24:12 -03:00
Roberto Ierusalimschy
90e2a716c8
details + comments
2009-09-05 09:39:29 -03:00
Roberto Ierusalimschy
d9fbbe1f23
"file:write" returns "file" in case of success
2009-09-01 16:10:48 -03:00
Roberto Ierusalimschy
4a714cebd1
API checks now have explanatory messages
2009-08-31 11:26:28 -03:00
Roberto Ierusalimschy
5b6be84106
ensures that argument 'mode' to 'io.open' matches "[rwa]%+?b?", to
...
avoid passing invalid modes to 'fopen'.
2009-08-28 10:51:57 -03:00
Roberto Ierusalimschy
b2bb2f7f59
better machinery to test continuations in the C API
2009-08-26 14:41:26 -03:00
Roberto Ierusalimschy
f096ab5421
correct way to check arguments to 'strftime'
2009-08-25 16:58:08 -03:00
Roberto Ierusalimschy
4e1ffc482a
test for 'fs' being NULL at the end of 'close_func' is useless ('fs'
...
cannot be NULl and the new ls->fs can only be NULL when the token
is EOS, in which case anchor_token has no effect).
2009-08-10 17:41:04 -03:00
Roberto Ierusalimschy
bc439e21cd
avoid an unprotected call to 'lua_tostring' which theoretically may
...
cause a panicked exit
2009-08-10 13:23:19 -03:00
Roberto Ierusalimschy
1b4480003b
"stange numbers" (-0 and NaN) also go to the constant table (as
...
strings with their binary representation). Therefore, constant
folding may produce these results.
2009-08-10 12:31:44 -03:00
Roberto Ierusalimschy
42167804b8
luaH_[gs]etnum renamed to luaH_[gs]etint (as they only accept integers,
...
not generic numbers).
2009-08-07 14:53:28 -03: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
95cbc402dc
"But" -> "Bug" (misspelling)
2009-08-05 10:09:38 -03:00
Roberto Ierusalimschy
decada8dc2
'debug.getfenv' does not check whether it has an argument
2009-08-04 15:51:19 -03:00
Roberto Ierusalimschy
ee5d03b42a
small bug: debug.getfenv should check whether it has an argument
2009-08-04 15:27:57 -03:00
Roberto Ierusalimschy
323f33d014
'collectgarbage"count"' returns a second argument with the count%1024.
2009-08-04 15:20:18 -03:00
Roberto Ierusalimschy
55dc7fb240
bug: stack must be cleared until its end (including extra size) +
...
control of stack size moved to 'ldo.c'
2009-07-16 13:26:09 -03:00
Roberto Ierusalimschy
11d7ba79f2
tail calls do not need to move whole new frame down, only its slice
...
up to last parameter (the rest has not been used yet)
2009-07-15 15:38:16 -03:00
Roberto Ierusalimschy
bd5fa9cc8f
new macro 'getproto'
2009-07-15 15:37:19 -03:00
Roberto Ierusalimschy
2658c94925
detail (comment: 'correspoding' -> 'corresponding')
2009-07-15 14:57:30 -03:00
Roberto Ierusalimschy
215885768c
'index2adr' -> 'index2addr' (correct spelling)
2009-07-15 14:57:03 -03:00
Roberto Ierusalimschy
a5f68589c0
avoid using 'UNUSED' (not defined outside the kernel)
2009-07-15 14:49:48 -03:00
Roberto Ierusalimschy
28419c4383
'luaL_tolstring' uses 'lua_tolstring' instead of 'lua_tostring' and
...
'lua_objlen'
2009-07-15 14:47:34 -03:00
Roberto Ierusalimschy
5bff2aaf47
calls with LUA_MULTRET may leave no free slots in the stack
2009-07-15 14:35:20 -03:00
Roberto Ierusalimschy
f76f4cb79d
new way to control stack overflow, controling only total size of the stack
2009-07-15 14:26:14 -03:00
Roberto Ierusalimschy
abb85fc059
new definition for 'luaD_checkstack' to avoid possible overflows
2009-07-08 13:06:51 -03:00
Roberto Ierusalimschy
aabe3ddbf4
errors in 'resume' should be all protected
2009-07-08 13:06:07 -03:00
Roberto Ierusalimschy
0c258c8492
smart use of varargs may create functions that return too
...
many arguments and overflow the stack of C functions.
2009-07-02 16:57:34 -03:00
Roberto Ierusalimschy
d57c9cdefc
BUG: 'luaV_settable' may invalidate a reference to a table and try
...
to reuse it.
2009-07-01 18:10:33 -03:00
Roberto Ierusalimschy
afb3f7e754
bug: 'luaV_settable' may invalidate a reference to a table and try
...
to reuse it.
2009-07-01 17:31:25 -03:00
Roberto Ierusalimschy
88564c3aec
Standard library for bitwise operations
2009-07-01 13:17:08 -03:00
Roberto Ierusalimschy
3abe3da9fb
new module 'lbitlib.c' for bitwise operations
2009-07-01 13:16:40 -03:00
Roberto Ierusalimschy
eb8499c8e0
use of LUAI_UINT32 replaced by 'unsigned LUA_INT32' (one less
...
definition needed)
2009-07-01 13:14:15 -03:00
Roberto Ierusalimschy
47c562435b
better error messages for luaL_checkversion
2009-06-19 11:21:57 -03:00
Roberto Ierusalimschy
02504d86d3
l_version may be local to 'lua_version'
2009-06-19 11:21:23 -03:00
Roberto Ierusalimschy
4a818f068a
'checkversion' implemented in the auxiliary library
2009-06-18 15:59:58 -03:00
Roberto Ierusalimschy
1d6ebce296
new function 'lua_version' (so that 'checkversion' can be implemented
...
in the auxiliary library)
2009-06-18 15:59:18 -03:00
Roberto Ierusalimschy
bc3e02a1b7
default paths have dot option as the last one (to improve security)
2009-06-18 15:19:36 -03:00
Roberto Ierusalimschy
f4eed60ca9
better treatment of integer formats in string.format
2009-06-18 13:51:03 -03:00
Roberto Ierusalimschy
c1de1fdac6
small optimization in 'lua_arith' (avoids overhead in the common case
...
of both arguments being numbers)
2009-06-18 13:36:40 -03:00
Roberto Ierusalimschy
a36c8e1718
new macro 'changenvalue'
2009-06-18 13:36:40 -03:00
Roberto Ierusalimschy
d7872dcf91
small optimization (reorder of BinOpr enum to unify some cases
...
in switches)
2009-06-18 13:35:05 -03:00
Roberto Ierusalimschy
14115170bc
lua_objlen should not work for numbers (according to the manual)
2009-06-17 15:38:54 -03:00
Roberto Ierusalimschy
ec52149485
'lua_lessthan' replaced by more generic 'lua_compare'
2009-06-17 14:53:50 -03:00
Roberto Ierusalimschy
6980cb1aa7
new functions 'lua_arith' and 'lua_compare'
2009-06-17 14:53:14 -03:00
Roberto Ierusalimschy
59a59fafc6
exports luaV_arith to be used by lua_arith
2009-06-17 14:51:07 -03:00
Roberto Ierusalimschy
2bdd194f43
exports luaV_arith to be used by lua_arith + uses 'luaO_arith' to
...
perform basic arith. operations
2009-06-17 14:50:09 -03:00
Roberto Ierusalimschy
96fa34ec32
constant folding uses 'luaO_arith' to perform basic operations
2009-06-17 14:49:09 -03:00
Roberto Ierusalimschy
6a024df440
new function 'luaO_arith' to perform basic arithmetic operations
2009-06-17 14:48:34 -03:00
Roberto Ierusalimschy
77fd93188e
'lessequal' renamed 'luaV_lessequal' and exported to be used by
...
'lua_compare'
2009-06-17 13:17:14 -03:00
Roberto Ierusalimschy
a21c89ddc8
new API function 'lua_mainthread'
2009-06-15 16:51:31 -03:00
Roberto Ierusalimschy
49b88b1c39
patch for wrong code generation for some particular boolean expressions
2009-06-15 11:12:59 -03:00
Roberto Ierusalimschy
3db5f60547
BUG: "(((1 or false) and true) or false)" gives wrong result
2009-06-15 10:52:08 -03:00
Roberto Ierusalimschy
2258ec6bc9
'getline' renamed to 'getfuncline' (to avoid problems with POSIX)
2009-06-10 13:57:53 -03:00
Roberto Ierusalimschy
2598138ece
new function 'luaK_codek' (detail)
2009-06-10 13:52:03 -03:00
Roberto Ierusalimschy
4a67e48611
new macro 'condmovestack' instead of 'condhardstacktests'
2009-06-08 16:35:59 -03:00
Roberto Ierusalimschy
5cdec7d124
added "\n" at the end of 'package.config' (so that the string
...
is a sequence of complete lines)
2009-06-04 16:34:24 -03:00
Roberto Ierusalimschy
9423e22aa3
no more L->base + ci->base only for Lua functions (C functions may use
...
'func')
2009-06-01 16:09:26 -03:00
Roberto Ierusalimschy
57f8414de1
small bug in 'luaV_concat' (L->top was left incorrect in some cases)
2009-05-27 14:11:27 -03:00
Roberto Ierusalimschy
139d562861
type of 'luai_ctype_' array changed to unsigned (safer for bitwise
...
operations)
2009-05-27 13:51:15 -03:00
Roberto Ierusalimschy
eea6d10866
details (use ci->base instead of L->base when possible)
2009-05-22 12:19:54 -03:00
Roberto Ierusalimschy
019ebcb85f
errors in finalizers are propagated with code LUA_ERRGCMM (ERRor in
...
__gc MetaMethod)
2009-05-21 17:06:11 -03:00
Roberto Ierusalimschy
889284ebd0
hexadecimal escape sequences in strings + better error messages for
...
bad decimal escape sequences
2009-05-18 14:28:04 -03:00
Roberto Ierusalimschy
6956331093
new macro 'zungetc'
2009-05-18 14:26:25 -03:00
Roberto Ierusalimschy
92479f1a8b
new property 'lisupper' (needed to compute values for hexa digits)
2009-05-18 14:15:14 -03:00
Roberto Ierusalimschy
e67dc3a227
'symbexec' merged with 'getobjname' (as only use for symbolic execution
...
now is to find a "good" name for an object)
2009-05-04 15:26:21 -03:00
Roberto Ierusalimschy
0cc3add9f8
variable renaming: 'lualibs' -> 'loadedlibs'; 'luareqlibs' ->
...
'preloadedlibs'
2009-05-01 10:46:35 -03:00
Roberto Ierusalimschy
71c2eeff98
comments
2009-05-01 10:37:11 -03:00
Roberto Ierusalimschy
d7bc346d7a
no more code checking
2009-04-30 14:42:21 -03:00
Roberto Ierusalimschy
673c456cba
resize string hash table only when new size is smaller than current one
2009-04-29 14:09:41 -03:00
Roberto Ierusalimschy
ea44570883
hash table for strings is rehashed in place
2009-04-29 14:09:41 -03:00
Roberto Ierusalimschy
e091a254df
new way to GC stacks: the entire stack must be correct all the times;
...
the 'dead' part of a stack (after the top) must have only nil's, so
that 'top' may go up without cleaning the stack.
2009-04-28 16:04:36 -03:00
Roberto Ierusalimschy
58c3aa8b5f
malicious zero-length string in binary code may segfault Lua +
...
wrong code generation for some particular boolean expressions
2009-04-27 17:11:11 -03:00
Roberto Ierusalimschy
c1f78ff3d3
unused arguments removed
2009-04-27 15:58:31 -03:00
Roberto Ierusalimschy
e5249b9fb5
'exit' changed to 'abort' in case of panic (+ some extra comments)
...
'abort' seems more in line with panic ("abnormal termination")
2009-04-26 18:55:35 -03:00
Roberto Ierusalimschy
d3037d97ec
several small improvements based on 'ci' being fixed now (including
...
erasing savedpc from lua_State)
2009-04-17 19:00:01 -03:00
Roberto Ierusalimschy
c6b442bd36
'luaM_freearray' does not need array type as argument
2009-04-17 11:40:13 -03:00
Roberto Ierusalimschy
4f88418170
'CallInfo' stack implemented as double-linked list instead of an array
2009-04-17 11:28:06 -03:00
Roberto Ierusalimschy
311e9f3ceb
'nresults' is saved in CallInfo from the caller, not the called
2009-04-15 13:53:39 -03:00
Roberto Ierusalimschy
8775f25830
new function 'T.makeCfunc' (for later use)
2009-04-14 16:10:17 -03:00
Roberto Ierusalimschy
70a63fa5ad
first implementation of yieldable 'pcall'
2009-04-08 15:04:33 -03:00
Roberto Ierusalimschy
fffbaede75
detail
2009-04-03 12:58:03 -03:00
Roberto Ierusalimschy
ae9ad6c694
added comment explaining why the 'feof' test when loading a file
2009-04-02 16:54:06 -03:00
Roberto Ierusalimschy
83d2dbb15d
Lua will abort anyway, so 'panic' does not need to.
2009-03-31 14:25:08 -03:00
Roberto Ierusalimschy
4e43741943
in 'lua_call', avoid preparing a continuation when thread cannot yield.
2009-03-30 15:39:20 -03:00
Roberto Ierusalimschy
a274596ecc
avoid making 'lastfree' an invalid pointer
2009-03-30 15:38:24 -03:00
Roberto Ierusalimschy
7e9bc41fe7
'loadlib(lib, "*")' loads 'lib' with global names exported to all
2009-03-26 19:25:05 -03:00
Roberto Ierusalimschy
b1e1c15ced
small bug: EOZ is a valid character to be tested
2009-03-26 15:53:52 -03:00
Roberto Ierusalimschy
3dbf305408
no more support for old-style varargs
2009-03-26 09:57:01 -03:00
Roberto Ierusalimschy
6d0ae11c57
'context' added to suspendable calls
2009-03-23 11:26:12 -03:00
Roberto Ierusalimschy
3ca739b418
'math.random' uses lua_Number to manage its arguments (there is no
...
reason to lose range).
2009-03-17 14:55:39 -03:00
Roberto Ierusalimschy
9e613b8583
missing argument to 'assert' raises "assertion failed" error
2009-03-16 13:30:50 -03:00
Roberto Ierusalimschy
9428ec42d0
new optional argument to 'load', to control allowed modes (binary or
...
textual chunks)
2009-03-13 12:50:03 -03:00
Roberto Ierusalimschy
6ffcf21367
ctype 'lalpha' includes '_' (as '_' behaves as a letter from the
...
point of view of Lua)
2009-03-11 10:27:32 -03:00
Roberto Ierusalimschy
6427c61e7c
added macro 'lisxdigit' (just in case :)
2009-03-10 14:42:33 -03:00
Roberto Ierusalimschy
ba484b9eb1
yielding across lua_call (first version)
2009-03-10 14:14:37 -03:00
Roberto Ierusalimschy
f9d015523e
better notes about some opcodes (comments only)
2009-03-09 12:27:56 -03:00
Roberto Ierusalimschy
1817dfc301
initial separation, in CallInfo, of what is relevant only to Lua
...
functions or only to C functions
2009-03-04 10:32:29 -03:00
Roberto Ierusalimschy
7837e34e56
new states have a reasonable panic function +
...
testC may run code on different threads +
rename of some testC operations ('rawcall'->'call', 'call'->'pcall')
2009-03-03 15:52:36 -03:00
Roberto Ierusalimschy
910310d3ba
if thread has no error handling, try main thread handler before panicking
2009-03-03 15:51:24 -03:00
Roberto Ierusalimschy
facfcd497f
detail
2009-03-02 13:34:23 -03:00
Roberto Ierusalimschy
b403317325
error functions search global space for a name for a function when
...
no other name is available
2009-02-27 15:18:19 -03:00
Roberto Ierusalimschy
9bf05e7364
code section 'Traceback' moved to the beginning of the file
2009-02-27 15:17:13 -03:00
Roberto Ierusalimschy
e39e758a73
closing a "popen" file returns the process exit status
2009-02-20 10:50:27 -03:00
Roberto Ierusalimschy
5438d77221
global array of ctypes renamed to 'luai_ctype_' (extern names must
...
use a "lua" prefix...)
2009-02-20 10:11:15 -03:00
Roberto Ierusalimschy
6905ae900b
Lua now uses "homemade" lctype (instead of ctype.h from ANSI C)
2009-02-19 14:33:51 -03:00
Roberto Ierusalimschy
ada82930fd
"homemade" version of ctype.h
2009-02-19 14:18:25 -03:00
Roberto Ierusalimschy
f36e319658
'fputs' changed to 'luai_writestring' + use of 'lua_checkversion'
2009-02-19 14:15:35 -03:00
Roberto Ierusalimschy
0cea28a785
better error messages for 'lua_checkversion'
2009-02-19 14:15:13 -03:00
Roberto Ierusalimschy
d2ebdc045b
new macro 'lua_checkversion' to check whether core and application are
...
compatible
2009-02-18 14:20:56 -03:00
Roberto Ierusalimschy
81ede6bfce
using light userdata to represent "remote" states
2009-02-18 11:52:51 -03:00
Roberto Ierusalimschy
2b579b4b83
panic mode does not reset stack (so that panic function can gather
...
debug information from it)
2009-02-18 11:52:03 -03:00
Roberto Ierusalimschy
a1d0e1a11a
'log10' is deprecated now
2009-02-18 10:17:10 -03:00
Roberto Ierusalimschy
8975739839
better precision for log(x, 10)
2009-02-18 10:06:05 -03:00
Roberto Ierusalimschy
d07abcc6c7
finalizers always called protected
2009-02-17 16:47:58 -03:00
Roberto Ierusalimschy
189378142a
buffer creation ensures buffer space plus MINSTACK in the stack
2009-02-17 11:31:16 -03:00
Roberto Ierusalimschy
82749b765e
'db_errorfb' changed to 'db_traceback' for consistency
2009-02-17 10:21:28 -03:00
Roberto Ierusalimschy
2b590aea40
no more '__len' metamethod for strings
2009-02-16 17:09:28 -03:00
Roberto Ierusalimschy
547e47649f
'luaL_typeerror' spelled right
2009-02-13 17:39:34 -02:00
Roberto Ierusalimschy
41dd32e18e
comment (should not use 'go trhough' when simply using multiple labels)
2009-02-11 16:25:20 -02:00
Roberto Ierusalimschy
5d3cc5def8
'writestring' changed into a configurable macro
2009-02-07 10:23:15 -02:00
Roberto Ierusalimschy
53db607963
avoid using 'fputs' in 'print' to avoid problems with embedded zeros
2009-02-06 16:38:47 -02:00
Roberto Ierusalimschy
cbf0c7a103
check for invalid use of '%' in replacement string in 'string.gsub'
2009-02-03 17:39:19 -02:00
Roberto Ierusalimschy
4c399c5dfb
detail (MAXSRC changed to LUA_IDSIZE)
2008-12-26 09:55:57 -02:00
Roberto Ierusalimschy
b472098493
concat TM can yield
2008-11-06 10:43:51 -02:00
Roberto Ierusalimschy
84b3daebbd
generic for coded as two dedicated instructions to simplify resumption
2008-10-30 13:39:30 -02:00
Roberto Ierusalimschy
f6978173e0
yields accross metamethods and for iterators (except for __concat)
2008-10-28 14:53:16 -02:00
Roberto Ierusalimschy
e02483dbc0
whole build depends on 'makefile' itself + better format for warning
...
options
2008-10-28 14:52:00 -02:00
Roberto Ierusalimschy
9e58e0df8f
some cleaning
2008-10-28 10:55:00 -02:00
Roberto Ierusalimschy
690efef3de
detail (added 'UNUSED' to unused argument)
2008-10-28 10:54:25 -02:00
Roberto Ierusalimschy
b9e92c8b0d
updating header dependencies
2008-10-03 13:40:56 -03:00
Roberto Ierusalimschy
4376c9bc5f
more specific test to avoid calling luaF_close when function returns
2008-09-09 10:53:02 -03:00
Roberto Ierusalimschy
f94cd2201c
better control of call status through CallInfo
2008-08-26 10:27:42 -03:00
Roberto Ierusalimschy
fdbb243ff9
first steps towards yielding through longjump
2008-08-13 14:02:42 -03:00
Roberto Ierusalimschy
c1565c16ed
small bug: lua_resume returning LUA_YIELD is not an error
2008-08-13 14:02:12 -03:00
Roberto Ierusalimschy
394646891c
new field 'status' in CallInfo structure
2008-08-13 14:01:33 -03:00
Roberto Ierusalimschy
d69aa51088
added missing parentheses around function names
2008-08-13 11:08:49 -03:00
Roberto Ierusalimschy
afe849c9b4
change in error message
2008-08-06 10:38:32 -03:00
Roberto Ierusalimschy
ccd678ea3e
'module' may change the environment of a C function +
...
internal macro 'svalue' is wrong
2008-08-06 10:32:45 -03:00
Roberto Ierusalimschy
bb92ef23cb
bug: string at the end of TString must consider the entire TString
...
entity, not only its 'tsv' part
2008-08-05 16:26:23 -03:00
Roberto Ierusalimschy
bb48f456d9
bug: 'module' now checks that is caller is a Lua function
2008-08-05 16:25:42 -03:00
Roberto Ierusalimschy
df802dc74b
larger alignment requirement helps to uncover some kinds of bugs
2008-08-05 16:24:46 -03:00
Roberto Ierusalimschy
e23da9edee
GC step does not unblock collector (when it is blocked by "stop")
2008-08-01 14:01:16 -03:00
Roberto Ierusalimschy
4db2cddeee
LUA_COMPAT -> LUA_COMPAT_API (more specific)
2008-07-18 16:58:10 -03:00
Roberto Ierusalimschy
f9dec5fc84
do not use compatibility macros in Lua
2008-07-11 14:51:01 -03:00
Roberto Ierusalimschy
6b8725b0ee
new macro LUA_COMPAT to control some compatibility macros
2008-07-11 14:50:31 -03:00
Roberto Ierusalimschy
6955666290
'string.byte' gets confused with some out-of-range negative indices +
...
user-requested GC step may loop forever
2008-07-11 14:27:41 -03:00
Roberto Ierusalimschy
5298392c5a
bug: GC step could loop forever under very particular circumstances
2008-07-04 15:27:11 -03:00
Roberto Ierusalimschy
1ceec74370
useless test removed (pointed by lint)
2008-07-03 11:25:05 -03:00
Roberto Ierusalimschy
2a84c29bc3
comment about exported function not used by Lua
2008-07-03 11:24:36 -03:00
Roberto Ierusalimschy
4d8a1103d3
useless #define removed (pointed by lint)
2008-07-03 11:24:11 -03:00
Roberto Ierusalimschy
202de59254
useless #include removed (pointed by lint)
2008-07-03 11:23:35 -03:00
Roberto Ierusalimschy
f858a155c2
identation error (pointed by lint)
2008-07-03 11:21:41 -03:00
Roberto Ierusalimschy
9e7de9473c
message from -v option goes to stdout, as it is not an error message
2008-06-26 16:47:51 -03:00
Roberto Ierusalimschy
0c8f5fc2fd
simplification in the handling of finalizers: no more 'tmudata' list +
...
no more GCSsweeptmu collector's state
2008-06-26 16:42:45 -03:00
Roberto Ierusalimschy
1527d8f00d
GC called after errors now are called after showing error message (to
...
avoid problems when there are other errors during GC itself)
2008-06-26 16:40:12 -03:00
Roberto Ierusalimschy
8efaf8af81
added a comment about warnings for __attribute__(visibility) in some
...
elf targets
2008-06-25 12:27:12 -03:00
Roberto Ierusalimschy
c3525610fe
bug: when closing the state, 'luaC_separateudata' might mark
...
userdata in the wrong phase of collection, therefore avoiding
their traversal
2008-06-23 19:07:44 -03:00
Roberto Ierusalimschy
7ba62e2985
code reorganization (only changed comments and order of functions)
2008-06-23 13:51:28 -03:00
Roberto Ierusalimschy
8fd28611d5
outdated comment
2008-06-23 13:51:08 -03:00
Roberto Ierusalimschy
93869acb2c
"test trick" seems more useful with pointers instead of integers
2008-06-23 13:50:34 -03:00
Roberto Ierusalimschy
480a1da34a
when error is 'bad self' original message probably makes no sense, so
...
it is better not to show it.
2008-06-13 15:45:35 -03:00
Roberto Ierusalimschy
59e2973335
removed static variable lua_state (not used)
2008-06-13 14:07:10 -03:00
Roberto Ierusalimschy
5d09be4832
by default, 'os.exit' closes current state
2008-06-13 13:59:00 -03:00
Roberto Ierusalimschy
860e285f31
'luaL_gsub' moved into 'testC' (all auxlib should be tested through 'testC')
2008-06-13 11:15:59 -03:00
Roberto Ierusalimschy
eb8ac6e2a0
'luaL_testudata' does not leave garbage on the stack in case of failure
2008-06-12 11:37:27 -03:00
Roberto Ierusalimschy
b1203e036d
'posrelat' avoids problems with -(-2^31)
2008-06-12 11:21:18 -03:00
Roberto Ierusalimschy
92a0d4c67f
extra options in 'testC' for newmetatable and testudata
2008-06-12 11:20:49 -03:00
Roberto Ierusalimschy
5fa55df2ca
updated years in some comments/strings
2008-05-09 13:51:44 -03:00
Roberto Ierusalimschy
a3af42de8e
patch for "blow stack" bug
2008-05-08 13:55:08 -03:00
Roberto Ierusalimschy
198be23f36
added structure for local-variable information to allow extra
...
checkings if needed
2008-05-08 12:44:51 -03:00
Roberto Ierusalimschy
24359ae294
'string.find' cannot find things after subject's end
2008-04-14 12:54:59 -03:00
Roberto Ierusalimschy
6c84722afa
make default GC behavior a little more agressive
...
(to avoid falling behind memory consumption)
2008-04-07 15:58:42 -03:00
Roberto Ierusalimschy
facb0519a0
two bugs: invalid boolean values in constant table + too deep recursion
...
when reading nested functions
2008-04-07 15:44:23 -03:00
Roberto Ierusalimschy
ffdca3522e
'table.sort' detects invalid order function before calling it
...
for nil elements
2008-04-07 15:43:00 -03:00
Roberto Ierusalimschy
4d7469b610
avoid constant folding for -0 (to avoid it colapsing to 0)
2008-04-07 15:41:47 -03:00
Roberto Ierusalimschy
2b84e36b93
patches for some bugs
2008-04-04 22:31:59 -03:00
Roberto Ierusalimschy
85bda9eef5
bugs: precheck must use check (instead of assert) and ensures that
...
code size is at least 1
2008-04-02 16:14:16 -03:00
Roberto Ierusalimschy
a4d3080fe3
SETLIST extra argument now is an "instruction" (OP_EXTRAARG)
2008-04-02 14:38:54 -03:00
Roberto Ierusalimschy
5627d51e05
corrected error message ("too many constants" -> "too many functions")
2008-04-02 14:19:22 -03:00
Roberto Ierusalimschy
e64b0cada8
several bugs related to precompiled code
2008-04-01 16:17:48 -03:00
Roberto Ierusalimschy
7316d61a66
'coroutine.running' should work for the main thread too
2008-02-25 11:33:57 -03:00
Roberto Ierusalimschy
e2b366c760
userdata with finalizers are kept in a separated list
2008-02-19 15:55:09 -03:00
Roberto Ierusalimschy
fa19baab7f
proxies must be created with a __gc field in their metatables to work
...
properly with new semantics for finalizers
2008-02-19 15:54:09 -03:00
Roberto Ierusalimschy
2f8351fe48
turn off optimizations when testing
2008-02-15 15:44:34 -02:00
Roberto Ierusalimschy
32d42bdcdc
bugs: lua_checkstack may have arithmetic overflow for large 'size' +
...
unpack with maximum indices may crash due to arithmetic overflow
2008-02-14 14:51:57 -02:00
Roberto Ierusalimschy
843d53aabb
'table.concat' may get confused with too large limits
2008-02-14 14:03:27 -02:00
Roberto Ierusalimschy
5ac3386888
bug: unpack with maximum indices may crash due to arithmetic overflow
2008-02-14 14:03:09 -02:00
Roberto Ierusalimschy
6d182faab6
bug: lua_checkstack may have arithmetic overflow for large 'size'
2008-02-14 14:02:58 -02:00
Roberto Ierusalimschy
f86f4116c8
micro-optimization: avoid one API call in 'read_chars'
2008-02-12 15:05:36 -02:00
Roberto Ierusalimschy
7f69f0efb0
remove of useless test in 'read_chars' (if n == 0 then the resulting
...
string cannot be empty).
2008-02-12 14:51:03 -02:00
Roberto Ierusalimschy
f6cab9666c
corrected name of 'Patrick Donnelly'
2008-02-12 14:42:46 -02:00
Roberto Ierusalimschy
3deb38814d
added assertions checking maximum number of upvalues
2008-02-12 11:34:12 -02:00
Roberto Ierusalimschy
3b5b14a085
LUAI_MAXCSTACK must be smaller than -LUA_REGISTRYINDEX +
...
coroutine.resume pushes element without ensuring stack size
2008-02-11 17:18:21 -02:00
Roberto Ierusalimschy
aec671c126
maximum C stack should reserve some values for pseudo-indices
2008-02-11 17:17:19 -02:00
Roberto Ierusalimschy
dd92af69db
bug: pseudo-indices should be linked to maximum C stack size
2008-02-11 17:16:02 -02:00
Roberto Ierusalimschy
015e973899
bug: auxresume should reserve stack space for boolean result
2008-02-11 17:14:52 -02:00
Roberto Ierusalimschy
163f58dac5
in 'testC', booleans should be represented by booean values
2008-02-11 17:04:16 -02:00
Roberto Ierusalimschy
dcee7d2fe0
new instructions 'newtable' and 'checkstack' in 'testC'
2008-02-11 16:04:26 -02:00
Roberto Ierusalimschy
5f0a2f6248
more options for 'kinds' of Garbage Collection + more agressive
...
shrinking of stacks and string hash
2008-02-11 13:46:03 -02:00
Roberto Ierusalimschy
a73930228a
more options for 'kinds' of Garbage Collection
2008-02-11 13:45:30 -02:00
Roberto Ierusalimschy
a76fa25199
'ceillog2' now is exported (other modules may need it)
2008-01-30 16:05:23 -02:00
Roberto Ierusalimschy
dd3519ab89
comment (LUA_GLOBALSINDEX does not need write barrier in lua_replace)
2008-01-25 11:42:12 -02:00
Roberto Ierusalimschy
3a515df086
debug.sethook/gethook may overflow the thread's stack
2008-01-21 12:41:19 -02:00
Roberto Ierusalimschy
74897bc52f
bug: debug.sethook/gethook may overflow thread's stack
2008-01-21 11:37:08 -02:00
Roberto Ierusalimschy
e7c989baf1
avoid calling "tail return" hooks if the hook itself turns off the event
2008-01-18 20:36:50 -02:00
Roberto Ierusalimschy
7a3c8314ac
small bug (see http://lua-users.org/lists/lua-l/2007-08/msg00350.html )
2008-01-18 15:14:47 -02:00
Roberto Ierusalimschy
6f8257ec5f
it seems useless trying to avoid this warning...
2008-01-18 13:37:10 -02:00
Roberto Ierusalimschy
87b0191753
better definition for LUAI_MAXCSTACK
2008-01-17 14:24:38 -02:00
Roberto Ierusalimschy
56c17ba4c7
detail
2008-01-17 14:24:30 -02:00
Roberto Ierusalimschy
daddc57abd
luaL_tostring -> luaL_tolstring (more generic)
2008-01-03 15:07:59 -02:00
Roberto Ierusalimschy
f9cdd09191
larger limit for MAXCSTACK (plus removing of some useless definitions)
2008-01-02 14:36:19 -02:00
Roberto Ierusalimschy
47b4858357
detail ('name' of baselib is "_G")
2008-01-02 14:16:28 -02:00
Roberto Ierusalimschy
b8d23d6e07
option to use Sun compiler (on lhf account)
2007-12-27 10:59:43 -02:00
Roberto Ierusalimschy
fdecdd0cec
stand-alone interpreter shows incorrect error message when the
...
'message' is a coroutine (already fixed in 5.2)
2007-12-27 10:58:29 -02:00
Roberto Ierusalimschy
fabdaa37b6
'lua_pushfstring' raises an error if called with invalid format
2007-12-19 15:24:38 -02:00
Roberto Ierusalimschy
bc82b4d78a
new function 'package.searchpath'
2007-12-12 12:36:12 -02:00
Roberto Ierusalimschy
dae850e0ee
details
2007-12-08 09:54:32 -02:00
Roberto Ierusalimschy
abcc124df0
BUG: lua_setfenv may crash if called over an invalid object
2007-11-28 16:27:38 -02:00
Roberto Ierusalimschy
b4164a9aa7
details
2007-11-28 16:25:17 -02:00
Roberto Ierusalimschy
9f0d62ad9f
BUG: table.remove removes last element of a table when given
...
an out-of-bound index
2007-11-26 14:57:33 -02:00
Roberto Ierusalimschy
64ecf24210
detail
2007-11-26 14:56:11 -02:00
Roberto Ierusalimschy
658e7caf92
use prefix in extern names, even those in test files
2007-11-12 14:28:45 -02:00
Roberto Ierusalimschy
788506dd58
detail
2007-11-12 12:10:09 -02:00
Roberto Ierusalimschy
62790ab15d
detail
2007-11-09 16:55:07 -02:00
Roberto Ierusalimschy
ad60b3ead7
avoid the use of "exotic" libc functions
2007-11-09 16:54:25 -02:00
Roberto Ierusalimschy
5e8dd55574
first implementation of ephemerons
2007-10-31 13:41:19 -02:00
Roberto Ierusalimschy
0e961ad47a
some changes toward ephemerons
2007-10-29 14:51:20 -02:00
Roberto Ierusalimschy
c06cc60946
BUG: 'gsub' may go wild when wrongly called without its third
...
> argument and with a large subject.
2007-10-29 13:51:10 -02:00
Roberto Ierusalimschy
2fa476655f
detail
2007-10-25 17:31:05 -02:00
Roberto Ierusalimschy
7a78495f31
avoid problems with 'ptrdiff_t'
2007-10-25 17:30:36 -02:00
Roberto Ierusalimschy
3138afbe2e
parser should not call 'luaX_lexerror'
2007-10-25 14:45:47 -02:00
Roberto Ierusalimschy
4eef0aaad1
detail
2007-10-18 09:01:52 -02:00
Roberto Ierusalimschy
ab09732986
new metamethods for '__pairs' and '__ipairs'
2007-10-17 15:26:39 -02:00
Roberto Ierusalimschy
b7fa64565a
27 is not a prime number :(
2007-09-30 10:09:43 -03:00
Roberto Ierusalimschy
2622ed2528
better way to handle redefinitions of 'localeconv'
2007-09-14 10:27:04 -03:00
Roberto Ierusalimschy
9cb0607f6f
avoid warnings about exit; return
2007-09-14 10:26:28 -03:00
Roberto Ierusalimschy
8998032f66
detail
2007-09-14 10:26:03 -03:00
Roberto Ierusalimschy
80b4753539
better error message for 'concat'
2007-09-12 17:53:24 -03:00
Roberto Ierusalimschy
fe0838cd1c
tables and strings respect __len metamethod
2007-09-10 14:59:32 -03:00
Roberto Ierusalimschy
8acaa2ce07
An error in a module loaded through the '-l' option
...
shows no traceback.
2007-09-05 14:18:27 -03:00
Roberto Ierusalimschy
c676f13e1a
stand-alone error-message details
2007-09-05 14:17:39 -03:00
Roberto Ierusalimschy
9b47cee8b2
better to flush all files before starting new process with popen
2007-08-30 13:13:13 -03:00
Roberto Ierusalimschy
47e666c090
no need for ctype.h
2007-08-10 09:56:02 -03:00
Roberto Ierusalimschy
3059579253
detail
2007-08-09 17:29:15 -03:00
Roberto Ierusalimschy
72c2f75648
detail (LUA_COPYRIGHT includes release number)
2007-08-07 13:53:40 -03:00
Roberto Ierusalimschy
ec68ed66ed
detail
2007-08-01 09:17:29 -03:00
Roberto Ierusalimschy
f6a81dbe97
BUG: too many variables in an assignment may cause a C stack overflow
2007-07-31 16:39:52 -03:00
Roberto Ierusalimschy
3904a66ab0
'debug' library must be required before being used
2007-06-22 13:59:11 -03:00
Roberto Ierusalimschy
ffc5f78229
detail
2007-06-22 12:39:34 -03:00
Roberto Ierusalimschy
3f78748ef3
traceback function moved to auxlib
2007-06-22 12:33:54 -03:00
Roberto Ierusalimschy
d26bfb5ae4
"spacial" reorganization to keep related functions in groups
2007-06-21 11:09:59 -03:00
Roberto Ierusalimschy
8d3dd04137
clearing some old compatibility code
2007-06-21 10:52:27 -03:00
Roberto Ierusalimschy
791d8d8585
detail
2007-06-21 10:50:53 -03:00
Roberto Ierusalimschy
e85515958b
clearing some old compatibility code
2007-06-21 10:48:04 -03:00
Roberto Ierusalimschy
dc59444cd1
strong collision for very small numbers used as table keys
2007-06-19 17:23:29 -03:00
Roberto Ierusalimschy
6c042e17b1
avoid boolean equality (tricky for some compilers)
2007-06-19 16:48:15 -03:00
Roberto Ierusalimschy
18a583306b
patch may be a little simpler
2007-05-29 16:05:25 -03:00
Roberto Ierusalimschy
fc8d077612
bug: wrong error message in some concatenations
2007-05-29 15:59:59 -03:00
Roberto Ierusalimschy
e64fcb9d94
bug: recursive coroutines may overflow C stack
2007-05-25 14:13:47 -03:00
Roberto Ierusalimschy
6c0a9a272e
assignment of nil to parameter may be optimized away
...
__concat metamethod converts numbers to strings
loadlib.c should not access Lua internals
code generated for "-nil", "-true", and "-false" is wrong
Count hook may be called without being set
2007-05-16 12:39:08 -03:00
Roberto Ierusalimschy
01fa1bc114
luaL_testudata (a luaL_checkudata that does not raise errors) is
...
very needed.
2007-05-15 15:46:12 -03:00
Roberto Ierusalimschy
aa003eba8e
details
2007-05-11 14:28:56 -03:00
Roberto Ierusalimschy
becf19feef
better names for metamethods in debug information
2007-05-09 12:49:36 -03:00
Roberto Ierusalimschy
81fc3c4f45
bug: code generated for "-nil", "-true", and "-false" is wrong
2007-05-04 15:41:49 -03:00
Roberto Ierusalimschy
e7fb0d8a6f
'os.date' checks arguments before passing them to 'strftime'
2007-05-03 17:49:29 -03:00
Roberto Ierusalimschy
4eb49163c6
error handler in 'lua.c' tries '__tostring' metamethod if error
...
message is not a string
2007-04-26 17:39:38 -03:00
Roberto Ierusalimschy
79cb336d74
does not allow standard files to be closed
2007-04-19 17:22:32 -03:00
Roberto Ierusalimschy
38063345ae
several details
2007-04-19 17:21:53 -03:00
Roberto Ierusalimschy
ae00b3a76f
another way to normalize -0 that avoids problems with very small
...
numbers (adding 1 turns them all into 1)
2007-04-18 16:24:35 -03:00
Roberto Ierusalimschy
619be354c8
lua_pushstring/pushlstring return string
2007-04-17 10:19:53 -03:00
Roberto Ierusalimschy
94d40f3980
luaO_log2 can be private to ltable.c
2007-04-10 09:18:17 -03:00
Roberto Ierusalimschy
585b81f91e
remove of a non-used test function
2007-04-10 09:17:52 -03:00
Roberto Ierusalimschy
5f4f0d4a63
no more optimization to avoid LOADNIL at function start
2007-03-27 11:11:38 -03:00
Roberto Ierusalimschy
8e36e1fe49
details (randomseed calls rand once to dischard first value)
2007-03-27 09:37:00 -03:00
Roberto Ierusalimschy
97505caa64
detail
2007-03-26 15:35:34 -03:00
Roberto Ierusalimschy
df50c84ee0
BUG: loadlib should not use Lua internals (lobject.h)
2007-03-26 12:57:35 -03:00
Roberto Ierusalimschy
1a455acc81
two small bugs: some metamethods do not accept callable non-function
...
objects + __concat converts numbers to strings before calling metamethod
2007-03-26 12:56:23 -03:00
Roberto Ierusalimschy
60bc151ed7
patch for last bug
2007-03-09 15:51:32 -03:00
Roberto Ierusalimschy
3b19bd4d57
bug: wrong code when constant is coded after it should be
2007-03-09 15:50:56 -03:00
Roberto Ierusalimschy
08f902cf49
better documentation for auxiliary functions (that should be called only
...
through specific macros).
2007-02-09 11:04:52 -02:00
Roberto Ierusalimschy
d3c304e92e
BUG: setfenv accepts invalid argument
2007-02-09 10:40:21 -02:00
Roberto Ierusalimschy
3bf0292cd5
two new bugs + one new patch
2007-02-09 10:39:52 -02:00
Roberto Ierusalimschy
a7861d9d66
new year...
2007-02-07 15:54:52 -02:00
Roberto Ierusalimschy
d62a21b9d3
when formatting with '%q', all control characters are coded
...
as \nnn.
2007-02-07 15:53:08 -02:00
Roberto Ierusalimschy
cf86576a83
new function luaL_tostring
2007-02-07 15:51:21 -02:00
Roberto Ierusalimschy
92dc64e121
more regularity in the use of quotes in error messages
2007-02-07 15:49:18 -02:00
Roberto Ierusalimschy
593bfc9668
should not manipulate NULL pointers (even without accessing them)
2007-02-07 15:48:52 -02:00
Roberto Ierusalimschy
850c60e81b
detail for windows
2007-02-07 15:46:20 -02:00
Roberto Ierusalimschy
3d480b04a5
more specific ident labels
2007-02-07 12:28:00 -02:00
Roberto Ierusalimschy
c36e2265d9
detail (tab->space)
2006-11-30 09:25:40 -02:00
Roberto Ierusalimschy
a68df3898d
detail
2006-11-22 09:43:47 -02:00
Roberto Ierusalimschy
4d7cfff6df
comments
2006-11-22 09:02:03 -02:00
Roberto Ierusalimschy
be822a5f1c
xpcall now may get arguments to function to be called
2006-10-24 16:46:12 -03:00
Roberto Ierusalimschy
9f5a052c27
error message
2006-10-24 10:31:48 -03:00
Roberto Ierusalimschy
fc875334fd
detail
2006-10-20 16:30:53 -03:00
Roberto Ierusalimschy
80a267b130
avoid $URL for ident; it is reserved in subversion
2006-10-17 17:00:07 -03:00
Roberto Ierusalimschy
3182ac69a7
towards 5.2 + detail in authors + avoiding reverse plicks
2006-10-17 16:59:04 -03:00
Roberto Ierusalimschy
dead3858b8
detail
2006-10-16 11:38:38 -03:00
Roberto Ierusalimschy
afa0d0ac0d
new constant LUA_OK
2006-10-10 14:40:17 -03:00
Roberto Ierusalimschy
742b8be0c1
detail
2006-10-10 14:39:00 -03:00
Roberto Ierusalimschy
285f926140
avoid using index 0 for free list of references (because it is not
...
as efficient as index 1...)
2006-09-25 12:35:00 -03:00
Roberto Ierusalimschy
3c8865cf66
detail
2006-09-22 17:24:38 -03:00
Roberto Ierusalimschy
569a326931
small optimization for ""..x
2006-09-19 11:06:45 -03:00
Roberto Ierusalimschy
d1ef7e0ec6
avoid local "pc" in interpreter loop (tricky optimization with no real gain)
2006-09-19 10:57:50 -03:00
Roberto Ierusalimschy
d513c3c66b
bug: os.date throws error when result is the empty string
2006-09-19 10:57:08 -03:00
Roberto Ierusalimschy
93d3c8450c
bug: string.format("%") reads past the string
2006-09-18 13:33:14 -03:00
Roberto Ierusalimschy
8667f29c3b
behavior of 'strchr(x, 0)' is ill defined.
2006-09-18 13:06:41 -03:00
Roberto Ierusalimschy
d22526ec30
'lua_strlen' is for compatibility only
2006-09-18 11:03:18 -03:00
Roberto Ierusalimschy
bd869c7b31
details
2006-09-14 15:42:28 -03:00
Roberto Ierusalimschy
d5a23dde90
little better error messages for internal arrays overflows
2006-09-14 09:59:06 -03:00
Roberto Ierusalimschy
a7c9e45c64
avoid trailing white spaces
2006-09-11 11:07:24 -03:00
Roberto Ierusalimschy
cedd2092eb
'coroutine.running' should return nil (instead of nothing) for main thread
2006-09-11 11:07:24 -03:00
Roberto Ierusalimschy
c473818017
avoid "too complex" conditional expression (some compilers get confused...)
2006-09-11 09:44:56 -03:00
Roberto Ierusalimschy
6087e67771
no more compatibility option for long strings
2006-08-30 10:19:58 -03:00
Roberto Ierusalimschy
93bf618504
BUG: there is only one C stack, so nCcalls must be global
2006-08-15 16:59:20 -03:00
Roberto Ierusalimschy
dfe2f1eeff
macros luai_num* take a state L (when available) as argument, to allow
...
them to generate errors (and other facilities)
2006-08-07 16:14:30 -03:00
Roberto Ierusalimschy
ca7e5b5cb6
wrong message error in some cases involving closures
2006-08-07 16:04:06 -03:00
Roberto Ierusalimschy
5019b2dd20
math.log now accepts an optional base
2006-08-07 16:01:56 -03:00
Roberto Ierusalimschy
33e7bc88f8
comment
2006-08-04 10:34:37 -03:00
Roberto Ierusalimschy
fa0c03aaa6
details
2006-07-14 13:22:24 -03:00
Roberto Ierusalimschy
3fa47c5dc1
bugs now are against 5.1.1
2006-07-13 11:37:36 -03:00
Roberto Ierusalimschy
0782416a74
bug: wrong limit for list constructors
2006-07-12 16:02:50 -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
c7b89dd280
small bug: should not use string after popping it
2006-07-03 17:16:49 -03:00
Roberto Ierusalimschy
74832b2a10
detail
2006-06-23 13:09:15 -03:00
Roberto Ierusalimschy
ee41bc03ab
details
2006-06-22 13:12:59 -03:00