crawl:crawl-luajit.git
7 years agoMakefile: added install target and made verbosity optional crawl-201002
Steven Noonan [Sat, 27 Feb 2010 06:41:08 +0000 (22:41 -0800)]
Makefile: added install target and made verbosity optional

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
7 years agoDon't eliminate SLOAD restores across RETF.
Mike Pall [Tue, 23 Feb 2010 02:08:49 +0000 (03:08 +0100)]
Don't eliminate SLOAD restores across RETF.

Move restore-elimination logic into snapshot_slots().

7 years agoDo not patch parent exit for a stack check.
Mike Pall [Mon, 22 Feb 2010 20:21:52 +0000 (21:21 +0100)]
Do not patch parent exit for a stack check.

7 years agoEnsure function and all args have a reference for call recording.
Mike Pall [Mon, 22 Feb 2010 16:37:26 +0000 (17:37 +0100)]
Ensure function and all args have a reference for call recording.

In practice this is only needed after a return to a lower frame.

7 years agoFix TRef for (dummy) 2nd arg of __len metamethod.
Mike Pall [Mon, 22 Feb 2010 16:33:39 +0000 (17:33 +0100)]
Fix TRef for (dummy) 2nd arg of __len metamethod.

7 years agoBack out history buffer for tailcall counts.
Mike Pall [Mon, 22 Feb 2010 15:57:59 +0000 (16:57 +0100)]
Back out history buffer for tailcall counts.

Use an aggregate counter independent of frame depth.

7 years agoAdd region selection for up-recursion and tail-recursion.
Mike Pall [Mon, 22 Feb 2010 13:35:47 +0000 (14:35 +0100)]
Add region selection for up-recursion and tail-recursion.

7 years agoRefactor Lua stack handling in lj_asm.c.
Mike Pall [Sun, 21 Feb 2010 16:26:21 +0000 (17:26 +0100)]
Refactor Lua stack handling in lj_asm.c.

7 years agoEliminate redundant stack checks. Add checks for growing root traces.
Mike Pall [Sun, 21 Feb 2010 15:47:43 +0000 (16:47 +0100)]
Eliminate redundant stack checks. Add checks for growing root traces.

7 years agoRethrow errors from trace exit handling from the right C frame.
Mike Pall [Fri, 19 Feb 2010 02:13:48 +0000 (03:13 +0100)]
Rethrow errors from trace exit handling from the right C frame.

7 years agoAllow linking to already compiled functions.
Mike Pall [Thu, 18 Feb 2010 18:37:30 +0000 (19:37 +0100)]
Allow linking to already compiled functions.

7 years agoUse a limited history buffer for tailcall counts while recording.
Mike Pall [Thu, 18 Feb 2010 18:32:13 +0000 (19:32 +0100)]
Use a limited history buffer for tailcall counts while recording.

7 years agoAdapt bytecode patching/unpatching for hot calls.
Mike Pall [Thu, 18 Feb 2010 16:17:50 +0000 (17:17 +0100)]
Adapt bytecode patching/unpatching for hot calls.

7 years agoUpdate trace recorder infrastructure for hot calls.
Mike Pall [Thu, 18 Feb 2010 02:43:09 +0000 (03:43 +0100)]
Update trace recorder infrastructure for hot calls.

7 years agoFix some uses of tref_isint().
Mike Pall [Thu, 18 Feb 2010 02:24:18 +0000 (03:24 +0100)]
Fix some uses of tref_isint().

7 years agoDrop obsolete shadow frame link stack.
Mike Pall [Thu, 18 Feb 2010 02:19:46 +0000 (03:19 +0100)]
Drop obsolete shadow frame link stack.

7 years agoAdd more assertions to compare the recorder state and the VM state.
Mike Pall [Thu, 18 Feb 2010 01:49:08 +0000 (02:49 +0100)]
Add more assertions to compare the recorder state and the VM state.

