Commit Graph

75 Commits

Author SHA1 Message Date
Mike Pall
b3cf2c70f4 Decouple SLOAD type and optional conversion. 2010-10-11 21:13:37 +02:00
Mike Pall
ac76493df1 Specialize bytecode for pairs()/next() iterator. Speedup: 3.5x.
Parser predict pairs/next and emits specialized bytecode.
Bytecode is descpecialized at runtime if the prediction was wrong.
Store slot index in hidden control var to avoid key lookups.
2010-09-30 21:55:32 +02:00
Mike Pall
8dc76ee327 Add IR_VLOAD for vararg loads.
Also fixes the broken AA improvement in the last commit.
2010-09-14 19:58:27 +02:00
Mike Pall
b69c02eb68 Avoid unnecessary vararg loads. 2010-09-14 16:48:25 +02:00
Mike Pall
c88169dc46 Record y = select(x, ...) idiom. 2010-09-13 01:23:19 +02:00
Mike Pall
4ba0eb5f80 Record select(). 2010-09-13 01:21:44 +02:00
Mike Pall
847b9cf253 Record vararg expressions with varargs defined off-trace.
Add SLOAD variant to access the frame type/size.
2010-09-13 01:17:38 +02:00
Mike Pall
e32f7d96c1 Fix tailcalls from vararg functions. 2010-09-13 00:55:05 +02:00
Mike Pall
52f75e9a5c Fix off-by-one errors in maxslot calculation of trace recorder. 2010-09-12 03:14:17 +02:00
Mike Pall
4da03965c0 Record vararg expressions with known fixed number of results. 2010-09-12 02:42:02 +02:00
Mike Pall
c2c08ba9b3 Record calls to vararg functions.
This loop is now roughly 1000x faster than the Lua interpreter:
  local function f(a,b,...) end; for i=1,2e8 do f(1,2,i) end
