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
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
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
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
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
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
03c6a05ec8
no more nil-in-table
2018-04-04 11:23:41 -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
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
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
c80c7a49fd
details (comments)
2018-02-21 13:28:12 -03:00
Roberto Ierusalimschy
ca6fe7449a
userdata can have multiple user values
2018-02-20 13:52:50 -03:00
Roberto Ierusalimschy
e2b15aa21d
janitor work on casts
2018-01-28 13:13:26 -02:00
Roberto Ierusalimschy
6710a2b0ef
detail (comment)
2018-01-28 10:07:53 -02:00
Roberto Ierusalimschy
599f1742c6
detail (typo in comments)
2017-11-23 17:29:04 -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
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
c5482468fd
baby steps to remove 'CallInfo': keeping 'L->func' correct
2017-10-31 15:54:35 -02: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
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
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
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
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
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
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
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
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
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
ee5edb6b68
macros 'getaddrstr' and 'getstr' unified (they do the same thing)
2015-09-17 12:51:05 -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
6556fcfe5a
small janitor work
2015-09-08 12:49:25 -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
6ffe006f5c
detail (removed unused macro VARBITS)
2015-04-02 18:10:53 -03:00
Roberto Ierusalimschy
2b37f2150e
comments
2015-03-14 14:58:57 -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
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
3c55790ebe
'setkey' -> 'setnodekey' (to avoid conflicts with POSIX)
2015-01-05 11:52:37 -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
bdf566a8a3
`name' in comments changed to 'name'
2014-10-25 09:50:46 -02:00
Roberto Ierusalimschy
34b6664dcb
better to use 'long' to represent UTF-8 code points
2014-10-01 08:52:33 -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
34ac039fb8
new macro 'cvt2str' to better control whether numbers are convertible
...
to strings
2014-07-30 11:00:14 -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
bb12903120
type 'Udata' refers directly to structure inside the union (union
...
used only for aligning purposes now)
2014-07-18 11:46:47 -03:00
Roberto Ierusalimschy
ca41b43f53
type 'TString' refers directly to the structure inside the union
...
(union used only for size purposes)
2014-07-18 10:36:14 -03:00
Roberto Ierusalimschy
56137d58ff
added check for conversion 'obj2gco' (and corrections for small
...
problems detected by this check)
2014-07-18 09:17:54 -03:00
Roberto Ierusalimschy
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
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
5ebdd326b6
detail (to avoid warnings of unused variable)
2014-05-29 16:30:07 -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
77e7ebca0a
better alignments (for 64-bit arquitectures) for structures 'Table' and
...
'TString'
2014-05-07 08:12:51 -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
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
ffa43df3cd
'setnvalue' -> 'setfltvalue' (for consitency with 'fltvalue')
2014-04-29 15:14:16 -03:00
Roberto Ierusalimschy
c86b9da022
userdata can have any Lua value as uservalue
2014-02-19 10:52:42 -03:00
Roberto Ierusalimschy
4ea60463f5
UTF-8 encoding exported as format '%U' in 'lua_pushfstring'
2014-02-06 13:59:24 -02:00
Roberto Ierusalimschy
cac1ebd1e0
detail ('ttisuserdata' renamed to 'ttisfulluserdata')
2013-12-04 10:15:22 -02: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
af35c7f398
upvalues collected by reference count
2013-08-27 15:53:35 -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
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
36e8771076
'luaO_str2int' more generic: accepts white spaces around the numeral
...
and handles signal
2013-05-14 12:59:04 -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
67532d5a10
constant folding and API arithmetic with integers
2013-05-02 09:37:24 -03:00
Roberto Ierusalimschy
00744a2729
'luaO_arith' -> 'luaO_numarith'
2013-04-29 13:57:48 -03:00
Roberto Ierusalimschy
1294b09d8e
first implementation of literal integers (no constant folding yet)
2013-04-16 15:46:28 -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
8f8665fffa
'ttypenv' -> 'ttnov'
2013-04-12 16:07:09 -03:00
Roberto Ierusalimschy
cf160abcf9
no more macro 'changenvalue'
2012-09-11 15:21:44 -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
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
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
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
87cf2bf711
extra comments about what fields are optional debug information
2011-10-31 15:48:22 -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
87912786af
dead objects are not collectable.
2011-09-24 18:12:01 -03:00
Roberto Ierusalimschy
9e89a55a4f
NILCONSTANT also depends no endianess (with NaN trick)
2011-07-04 17:29:02 -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
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
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
2a59a999d4
yet another macro abstracting TValue representation
2011-05-26 14:12:31 -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
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
a958b711f5
cleaner scheme of bits for variant types (light C functions) and
...
collectable types
2011-04-07 13:11:57 -03:00