7 years agoClear frame gaps in recorder to avoid resurrecting previous refs.
Mike Pall [Thu, 18 Feb 2010 01:45:03 +0000 (02:45 +0100)]
Clear frame gaps in recorder to avoid resurrecting previous refs.

7 years agoUpdate docs and changelog.
Mike Pall [Tue, 16 Feb 2010 23:47:55 +0000 (00:47 +0100)]
Update docs and changelog.

7 years agoJust disable JIT compiler for non-SSE2 CPUs instead of aborting.
Mike Pall [Tue, 16 Feb 2010 22:39:24 +0000 (23:39 +0100)]
Just disable JIT compiler for non-SSE2 CPUs instead of aborting.

7 years agoSplit CALL/FUNC recording.
Mike Pall [Tue, 16 Feb 2010 03:04:16 +0000 (04:04 +0100)]
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.

7 years agoImprove error reporting for traces aborted in non-Lua functions.
Mike Pall [Mon, 15 Feb 2010 21:44:23 +0000 (22:44 +0100)]
Improve error reporting for traces aborted in non-Lua functions.

7 years agoChange record vmevent parameters. Dump function id on FUNC*.
Mike Pall [Mon, 15 Feb 2010 21:26:33 +0000 (22:26 +0100)]
Change record vmevent parameters. Dump function id on FUNC*.

7 years agoUse a different marker for hot calls.
Mike Pall [Mon, 15 Feb 2010 17:04:06 +0000 (18:04 +0100)]
Use a different marker for hot calls.

7 years agoAdd generic function handling for debug modules.
Mike Pall [Mon, 15 Feb 2010 16:36:29 +0000 (17:36 +0100)]
Add generic function handling for debug modules.

Don't call record vmevent for non-Lua functions.

7 years agoMinor cleanup of trace event handling.
Mike Pall [Mon, 15 Feb 2010 15:41:52 +0000 (16:41 +0100)]
Minor cleanup of trace event handling.

7 years agoAdd missing FORI coercions in recorder.
Mike Pall [Mon, 15 Feb 2010 00:51:41 +0000 (01:51 +0100)]
Add missing FORI coercions in recorder.

7 years agoImprove FOR loop const specialization and integerness checks.
Mike Pall [Mon, 15 Feb 2010 00:07:30 +0000 (01:07 +0100)]
Improve FOR loop const specialization and integerness checks.

7 years agoImplement return hooks for Lua functions (zero-cost if disabled).
Mike Pall [Sun, 14 Feb 2010 19:48:33 +0000 (20:48 +0100)]
Implement return hooks for Lua functions (zero-cost if disabled).

7 years agoImplement call hooks (zero-cost if disabled).
Mike Pall [Sun, 14 Feb 2010 16:47:03 +0000 (17:47 +0100)]
Implement call hooks (zero-cost if disabled).

7 years agoMajor redesign of function call handling.
Mike Pall [Sat, 13 Feb 2010 03:51:56 +0000 (04:51 +0100)]
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.

7 years agoExtend scope of local vars in debug info beyond final return.
Mike Pall [Fri, 12 Feb 2010 15:17:42 +0000 (16:17 +0100)]
Extend scope of local vars in debug info beyond final return.

7 years agoFix dump of bytecode instructions with missing operands.
Mike Pall [Thu, 11 Feb 2010 19:59:00 +0000 (20:59 +0100)]
Fix dump of bytecode instructions with missing operands.

7 years agoMove dispatch tables out of GG_State struct.
Mike Pall [Thu, 11 Feb 2010 15:21:18 +0000 (16:21 +0100)]
Move dispatch tables out of GG_State struct.

7 years agoDrop frame clearing in exit handling and JIT compiled code.
Mike Pall [Thu, 11 Feb 2010 00:50:32 +0000 (01:50 +0100)]
Drop frame clearing in exit handling and JIT compiled code.

7 years agoSwitch to pre-initialized stacks. Drop frame clearing in interpreter.
Mike Pall [Thu, 11 Feb 2010 00:21:40 +0000 (01:21 +0100)]
Switch to pre-initialized stacks. Drop frame clearing in interpreter.

