Commit Graph

229 Commits

Author SHA1 Message Date
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
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
Mike Pall
7256690364 Add shadow frame link stack for trace recorder.
Simplifies snapshots. Prerequisite for pre-call snapshots.
Increases consistency for fast function calls, too.
2010-02-04 03:08:29 +01:00
Mike Pall
78f5e2ffd3 Fix unroll limit checks and frame depth adjustment for pcall. 2010-02-03 16:48:25 +01:00
Mike Pall
318e86c7eb Clean up frame depth checks and loop detection. 2010-02-03 14:55:56 +01:00
Mike Pall
305ecbbb84 Another loop formation test must check for return to lower frame. 2010-02-03 14:31:42 +01:00
Mike Pall
96e8a56260 Loop formation test must check for return to lower frame. 2010-01-29 15:07:40 +01:00
Mike Pall
8681b7330f Compile return to lower frame. Only for Lua frames right now. 2010-01-29 03:32:37 +01:00
Mike Pall
272b2f7368 Followup fix: set maxslot for continuation return. 2010-01-28 04:29:15 +01:00
Mike Pall
2ed0bb7f1e Drop obsolete frame shrinking after continuation return. 2010-01-28 04:20:20 +01:00
Mike Pall
a6565d21fa Fix recording of metamethod result adjustment. 2010-01-28 04:02:32 +01:00
Mike Pall
3aeb892262 Eliminate IR_FRAME. Replace with KGC and TRef/SnapEntry flags. 2010-01-27 03:50:29 +01:00
Mike Pall
d216cdb2b9 Add frame and continuation flags to TRef and SnapEntry. 2010-01-27 02:17:56 +01:00
Mike Pall
05d67cf566 Add missing check for return to lower frame. 2010-01-27 01:57:15 +01:00
Mike Pall
67ca399a30 Compress snapshots using a simple, extensible 1D-compression.
Typically reduces storage overhead for snapshot maps by 60%.
The extensible format is a prerequisite for the next redesign steps:
Eliminate IR_FRAME and implement return-to-lower-frame.
2010-01-26 21:49:04 +01:00
Mike Pall
34d84f8836 Fill gaps in frames (caused by metamethod calls) with nil.
Simplifies storing snapshots to stack.
2010-01-26 00:45:30 +01:00
Mike Pall
47f1bc80d8 Use dedicated type for snapshot map entry.
Preparatory work for compressed snapshots.
2010-01-25 19:51:52 +01:00
Mike Pall
a61df8efbe Decouple guard vs. INT check vs. TYPECHECK semantics for SLOAD. 2010-01-19 16:58:26 +01:00
Mike Pall
3100026b86 Error for blacklisted loop bytecodes has no info argument. 2010-01-16 02:04:12 +01:00
Mike Pall
99d153bef9 Improve alias analysis of upvalues using a disambiguation hash value.
All upvalue objects hold a disambiguation hash value now.
It's built from the parent prototype and the slot number.
Different hash values imply the upvalues cannot alias.
Same hash values don't imply anything (collision or different closures).
Upvalue disambiguation makes use of a reduced hash due to IR contraints.
2010-01-09 23:59:43 +01:00
Mike Pall
a33204ae5e Fix 32/64 bit portability issue with upval->v. 2010-01-09 21:11:35 +01:00
Mike Pall
4d9be5b8f8 Bump all copyright dates to 2010. 2010-01-09 14:28:11 +01:00
Mike Pall
374f534715 Logical 'not' must be sign-extended for address operands. 2009-12-29 01:38:26 +01:00
Mike Pall
6adab430af Adapt primary inbound calls in x64 interpreter.
Change argument order for lj_vm_cpcall() to simplify x64 interpreter.
2009-12-17 22:08:20 +01:00
Mike Pall
3f1f9e11f4 Fast forward to sync public repo.
Compile math.sinh(), math.cosh(), math.tanh() and math.random().
Compile various io.*() functions.
Drive the GC forward on string allocations in the parser.
Improve KNUM fuse vs. load heuristics.
Add abstract C call handling to IR.
2009-12-08 20:35:29 +01:00
Mike Pall
1d1fed48a0 RELEASE LuaJIT-2.0.0-beta2 2009-12-08 19:49:20 +01:00
Mike Pall
55b1695971 RELEASE LuaJIT-2.0.0-beta1 2009-12-08 19:46:35 +01:00