Commit Graph

183 Commits

Author SHA1 Message Date
Mike Pall
23932a6c8b Use 0/1 macro for Lua 5.2 compatibility. 2012-09-12 11:20:47 +02:00
Mike Pall
751cd9d821 Don't constify upvalues that may retain large amounts of memory. 2012-08-28 15:24:53 +02:00
Mike Pall
3636a720a5 Turn loads from immutable upvalues into constants. 2012-07-20 18:54:52 +02:00
Mike Pall
afeb4e2c51 Handle initial snapshot for side traces in lj_snap.c only. 2012-07-02 22:52:15 +02:00
Mike Pall
7ae3832f20 Move snapshot replay for side traces to lj_snap.c. 2012-07-02 13:37:55 +02:00
Mike Pall
10ef109eef Bump copyright date to 2012. 2012-01-23 22:42:42 +01:00
Mike Pall
c142b6c53e FFI: Record C function calls with bool return values. 2011-11-25 19:36:35 +01:00
Mike Pall
cecbe3c15f Specialize to prototype for non-monomorphic functions.
Solves the trace-explosion problem with closure-heavy programming.
2011-11-20 19:16:40 +01:00
Mike Pall
cc7a12be93 Count frames with same prototype in call unroll limit check. 2011-11-20 17:59:41 +01:00
Mike Pall
dc2a39e46d Get rid of snap->depth. 2011-11-20 13:23:25 +01:00
Mike Pall
78cc9c889d Record missing FORI slot loads (e.g. after return to lower frame). 2011-08-21 15:08:27 +02:00
Mike Pall
05ef03e2d0 Don't bother to chain NOPs. 2011-08-11 22:04:38 +02:00
Mike Pall
64dbe7d929 Return to lower frame via interpreter for unhandled cases.
E.g. spontaneous upcalls from C are now compiled.
2011-06-29 01:53:39 +02:00
Mike Pall
deeb8196c4 Reorganize trace linking and track link types. 2011-06-28 23:23:34 +02:00
Mike Pall
4df40a228f Fix recording of loops with instable directions in side traces. 2011-06-20 21:51:31 +02:00
Mike Pall
31d566428f From Lua 5.2: __len for tables. Needs -DLUAJIT_ENABLE_LUA52COMPAT. 2011-06-20 20:45:41 +02:00
Mike Pall
b6a7fc5330 Cleanup prototype flags. 2011-06-09 13:54:40 +02:00
Mike Pall
8c5935000d Add narrowing of modulo operator. 2011-06-03 18:48:02 +02:00
Mike Pall
8dd09d5041 DUALNUM: Fix missing type check for loop index slot. 2011-06-01 00:49:29 +02:00
Mike Pall
138f54352a Split up FP IR instructions with SPLIT pass for soft-float targets. 2011-05-22 17:44:58 +02:00
Mike Pall
919ba5fd74 Add missing guard to for loop argument conversion. 2011-05-22 16:47:55 +02:00
Mike Pall
effdfda673 Move IR_CALL* definitions to lj_ircall.h. 2011-05-22 16:28:43 +02:00
Mike Pall
b79cdba3a0 Tuning loop unrolling heuristics again. 2011-05-10 16:55:23 +02:00
Mike Pall
fb8b87e818 More tuning of loop unrolling heuristics. 2011-05-04 23:21:46 +02:00
Mike Pall
b4006ba9a8 Fix stack slot updates for down-recursion. 2011-05-04 21:34:21 +02:00
Mike Pall
139175f8c4 Tune loop unrolling heuristics. Increase trace recorder limits. 2011-05-03 21:14:18 +02:00
Mike Pall
9ea679410c Workaround to compile with Clang. Fix Clang warnings. 2011-04-19 17:12:41 +02:00
Mike Pall
23f847f4ed Optimize lookups in empty proxy tables. 2011-04-10 21:43:21 +02:00
Mike Pall
d85b7e636e Fix recording of JLOOP with higher maxslot. 2011-04-10 18:00:08 +02:00
Mike Pall
7088abce8f DUALNUM: Fix narrowing of unary minus. 2011-03-19 17:46:10 +01:00
Mike Pall
dcbae09b1d DUALNUM: Narrow unary minus. 2011-03-15 18:14:18 +01:00
Mike Pall
bfce3c1127 DUALNUM: Handle integer type in JIT compiler. 2011-03-10 01:57:24 +01:00
Mike Pall
54978e481b DUALNUM: Make overflow guards weak. Add IR_USE and IR_MULOV. 2011-03-07 20:21:38 +01:00
Mike Pall
8eb09fe820 Suppress recording of retried fast functions. 2011-03-07 20:03:38 +01:00
Mike Pall
4c97cc7730 Eliminate dead slots in snapshots using bytecode data-flow analysis. 2011-02-22 22:39:12 +01:00
Mike Pall
4dca589af0 Add workaround for lj_meta_tset() newkey inconsistency. 2011-02-15 01:02:08 +01:00
Mike Pall
c39ca7c35b FFI: Record ffi.abi(). 2011-02-08 00:09:33 +01:00
Mike Pall
bf05209e14 FFI: Optimize snapshots for cdata comparisons. 2011-02-05 18:54:08 +01:00
Mike Pall
da3f256a52 Fix metamethod comparisons triggered by BC_ISEQP/BC_ISNEP. 2011-02-05 16:32:08 +01:00
Mike Pall
223d85aa06 Treat metatables of special userdata objects as immutable. 2011-02-05 14:09:50 +01:00
Mike Pall
6bce6b118e Add compile-time option LUAJIT_ENABLE_CHECKHOOK. Disabled by default.
This checks for asynchronously set hooks from compiled code.
2011-01-19 02:05:37 +01:00
Mike Pall
925050fe3f Differentiate between IR_KPTR and IR_KKPTR.
IR_KPTR holds a const pointer to possibly non-const content.
IR_KKPTR holds a const pointer to definitely const content.
Note that only content known by the VM to be const qualifies.
Content tagged as const by users (e.g. const char *) doesn't.
2011-01-19 00:40:03 +01:00
Mike Pall
751eff9f97 Cleanup and fix trace flush logic. 2011-01-18 21:08:23 +01:00
Mike Pall
f385af7084 FFI: Record 64 bit integer comparisons and pointer comparisons. 2011-01-17 01:23:04 +01:00
Mike Pall
66ba1e68aa Add trace recorder infrastructure for instruction post-processing. 2011-01-17 01:20:10 +01:00
Mike Pall
2940ab023a Fix assertion. 2011-01-16 19:24:50 +01:00
Mike Pall
0ec7f5ed92 FFI: Add 64 bit integer comparisons and pointer comparisons. 2011-01-13 02:35:29 +01:00
Mike Pall
06f99fc3df Bump copyright date to 2011. 2011-01-09 17:12:53 +01:00
Mike Pall
b2c74c52cc FFI: Add support for cdata constants to IR. 2011-01-02 22:21:10 +01:00
Mike Pall
1716540c55 Refactoring of conversion ops, part 4: use CONV instead of TOINT/TONUM.
Also narrow CONV.int.num and CONV.i64.num.
2010-12-31 03:56:30 +01:00
Mike Pall
2a917a9d83 FFI: Treat cdata metatable+methods as immutable in trace recorder. 2010-12-08 02:02:21 +01:00
Mike Pall
5a13fa69d9 Add IR_KINT64. 2010-12-05 22:12:31 +01:00
Mike Pall
6a7605ec85 Rename IRT_PTR to IRT_P32. 2010-12-05 18:59:34 +01:00
Mike Pall
e7f8cc964e Split off fast function recording to lj_ffrecord.c. 2010-12-05 17:12:34 +01:00
Mike Pall
18fbf86c9e Improve unrolling heuristics for non-looping inner loops. 2010-11-25 11:42:17 +01:00
Mike Pall
57cd5026eb Disable Lua 5.2 features by default. See -DLUAJIT_ENABLE_LUA52COMPAT. 2010-11-19 17:00:11 +01:00
Mike Pall
ba602c9578 Add support for __pairs and __ipairs metamethods (from Lua 5.2). 2010-11-18 00:23:24 +01:00
Mike Pall
5391a5f5b1 Fix recording of y = select(n, ...) for non-int indexes. 2010-10-11 21:52:22 +02:00
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