7 years agoReplace GCproto reference with bytecode PC in GCfuncL.
Mike Pall [Wed, 10 Feb 2010 20:45:57 +0000 (21:45 +0100)]
Replace GCproto reference with bytecode PC in GCfuncL.

7 years agoDrop bc field in GCproto since the bytecode is colocated.
Mike Pall [Mon, 8 Feb 2010 19:17:34 +0000 (20:17 +0100)]
Drop bc field in GCproto since the bytecode is colocated.

7 years agoFix constructor bytecode generation for conditional values.
Mike Pall [Mon, 8 Feb 2010 15:08:58 +0000 (16:08 +0100)]
Fix constructor bytecode generation for conditional values.

7 years agoReduce whitespace in lj_bcdef.h.
Mike Pall [Mon, 8 Feb 2010 04:35:18 +0000 (05:35 +0100)]
Reduce whitespace in lj_bcdef.h.

7 years agoRedesign of prototype generation, part 5: colocation of protoype arrays.
Mike Pall [Mon, 8 Feb 2010 04:30:57 +0000 (05:30 +0100)]
Redesign of prototype generation, part 5: colocation of protoype arrays.

7 years agoRedesign of prototype generation, part 4: late creation of prototype.
Mike Pall [Mon, 8 Feb 2010 04:29:47 +0000 (05:29 +0100)]
Redesign of prototype generation, part 4: late creation of prototype.

7 years agoRedesign of prototype generation, part 3: bc and lineinfo.
Mike Pall [Mon, 8 Feb 2010 04:28:57 +0000 (05:28 +0100)]
Redesign of prototype generation, part 3: bc and lineinfo.

Use a growable, per-chunk bytecode instruction/line stack.
Collect bc/lineinfo for prototype at the end.

7 years agoRedesign of prototype generation, part 2: late init of chunkname.
Mike Pall [Mon, 8 Feb 2010 04:27:43 +0000 (05:27 +0100)]
Redesign of prototype generation, part 2: late init of chunkname.

7 years agoRedesign of prototype generation, part 1: varinfo and uvname.
Mike Pall [Mon, 8 Feb 2010 04:26:52 +0000 (05:26 +0100)]
Redesign of prototype generation, part 1: varinfo and uvname.

Use a growable, per-chunk variable stack.
Collect varinfo/uvname for prototype at the end.

7 years agoMajor cleanup of bytecode parser.
Mike Pall [Sat, 6 Feb 2010 07:18:32 +0000 (08:18 +0100)]
Major cleanup of bytecode parser.

7 years agoUpdate .gitignore.
Mike Pall [Sat, 6 Feb 2010 07:18:20 +0000 (08:18 +0100)]
Update .gitignore.

7 years agoMove bytecode offsets from lj_vm.* to generated header.
Mike Pall [Fri, 5 Feb 2010 19:15:01 +0000 (20:15 +0100)]
Move bytecode offsets from lj_vm.* to generated header.

7 years ago32/64 bit memory ref cleanup, part 4: GCproto ->varinfo.
Mike Pall [Fri, 5 Feb 2010 00:35:38 +0000 (01:35 +0100)]
32/64 bit memory ref cleanup, part 4: GCproto ->varinfo.

7 years ago32/64 bit memory ref cleanup, part 3: GCproto ->lineinfo.
Mike Pall [Fri, 5 Feb 2010 00:16:22 +0000 (01:16 +0100)]
32/64 bit memory ref cleanup, part 3: GCproto ->lineinfo.

7 years ago32/64 bit memory ref cleanup, part 2: GCproto ->uvname and ->chunkname.
Mike Pall [Thu, 4 Feb 2010 23:52:21 +0000 (00:52 +0100)]
32/64 bit memory ref cleanup, part 2: GCproto ->uvname and ->chunkname.

