Commit Graph

329 Commits

Author SHA1 Message Date
Roberto Ierusalimschy
1f259be52a 'getcode' -> 'getinstruction' 2016-01-05 14:22:37 -02:00
Roberto Ierusalimschy
b12b635a90 more refactoring 2016-01-04 11:40:57 -02:00
Roberto Ierusalimschy
384d1b47b0 comments (*lots* of them) + asserts 2015-12-18 11:53:36 -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
d103312661 details (typos in comments) 2015-11-19 17:16:22 -02:00
Roberto Ierusalimschy
82129b9266 use macro 'hasjumps' to test whether expression has jumps... 2015-10-26 12:27:47 -02: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
e723c75c02 details (avoid 'lint' warnings) 2015-03-28 16:14:47 -03: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
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
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
5fbd40dbe5 'x//y' extended to floats 2014-11-21 10:15:57 -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
4542fb9f78 comments (a few extra quotes around identifiers) 2014-10-30 16:53:28 -02:00
Roberto Ierusalimschy
4b526045fa comment 2014-10-28 15:27:41 -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
bdf566a8a3 `name' in comments changed to 'name' 2014-10-25 09:50:46 -02:00
Roberto Ierusalimschy
42ff788e53 comments 2014-05-08 15:58:46 -03:00
Roberto Ierusalimschy
ffa43df3cd 'setnvalue' -> 'setfltvalue' (for consitency with 'fltvalue') 2014-04-29 15:14:16 -03:00
Roberto Ierusalimschy
e98ba351ce n^-m gives float result (instead of error) 2014-04-27 11:41:11 -03:00
Roberto Ierusalimschy
f61ceee708 LUAI_FUNC is being used only in header files 2014-04-02 13:44:42 -03:00
Roberto Ierusalimschy
607be77ec8 some details to avoid warnings 2014-04-01 11:39:55 -03:00
Roberto Ierusalimschy
da4811238a details (typos in comments) 2014-03-21 10:52:33 -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
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
19ad78d713 C++ needs casts for arithmetic with enums 2014-02-06 17:55:55 -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
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
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
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
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
1f2b82bf25 correct way to avoid compile-time errors in integer divisions 2013-05-06 14:22:16 -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
a2f5c28a80 new operation '//' (integer division) 2013-04-26 10:08:29 -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
1294b09d8e first implementation of literal integers (no constant folding yet) 2013-04-16 15:46:28 -03:00
Roberto Ierusalimschy
7a543cfae6 2013-04-15 12:43:34 -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
53480f1163 details (remove of some extra spaces) 2012-08-14 15:12:34 -03:00
Roberto Ierusalimschy
ca458f1f52 'luaK_goiffalse' exported 2011-08-30 13:26:41 -03:00
Roberto Ierusalimschy
51471ba748 comments about use of 'luaH_set' 2011-08-15 16:41:58 -03:00
Roberto Ierusalimschy
5ab6d36d99 no more field 'L' in 'FuncState' 2011-07-27 15:07:37 -03:00
Roberto Ierusalimschy
32a12e2f3f detail (cleaned whitespaces at end of lines) 2011-07-15 09:50:29 -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
d120ec29ca bug in OP_SELF when method name goes to a register 2011-04-28 11:00:11 -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
427ee519db new instruction OP_LOADKX (to replace OP_LOADK with extra argument) 2011-04-07 15:14:12 -03: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
026a7e92be bug in some short-circuit optimizations 2011-01-31 12:28:41 -02: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
a71c5f6f53 typo in comments 2010-06-30 11:11:17 -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
25c557ec63 first version of _ENV; no more global variables 2010-03-12 16:14:06 -03:00
Roberto Ierusalimschy
0fe2576a39 new instructions to optimize indexing on upvalues 2010-02-26 17:40:29 -03:00
Roberto Ierusalimschy
cef96b73e1 added casts from int to enumerations to follow C++ rules 2010-01-11 15:38:30 -02: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
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
d7872dcf91 small optimization (reorder of BinOpr enum to unify some cases
in switches)
2009-06-18 13:35:05 -03:00
Roberto Ierusalimschy
96fa34ec32 constant folding uses 'luaO_arith' to perform basic operations 2009-06-17 14:49:09 -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
2598138ece new function 'luaK_codek' (detail) 2009-06-10 13:52:03 -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
a4d3080fe3 SETLIST extra argument now is an "instruction" (OP_EXTRAARG) 2008-04-02 14:38:54 -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
5f4f0d4a63 no more optimization to avoid LOADNIL at function start 2007-03-27 11:11:38 -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
742b8be0c1 detail 2006-10-10 14:39:00 -03:00
Roberto Ierusalimschy
3c8865cf66 detail 2006-09-22 17:24:38 -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
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
ee41bc03ab details 2006-06-22 13:12:59 -03:00
Roberto Ierusalimschy
1ae0b6c0bf BUG: should copy the union, not (some of) its fields 2006-03-21 16:28:49 -03:00
Roberto Ierusalimschy
c505f341d6 small changes in casts 2005-12-22 14:19:56 -02:00
Roberto Ierusalimschy
db724e14e0 new macro luai_numisnan 2005-11-25 11:29:32 -02:00
Roberto Ierusalimschy
521a452f28 'mod' may also raise an error when applied to zero 2005-11-16 09:55:27 -02:00
Roberto Ierusalimschy
e43e95553f more privacy 2005-11-08 17:44:31 -02:00
Roberto Ierusalimschy
8e48ebb638 no more L in numer-operator macros (some functions that use those macros
have no access to L)
2005-10-24 15:37:52 -02:00
Roberto Ierusalimschy
e9b06c506f small optimization 2005-10-13 09:21:51 -03:00
Roberto Ierusalimschy
e251e84e0f constant folding optimizations 2005-10-09 17:05:48 -03:00
Roberto Ierusalimschy
5dbb870815 small optimization for local declarations without initializations 2005-09-30 11:23:33 -03:00
Roberto Ierusalimschy
3b19af44b0 new method to handle tests without values (negative values) 2005-08-29 17:49:21 -03:00
Roberto Ierusalimschy
074352911f new coding for while and repeat (with new scoping for repeat) 2005-08-17 15:32:09 -03:00
Roberto Ierusalimschy
746a1d612b small bug (type error) 2005-06-07 15:53:45 -03:00
Roberto Ierusalimschy
f21e9c172f details 2005-05-20 12:53:42 -03:00
Roberto Ierusalimschy
04bbd01171 new operation *t (for size of t) (may yet be removed...) 2005-03-16 13:59:21 -03:00
Roberto Ierusalimschy
370d31a559 luac´ -> luai' (to avoid confusion with other luac stuff) 2005-03-09 13:28:07 -03:00
Roberto Ierusalimschy
f8df21bd20 `luaconf.h´ exports all its definitions always (so all of them
must have a lua/LUA prefix).
2005-03-08 17:10:05 -03:00
Roberto Ierusalimschy
8ddfe3df29 macros for all arithmetic operations over lua_Numbers 2005-01-10 16:17:39 -02:00
Roberto Ierusalimschy
c78940f21a static names do not need `luaX_' prefix 2004-12-03 18:50:25 -02:00
Roberto Ierusalimschy
5ee87acd6b small optimization for boolean constants + new format for SETLIST opcode 2004-10-04 16:01:53 -03:00
Roberto Ierusalimschy
4b12eff801 small correction (less conservative write barrier for tables) 2004-08-24 17:09:11 -03:00
Roberto Ierusalimschy
31e48f26ed small bug 2004-07-16 10:30:53 -03:00
Roberto Ierusalimschy
02a2c01ccd new way to code RK values 2004-06-29 15:49:02 -03:00
Roberto Ierusalimschy
616438fe9a new way to use vararg' parameters (with ...') 2004-05-31 15:51:50 -03:00
Roberto Ierusalimschy
b4cd38ba6c new scheme for configuration through `luaconf.h' 2004-04-30 17:13:38 -03:00
Roberto Ierusalimschy
47fc57a252 TObject' renamed to TValue' + other name changes and better assertions
for incremental garbage collection
2003-12-10 10:13:36 -02:00
Roberto Ierusalimschy
df429f163a First version of incremental GC 2003-12-09 14:56:11 -02:00
Roberto Ierusalimschy
8bc6c68021 details 2003-11-19 17:59:18 -02:00
Roberto Ierusalimschy
8332d5c8a5 parser fully reentrant(!) 2003-08-27 18:01:44 -03:00
Roberto Ierusalimschy
c116dcb92b better information about instruction behavior (use of arguments) 2003-05-14 09:09:12 -03:00
Roberto Ierusalimschy
0d88545b82 warnings from several compilers (mainly typecasts when lua_Number is float) 2003-04-03 10:35:34 -03:00
Roberto Ierusalimschy
e1a424e8a3 avoid the identifier index' (clashes with BSD index' function) 2003-02-27 09:33:07 -03:00
Roberto Ierusalimschy
73517e86b0 OP_TFORLOOP uses extra stack space 2002-12-11 10:34:22 -02:00
Roberto Ierusalimschy
27c6b4d422 each .c file defines its own name 2002-12-04 15:38:31 -02:00
Roberto Ierusalimschy
41fd639cab documentation for write barriers 2002-11-14 14:15:53 -02:00
Roberto Ierusalimschy
c196348717 in case of memory allocation errors, sizecode and sizelineinfo can
be different
2002-10-16 17:40:58 -03:00
Roberto Ierusalimschy
fbc23d0245 details 2002-08-21 15:56:33 -03:00
Roberto Ierusalimschy
6c283b2f4f new simetric format for ABC instructions, to avoid exchanging operands
for `commutative' operators
2002-08-20 17:03:05 -03:00
Roberto Ierusalimschy
5037196f6f new macros `ttis*' 2002-08-05 11:50:39 -03:00
Roberto Ierusalimschy
864c96f36c new fallback for equality `__eq' 2002-06-13 10:39:55 -03:00
Roberto Ierusalimschy
eeab473fc8 new fallback __le (less equal), for partial order 2002-06-12 11:56:22 -03:00
Roberto Ierusalimschy
cfff013586 detail 2002-06-03 14:47:18 -03:00
Roberto Ierusalimschy
46c471d7e9 new `__newindex' eventfield 2002-05-27 17:35:40 -03:00
Roberto Ierusalimschy
1c328a191a no more `global' declarations 2002-05-14 14:52:22 -03:00
Roberto Ierusalimschy
b55fded18c details about jump optimization 2002-05-13 10:07:48 -03:00
Roberto Ierusalimschy
2dadc81822 cleaner implementation of code generation for jumps 2002-05-10 16:22:11 -03:00
Roberto Ierusalimschy
b487975344 optimization for `while' (first version) 2002-05-10 14:02:32 -03:00
Roberto Ierusalimschy
78b40bf57d `skip' instructions must be followed by a jump 2002-05-09 11:14:34 -03:00
Roberto Ierusalimschy
dea6b6da94 new function lua_vpushstr' to replace uses of sprintf' 2002-05-07 14:36:56 -03:00
Roberto Ierusalimschy
0dbf0c5953 new format for test intructions (handle NaN correctly) 2002-05-06 12:51:41 -03:00
Roberto Ierusalimschy
9b38a696d5 avoid names that differ only in capitalization 2002-04-24 17:07:46 -03:00
Roberto Ierusalimschy
3ee1efa7b2 some simplifications 2002-04-22 11:37:09 -03:00
Roberto Ierusalimschy
f1f271ae76 details 2002-04-10 15:05:08 -03:00
Roberto Ierusalimschy
13ab5a6bb1 details 2002-04-02 17:43:08 -03:00
Roberto Ierusalimschy
801aaf37b1 simpler implementation for line information 2002-03-25 14:47:14 -03:00
Roberto Ierusalimschy
2626708b72 details 2002-03-21 17:31:43 -03:00
Roberto Ierusalimschy
bd8b9c94b3 generic for (with any number of control variables) 2002-03-08 16:10:32 -03:00
Roberto Ierusalimschy
8a1a512c64 lu_byte is enough for those fields (maxstack < 256) 2002-03-05 09:42:47 -03:00
Roberto Ierusalimschy
38b0e6128d simpler implementation for `for' loops 2002-02-05 20:39:12 -02:00
Roberto Ierusalimschy
74907fb71e OP_LOADINT can be done by OP_LOADK 2002-01-25 19:50:39 -02:00
Roberto Ierusalimschy
b38e594ed7 small improvements 2002-01-18 15:39:40 -02:00
Roberto Ierusalimschy
7ab7703b53 cleaner semantics for test instructions (skips) 2002-01-16 20:03:57 -02:00
Roberto Ierusalimschy
f083812c02 first implementation of coroutines 2002-01-09 20:02:47 -02:00
Roberto Ierusalimschy
9aff171f3b new type `boolean' 2001-12-11 20:48:44 -02:00
Roberto Ierusalimschy
72659a0605 no more explicit support for wide-chars; too much troble... 2001-11-28 18:13:13 -02:00
Roberto Ierusalimschy
abdbe883a8 first implementation of unrestricted static scoping 2001-09-07 14:39:10 -03:00
Roberto Ierusalimschy
e1d072571e better syntax for type casts 2001-08-31 16:46:07 -03:00
Roberto Ierusalimschy
8c8ad5f3ff better locality of assignment of table values 2001-08-30 17:56:43 -03:00