Commit Graph

107 Commits

Author SHA1 Message Date
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
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
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
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
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
02ed0b2c30 in 'luaD_poscall', there is no need to compute 'firstResult' when 'nres==0' 2018-05-22 09:02:36 -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
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
51280ef2ad call hooks for Lua functions called by 'luaV_execute' 2018-02-06 17:16:56 -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
bfb88e99e9 'luaD_growstack' cannot raise any errors when 'raiseerror' is
false (+ some comments)
2017-12-11 10:43:40 -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
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
14c3aa12b5 more direct implementation for tail calls. 2017-11-21 12:18:03 -02:00
Roberto Ierusalimschy
ad0704e40c back to 'CallInfo' (no gains with its removal) 2017-11-07 11:25:26 -02:00
Roberto Ierusalimschy
93fd67b793 no more 'CallInfo' structure 2017-11-04 10:57:02 -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
5c8770f896 back to old-style vararg system (with vararg table collecting extra
arguments)
2017-05-13 10:04:33 -03:00
Roberto Ierusalimschy
c0836dda74 avoid empty macro arguments (invalid in C89) 2015-12-21 11:02:14 -02:00
Roberto Ierusalimschy
c5112f7b15 details (comments) 2015-11-23 09:30:45 -02:00
Roberto Ierusalimschy
d103312661 details (typos in comments) 2015-11-19 17:16:22 -02:00
Roberto Ierusalimschy
9a5d6aedb7 trying to optimize a little 'luaD_poscall' 2015-11-13 11:24:26 -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
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
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
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
bdf566a8a3 `name' in comments changed to 'name' 2014-10-25 09:50:46 -02:00
Roberto Ierusalimschy
3617e04e97 'lua_load' has an extra argument 'mode' 2011-11-29 13:55:08 -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
e0f9d1c8f5 removed export of function only for coco 2009-12-17 10:28:57 -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
b40a38a8ac remove declaration of removed function 2009-11-19 14:24:41 -02: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
4a67e48611 new macro 'condmovestack' instead of 'condhardstacktests' 2009-06-08 16:35:59 -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
ba484b9eb1 yielding across lua_call (first version) 2009-03-10 14:14:37 -03:00
Roberto Ierusalimschy
fdbb243ff9 first steps towards yielding through longjump 2008-08-13 14:02:42 -03:00
Roberto Ierusalimschy
2a84c29bc3 comment about exported function not used by Lua 2008-07-03 11:24:36 -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
98296f6b45 some bugs related to stack reallocation 2005-08-24 13:15:49 -03:00
Roberto Ierusalimschy
23b79c5945 small changes to facilitate external C coroutines 2005-08-22 16:58:29 -03:00
Roberto Ierusalimschy
6fcd334ca0 small improvements 2005-08-22 15:54:49 -03:00
Roberto Ierusalimschy
8718fda9b2 added LUAI_FUNC to functions not in the API 2005-04-25 16:24:10 -03:00
Roberto Ierusalimschy
0de2065f4e tighter tests for stack overflow 2004-09-08 11:23:09 -03:00
Roberto Ierusalimschy
0bda88e6cd small steps towards yields in iterators and tag methods 2004-05-14 16:25:09 -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
8332d5c8a5 parser fully reentrant(!) 2003-08-27 18:01:44 -03:00