7 years ago32/64 bit memory ref cleanup, part 1: GCproto ->bc and ->k.
Mike Pall [Thu, 4 Feb 2010 23:07:32 +0000 (00:07 +0100)]
32/64 bit memory ref cleanup, part 1: GCproto ->bc and ->k.

7 years agoRETF modifies BASE. Treat it like a store or it gets CSEd.
Mike Pall [Thu, 4 Feb 2010 20:33:24 +0000 (21:33 +0100)]
RETF modifies BASE. Treat it like a store or it gets CSEd.

7 years agoReset the hotcount table after a JIT off to on transition.
Mike Pall [Thu, 4 Feb 2010 19:40:00 +0000 (20:40 +0100)]
Reset the hotcount table after a JIT off to on transition.

7 years agoAdd shadow frame link stack for trace recorder.
Mike Pall [Thu, 4 Feb 2010 02:08:29 +0000 (03:08 +0100)]
Add shadow frame link stack for trace recorder.

Simplifies snapshots. Prerequisite for pre-call snapshots.
Increases consistency for fast function calls, too.

7 years agoFix unroll limit checks and frame depth adjustment for pcall.
Mike Pall [Wed, 3 Feb 2010 15:48:25 +0000 (16:48 +0100)]
Fix unroll limit checks and frame depth adjustment for pcall.

7 years agoClean up frame depth checks and loop detection.
Mike Pall [Wed, 3 Feb 2010 13:55:56 +0000 (14:55 +0100)]
Clean up frame depth checks and loop detection.

7 years agoAdd extra check to suppress hotcall event during recording.
Mike Pall [Wed, 3 Feb 2010 13:34:30 +0000 (14:34 +0100)]
Add extra check to suppress hotcall event during recording.

7 years agoAnother loop formation test must check for return to lower frame.
Mike Pall [Wed, 3 Feb 2010 13:31:42 +0000 (14:31 +0100)]
Another loop formation test must check for return to lower frame.

7 years agoImprove coalescing of BASE register in side traces.
Mike Pall [Mon, 1 Feb 2010 22:32:26 +0000 (23:32 +0100)]
Improve coalescing of BASE register in side traces.

7 years agoRevise hardcoded inlining in lj_asm.c. Saves 1-2K.
Mike Pall [Sat, 30 Jan 2010 13:33:08 +0000 (14:33 +0100)]
Revise hardcoded inlining in lj_asm.c. Saves 1-2K.

7 years agoAdd support for weak IR references to register allocator.
Mike Pall [Sat, 30 Jan 2010 05:50:39 +0000 (06:50 +0100)]
Add support for weak IR references to register allocator.

Spilling a weak ref forces a spill slot, but omits the restore.
Spill slots for snapshot refs override the register, anyway.
Marking snapshot refs weak avoids pointless restores.

7 years agoLoop formation test must check for return to lower frame.
Mike Pall [Fri, 29 Jan 2010 14:07:40 +0000 (15:07 +0100)]
Loop formation test must check for return to lower frame.

7 years agoCompile return to lower frame. Only for Lua frames right now.
Mike Pall [Fri, 29 Jan 2010 02:32:37 +0000 (03:32 +0100)]
Compile return to lower frame. Only for Lua frames right now.

7 years agoFollowup fix: set maxslot for continuation return.
Mike Pall [Thu, 28 Jan 2010 03:29:15 +0000 (04:29 +0100)]
Followup fix: set maxslot for continuation return.

7 years agoDrop obsolete frame shrinking after continuation return.
Mike Pall [Thu, 28 Jan 2010 03:20:20 +0000 (04:20 +0100)]
Drop obsolete frame shrinking after continuation return.

7 years agoFix recording of metamethod result adjustment.
Mike Pall [Thu, 28 Jan 2010 03:02:32 +0000 (04:02 +0100)]
Fix recording of metamethod result adjustment.

7 years agoDon't modify jit_State and exit counters while in vmevent.
Mike Pall [Thu, 28 Jan 2010 01:30:12 +0000 (02:30 +0100)]
Don't modify jit_State and exit counters while in vmevent.