Yet another silly microbenchmark -- I know.
2010-09-12 01:44:13 +02:00
Mike Pall
96957a4551 Turn some lua_State fields into 32 bit pointers.
lua_State now fits into one cache line on x64.
2010-09-09 12:28:17 +02:00
Mike Pall
844e40d700 PPC: Clean up masked shift/rotate target settings. 2010-08-29 12:52:20 +02:00
Mike Pall
d05873ee0a Abstract out pointer hash to hashrot(). Tune hash constants. 2010-07-21 22:06:38 +02:00
Mike Pall
5ff994fa37 Add weak guards. Emit TNEW/TDUP with a guard bit. 2010-05-08 18:59:59 +02:00
Mike Pall
41379126a2 Treat the tag of a TValue as unsigned everywhere. 2010-04-25 23:21:15 +02:00
Mike Pall
ef0904e80b Make metamethod names proper GC roots. 2010-04-25 18:35:47 +02:00
Mike Pall
2e24770ed3 Simplify management of current trace. Drop lazy save. 2010-04-25 13:53:33 +02:00
Mike Pall
721b73fecb Turn traces into true GC objects (GCtrace). 2010-04-25 03:32:29 +02:00
Mike Pall
ab45481199 No longer let the GC replace dead keys with the LJ_TDEADKEY tag.
Important: this changes the semantics of the write barrier!
Carefully read the big comment block in lj_obj.h
This helps HREFK key slot specialization and allows safely hoisting
HREF/HREFK across GC steps, too (fix for a barely reproducible bug).
Dead keys are only removed during a table resize (as before).
2010-04-21 01:45:58 +02:00
Mike Pall
932cda0fe3 Replace on-trace GC frame syncing with interpreter exit.
Need to sync GC objects to stack only during atomic GC phase.
Need to setup a proper frame structure only for calling finalizers.
Force an exit to the interpreter and let it handle the uncommon cases.
Finally solves the "NYI: gcstep sync with frames" issue.
2010-04-19 00:43:35 +02:00
Mike Pall
e4bca95451 Generate EQ(HREF, niltv) for load path, too (better CSE). 2010-03-28 06:49:09 +02:00
Mike Pall
69df01efb2 Fix precondition check for NEWREF.
A check for nil value is not enough. Must check for ptr == niltv.
2010-03-28 03:34:18 +02:00
Mike Pall
51c14bf1c8 Avoid snapshots for returns to known callers. 2010-03-21 16:01:44 +01:00
Mike Pall
c4727220e8 Add array bounds check elimination (-Oabc, on by default). 2010-03-15 17:02:53 +01:00
Mike Pall
24402ede04 Reorganize scalar evolution analysis. 2010-03-15 16:23:02 +01:00
Mike Pall
c56d791316 Fix handling of bad argument types in recorder. 2010-03-09 19:03:43 +01:00
Mike Pall
f49649d005 Fix recording of getmetatable() for non-tables. 2010-03-09 17:49:13 +01:00
Mike Pall
6e6034e809 Avoid tracing the nil return case of tonumber(). 2010-03-09 03:47:49 +01:00
Mike Pall
e38fbb3d0a Fix assertion in rec_check_slots. 2010-03-07 14:32:50 +01:00
Mike Pall
5fdb6e2e20 Fix 64 bit conversion warning. 2010-03-03 04:25:48 +01:00
Mike Pall
e7b737aa12 Implement down-recursion. 2010-03-01 06:45:30 +01:00
Mike Pall
4e73488985 Fix 64 bit conversion warnings. 2010-02-24 20:02:20 +01:00
Mike Pall
e46f4c8a11 Fix 64 bit portability problem in rec_ret(). 2010-02-24 05:29:46 +01:00
Mike Pall
8ae2f9feaa Randomize penalties for aborts and add blacklisting. 2010-02-23 19:41:32 +01:00
Mike Pall
659ea9de7b Ensure function and all args have a reference for call recording.
In practice this is only needed after a return to a lower frame.
2010-02-22 17:37:26 +01:00
Mike Pall
3336434aa0 Fix TRef for (dummy) 2nd arg of __len metamethod. 2010-02-22 17:33:39 +01:00
Mike Pall
86494c783d Back out history buffer for tailcall counts.
Use an aggregate counter independent of frame depth.
2010-02-22 16:57:59 +01:00
Mike Pall
19af483166 Add region selection for up-recursion and tail-recursion. 2010-02-22 14:35:47 +01:00
Mike Pall
bbe7d818d9 Allow linking to already compiled functions. 2010-02-18 19:37:30 +01:00
Mike Pall
b11eeab906 Use a limited history buffer for tailcall counts while recording. 2010-02-18 19:32:13 +01:00
Mike Pall
59f54be9d3 Update trace recorder infrastructure for hot calls. 2010-02-18 06:07:31 +01:00
Mike Pall
2b22b9e710 Drop obsolete shadow frame link stack. 2010-02-18 03:19:46 +01:00
Mike Pall
265a24b978 Add more assertions to compare the recorder state and the VM state. 2010-02-18 02:49:08 +01:00
Mike Pall
00ad80c9e4 Clear frame gaps in recorder to avoid resurrecting previous refs. 2010-02-18 02:45:03 +01:00
Mike Pall
c225ee8db4 Split CALL/FUNC recording.
Record __call resolving and specialization for CALL* bytecodes.
Record argument adjustment and fast functions for FUNC* bytecodes.
Avoids all pending/immediate decisions for chained fast functions.
Cleaner semantics for pcall(), xpcall() and __tostring metamethod.
Prerequisite to drop the shadow frame link stack again.
2010-02-16 04:04:16 +01:00
Mike Pall
1288e04186 Add missing FORI coercions in recorder. 2010-02-15 01:51:41 +01:00
Mike Pall
b6e4fde0dc Improve FOR loop const specialization and integerness checks. 2010-02-15 01:07:30 +01:00
Mike Pall
c93138b59e Major redesign of function call handling.
Drop call gates. Use function headers, dispatched like bytecodes.
Emit BC_FUNCF/BC_FUNCV bytecode at PC 0 for all Lua functions.
C functions and ASM fast functions get extra bytecodes.
Modify internal calling convention: new base in BASE (formerly in RA).
Can now use better C function wrapper semantics (dynamic on/off).
Prerequisite for call hooks with zero-overhead if disabled.
Prerequisite for compiling recursive calls.
Prerequisite for efficient 32/64 bit prototype guards.
2010-02-13 04:51:56 +01:00
Mike Pall
c8d55e8506 32/64 bit memory ref cleanup, part 1: GCproto ->bc and ->k. 2010-02-05 00:07:32 +01:00