Fixes crash with hot loop in TEXIT callback which cleared J->parent.

7 years agoFix snapshot dumps.
Mike Pall [Thu, 28 Jan 2010 01:02:08 +0000 (02:02 +0100)]
Fix snapshot dumps.

7 years agoAvoid reuse of PHI registers, even for duplicate right PHIs.
Mike Pall [Wed, 27 Jan 2010 21:09:43 +0000 (22:09 +0100)]
Avoid reuse of PHI registers, even for duplicate right PHIs.

7 years agoExpose compressed snapshot map to reflection API.
Mike Pall [Wed, 27 Jan 2010 19:06:03 +0000 (20:06 +0100)]
Expose compressed snapshot map to reflection API.

Update jit.dump module and restore printing of frame separators.

7 years agoEliminate IR_FRAME. Replace with KGC and TRef/SnapEntry flags.
Mike Pall [Wed, 27 Jan 2010 02:50:29 +0000 (03:50 +0100)]
Eliminate IR_FRAME. Replace with KGC and TRef/SnapEntry flags.

7 years agoAdd frame and continuation flags to TRef and SnapEntry.
Mike Pall [Wed, 27 Jan 2010 01:17:56 +0000 (02:17 +0100)]
Add frame and continuation flags to TRef and SnapEntry.

7 years agoAdd missing check for return to lower frame.
Mike Pall [Wed, 27 Jan 2010 00:57:15 +0000 (01:57 +0100)]
Add missing check for return to lower frame.

7 years agoCleanup types for narrowing stack machine.
Mike Pall [Tue, 26 Jan 2010 23:39:22 +0000 (00:39 +0100)]
Cleanup types for narrowing stack machine.

7 years agoCompress snapshots using a simple, extensible 1D-compression.
Mike Pall [Tue, 26 Jan 2010 20:49:04 +0000 (21:49 +0100)]
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.

7 years agoAdd missing eviction in asm_obar().
Mike Pall [Tue, 26 Jan 2010 01:56:00 +0000 (02:56 +0100)]
Add missing eviction in asm_obar().

7 years agoFill gaps in frames (caused by metamethod calls) with nil.
Mike Pall [Mon, 25 Jan 2010 23:45:30 +0000 (00:45 +0100)]
Fill gaps in frames (caused by metamethod calls) with nil.

Simplifies storing snapshots to stack.

7 years agoUse dedicated type for snapshot map entry.
Mike Pall [Mon, 25 Jan 2010 18:51:52 +0000 (19:51 +0100)]
Use dedicated type for snapshot map entry.

Preparatory work for compressed snapshots.

7 years agoForce error if lua_newstate() is used in 64 bit mode.
Mike Pall [Sun, 24 Jan 2010 14:50:59 +0000 (15:50 +0100)]
Force error if lua_newstate() is used in 64 bit mode.

7 years agoIntegrate MinGW build with DWARF2 exception handling.
Mike Pall [Fri, 22 Jan 2010 00:56:49 +0000 (01:56 +0100)]
Integrate MinGW build with DWARF2 exception handling.

Only works with DWARF2-enabled GCC 4.x (not the default MinGW GCC).
Fix fastcall symbol names for COFF assembler output.
Add DWARF2 unwind info to COFF assembler output.
Use COFF assembler mode for MinGW builds.
Always enable the DWARF2 handler if compiled with GCC.

7 years agoFix undefined behavior in table resizing calculation.
Mike Pall [Thu, 21 Jan 2010 18:42:51 +0000 (19:42 +0100)]
Fix undefined behavior in table resizing calculation.

7 years agoFix ordered string comparisons. Unsigned arithmetic is evil.
Mike Pall [Thu, 21 Jan 2010 14:29:23 +0000 (15:29 +0100)]
Fix ordered string comparisons. Unsigned arithmetic is evil.

7 years agoUpdate docs about exception handling.
Mike Pall [Wed, 20 Jan 2010 11:24:56 +0000 (12:24 +0100)]
Update docs about exception handling.

7 years agoDecouple guard vs. INT check vs. TYPECHECK semantics for SLOAD.
Mike Pall [Tue, 19 Jan 2010 15:58:26 +0000 (16:58 +0100)]
Decouple guard vs. INT check vs. TYPECHECK semantics for SLOAD.

7 years agoFix broken intarith + testop optimization.
Mike Pall [Tue, 19 Jan 2010 00:45:39 +0000 (01:45 +0100)]
Fix broken intarith + testop optimization.

7 years agoAdd some sanity checks for allocator in 64 bit mode.
Mike Pall [Mon, 18 Jan 2010 00:32:33 +0000 (01:32 +0100)]
Add some sanity checks for allocator in 64 bit mode.

7 years agoReduce non-numeric tag range by bumping up 64 bit lightud tag.
Mike Pall [Sun, 17 Jan 2010 23:42:34 +0000 (00:42 +0100)]
Reduce non-numeric tag range by bumping up 64 bit lightud tag.

7 years agoUpdate docs with x64 build instructions.
Mike Pall [Sun, 17 Jan 2010 21:02:13 +0000 (22:02 +0100)]
Update docs with x64 build instructions.

7 years agoFix more 64 bit conversion warnings.
Mike Pall [Sun, 17 Jan 2010 19:47:10 +0000 (20:47 +0100)]
Fix more 64 bit conversion warnings.

7 years agoSilence 64 bit conversion warning.
Mike Pall [Sun, 17 Jan 2010 19:36:04 +0000 (20:36 +0100)]
Silence 64 bit conversion warning.

7 years agoEnable build for x64 interpreter on WIN64.
Mike Pall [Sun, 17 Jan 2010 19:33:13 +0000 (20:33 +0100)]
Enable build for x64 interpreter on WIN64.

To build the x64 interpreter open a "Windows SDK Command Shell".
Then set the compiler environment: setenv /release /x64
Then cd to the src directory and run msvcbuild.bat.

7 years agoAllocate 32 bit memory on WIN64 using NtAllocateVirtualMemory.
Mike Pall [Sun, 17 Jan 2010 19:20:43 +0000 (20:20 +0100)]
Allocate 32 bit memory on WIN64 using NtAllocateVirtualMemory.

7 years agoFix off-by-one error in x64 PE object symbol mangling.
Mike Pall [Sun, 17 Jan 2010 18:58:31 +0000 (19:58 +0100)]
Fix off-by-one error in x64 PE object symbol mangling.

7 years agoError for blacklisted loop bytecodes has no info argument.
Mike Pall [Sat, 16 Jan 2010 01:04:12 +0000 (02:04 +0100)]
Error for blacklisted loop bytecodes has no info argument.

7 years agoAdd build infrastructure for x64 interpreter.
Mike Pall [Thu, 14 Jan 2010 11:28:16 +0000 (12:28 +0100)]
Add build infrastructure for x64 interpreter.

Must be explicitly enabled with: make clean && make "CC=gcc -m64"
Only works on Linux/x64. Does not work on WIN64 or OSX/x64 (yet).

7 years agoShorten %p format for pure 32 bit pointers on x64.
Mike Pall [Thu, 14 Jan 2010 11:08:32 +0000 (12:08 +0100)]
Shorten %p format for pure 32 bit pointers on x64.

7 years agoStrip '@' suffix from external symbols for MACH-O, too.
Mike Pall [Sun, 10 Jan 2010 08:39:05 +0000 (09:39 +0100)]
Strip '@' suffix from external symbols for MACH-O, too.

Fixes OSX build.

7 years agoImprove alias analysis of upvalues using a disambiguation hash value.
Mike Pall [Sat, 9 Jan 2010 22:59:43 +0000 (23:59 +0100)]
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.

7 years agoAvoid int16_t widening for pt->uv elements.
Mike Pall [Sat, 9 Jan 2010 21:41:08 +0000 (22:41 +0100)]
Avoid int16_t widening for pt->uv elements.