Commit Graph

1147 Commits

Author SHA1 Message Date
Mike Pall
c39ca7c35b FFI: Record ffi.abi(). 2011-02-08 00:09:33 +01:00
Mike Pall
7a37b93f1b FFI: Record ffi.copy() and ffi.fill(). 2011-02-07 23:49:27 +01:00
Mike Pall
fb53d4aeb7 FFI: Fix recording of pointer arithmetic. 2011-02-07 23:42:51 +01:00
Mike Pall
97d0874ff5 Add IR_XBAR, a barrier against XLOAD/XSTORE optimizations. 2011-02-07 21:59:25 +01:00
Mike Pall
0a50356b6f Improve static assertion macro. 2011-02-07 21:44:01 +01:00
Mike Pall
51e8fe9cf0 FFI: Allow cdata types for integer arguments of ffi.* functions. 2011-02-07 17:13:14 +01:00
Mike Pall
8da287cab8 FFI: Fix handling of enum arguments to C calls. 2011-02-07 16:41:51 +01:00
Mike Pall
ceece4d13e FFI: Perform stricter checks in ffi.cast(). Record ffi.cast(). 2011-02-06 12:46:18 +01:00
Mike Pall
bf58160b7a FFI: Simplify and fix tonumber() for cdata objects. 2011-02-06 12:23:58 +01:00
Mike Pall
4c74f70464 Strength-reduce 32 to 64 bit widening for XLOAD U8/U16 inputs. 2011-02-06 00:45:39 +01:00
Mike Pall
26bb0fe24b FFI: Limit number of arguments for recorded calls. 2011-02-05 23:01:10 +01:00
Mike Pall
26fadcd25b FFI: Record simple C function calls.
Only handles cdecl and fixarg C functions.
Doesn't handle pass-by-value aggregates.
Doesn't handle 64 bit args/returns on 32 bit CPUs.
2011-02-05 21:50:15 +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
14f5103764 FFI: Record C library namespace lookups. 2011-02-05 14:16:16 +01:00
Mike Pall
223d85aa06 Treat metatables of special userdata objects as immutable. 2011-02-05 14:09:50 +01:00
Mike Pall
c29ed4dbbf FFI: Record ffi.string(). 2011-02-05 01:05:56 +01:00
Mike Pall
618b451648 FFI: Avoid intermediate boxes for tonumber(), too. 2011-02-05 01:04:41 +01:00
Mike Pall
1abf5d4d26 FFI: Disable MUL => BSHL FOLD rule on 32 bit. 2011-02-03 20:10:13 +01:00
Mike Pall
df65b8b419 FFI: Rename IR_CNEWP to IR_CNEWI and use it to box 64 bit integers.
Generates smaller IR and DCE eliminates many intermediate boxes.
Needs allocation sinking to eliminate the boxes kept alive by PHIs.
2011-02-03 04:22:27 +01:00
Mike Pall
1027018b21 Rename IR_POWI to IR_POW. 2011-02-02 21:33:11 +01:00
Mike Pall
433fd18f6d FFI: Add basic FOLD rules for 64 bit integer DIV, MOD and POWI. 2011-02-02 21:25:43 +01:00
Mike Pall
a1e0f991d8 FFI: Record 64 bit integer divide and modulo. 2011-02-02 21:24:55 +01:00
Mike Pall
2c8945d3e7 Use names defined in lualib.h for library registration. 2011-02-02 02:38:59 +01:00
Mike Pall
1505d6ffde Fix OSX build to work with newer ld64 versions. 2011-02-02 02:31:59 +01:00
Mike Pall
b613216efc Add SPLIT pass to split 64 bit IR instructions for 32 bit CPUs.
Add generic HIOP instruction for extra backend functionality.
Add support for HIOP to x86 backend.
Use POWI for 64 bit integer x^k, too.
POWI is lowered to a call by SPLIT or the x64 backend.
2011-02-02 02:29:37 +01:00
Mike Pall
c539c0cac8 Add SSE3 CPU feature detection. 2011-02-01 19:28:03 +01:00
Mike Pall
992bc2caa3 FFI: Limit index range for complex numbers. 2011-01-29 19:47:37 +01:00
Mike Pall
6fd721ce72 FFI: Implement POSIX/x64 struct-by-value calling conventions. 2011-01-29 13:04:16 +01:00
Mike Pall
6fee0002b9 Fix 64 bit case of (SUB x x) and (BXOR x x) FOLD rules. 2011-01-28 02:17:35 +01:00
Mike Pall
07d8a53b39 FFI: Split up 64 bit x^k helper into signed/unsigned. 2011-01-28 02:15:30 +01:00
Mike Pall
cd9b8f90e2 FFI: Fix various issues with C type table reallocations. 2011-01-27 16:28:24 +01:00
Mike Pall
279b6ec22e FFI: Fix symbol name redirection. 2011-01-27 16:07:02 +01:00
Mike Pall
3184f17169 FFI: Move code for cdata arithmetic to lj_carith.c. 2011-01-26 21:46:02 +01:00
Mike Pall
2526498c71 FFI: Record cdata indexing with integer cdata. 2011-01-26 21:14:58 +01:00
Mike Pall
de0781d610 FFI: Allow cdata indexing with integer cdata. 2011-01-26 21:14:38 +01:00
Mike Pall
0622ad9adc Fix comments for BC_ITERN. 2011-01-26 19:55:55 +01:00
Mike Pall
30db71e2e2 FFI: Convert enum return value of C function to underlying type. 2011-01-26 14:18:12 +01:00
Mike Pall
a285415b01 One more fix for the trace flush logic. Sigh. 2011-01-26 02:34:30 +01:00
Mike Pall
1b75ec22c8 FFI: Add symbol name redirection.
This works like the GCC extension, e.g.:
FILE *fopen(const char *fn, const char *mode) __asm__("" "fopen64");
2011-01-26 02:31:19 +01:00
Mike Pall
ed6c895ae5 ARM: Add ARM target architecture selection (disabled). 2011-01-25 18:50:24 +01:00
Mike Pall
705f593ffc FFI: Don't force zero terminator on string to array conversion. 2011-01-24 15:51:33 +01:00
Mike Pall
96ef87bdfd Clear bytecode penalty cache in jit.flush(). 2011-01-23 19:06:19 +01:00
Mike Pall
ef3b209127 FFI: Fix ffi.load() error message on Windows. 2011-01-23 14:28:01 +01:00
Mike Pall
72b3fff72f FFI: Simplify initializer rules. Clarify docs. 2011-01-23 14:23:21 +01:00
Mike Pall
f529d22869 Another fix for the trace flush logic. I'll get this right someday.
Thanks to David Manura.
2011-01-22 20:32:23 +01:00
Mike Pall
8396c3cdbc PPC: Fix ipairs() for keys in the hash part. 2011-01-20 12:25:56 +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
d20e53c322 Combine i8/u8 XLOAD with BAND+comparison into test byte mrm, imm8. 2011-01-19 02:05:26 +01:00
Mike Pall
8407ac0eca Add volatile XLOADs. 2011-01-19 02:05:12 +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
685dfc3172 Fix for the fix for the trace flush logic. 2011-01-18 22:17:27 +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
83d8c86bbb FFI: Record conversions from bool ctype. 2011-01-17 01:21:57 +01:00
Mike Pall
66ba1e68aa Add trace recorder infrastructure for instruction post-processing. 2011-01-17 01:20:10 +01:00
Mike Pall
b2ff889c6e FFI: Don't swap operands for cdata __eq metamethod call. 2011-01-17 01:09:43 +01:00
Mike Pall
335232b0f1 FFI: Record conversions to bool ctype. 2011-01-16 19:42:53 +01:00
Mike Pall
2940ab023a Fix assertion. 2011-01-16 19:24:50 +01:00
Mike Pall
6f746577d0 FFI: Allow indexing a struct constructor to get constants.
Specialize to the CTypeID held by a constructor in all cases.
2011-01-16 18:32:33 +01:00
Mike Pall
0fa32e5d31 FFI: Record conversions from strings to enums or pointers. 2011-01-13 17:20:29 +01:00
Mike Pall
59643c86fb Add FOLD rule for CONV.num.u32 KINT. 2011-01-13 17:18:08 +01:00
Mike Pall
706bbe394e Fix recording of select() with multi-char string as 1st argument. 2011-01-13 17:16:22 +01:00
Mike Pall
6e702d703e FFI: Cleanup some type conversions.
Remove pointless conversions to booleans.
Allow assigning functions to function pointers.
2011-01-13 16:39:42 +01:00
Mike Pall
0ec7f5ed92 FFI: Add 64 bit integer comparisons and pointer comparisons. 2011-01-13 02:35:29 +01:00
Mike Pall
e7b08b2361 FFI: Simplify logic for pointer arithmetic. 2011-01-12 21:34:11 +01:00
Mike Pall
a5e48285e3 FFI: Rearrange code in lib_ffi.c. 2011-01-12 21:33:58 +01:00
Mike Pall
2363399b10 FFI: Untangle and fix calling convention definitions. 2011-01-12 20:01:35 +01:00
Mike Pall
1548383dbe Avoid compiler warnings. 2011-01-12 18:22:00 +01:00
Mike Pall
8d858bfefa FFI: Fix C calls with complex values on x64. 2011-01-11 03:36:49 +01:00
Mike Pall
a54843bb51 FFI: Lookup decorated name for fastcall/stdcall functions. 2011-01-11 03:08:54 +01:00
Mike Pall
87a6c8a980 FFI: Auto-detect __stdcall and fix up C function declarations. 2011-01-10 20:50:34 +01:00
Mike Pall
ddf6596333 FFI: Add ffi.load() and ffi.C default namespace. 2011-01-10 03:43:18 +01:00
Mike Pall
d215747fd5 FFI: Fix function pointer lookup for calls. 2011-01-10 03:38:23 +01:00
Mike Pall
9502afb35b FFI: Preserve stack top across implicit load of FFI library in lexer. 2011-01-09 17:57:19 +01:00
Mike Pall
06f99fc3df Bump copyright date to 2011. 2011-01-09 17:12:53 +01:00
Mike Pall
4c0330a8b1 FFI: Handle NYI cases for cdata call metamethod. 2011-01-09 16:48:37 +01:00
Mike Pall
bfc638ca6c FFI: Add missing GC steps for C function calls. 2011-01-09 16:48:23 +01:00
Mike Pall
aca1e5b3e6 Fix Windows/x86 build and update pregenerated files. 2011-01-06 23:37:04 +01:00
Mike Pall
fb0a18ca0b FFI: Add support for calling C functions. 2011-01-06 23:30:04 +01:00
Mike Pall
97875c4fa9 Avoid compiler warnings. 2011-01-05 21:48:01 +01:00
Mike Pall
a148a6aa00 FFI: Add missing link to parameters for C function declaration. 2011-01-05 21:45:31 +01:00
Mike Pall
bc37edc911 Fix handling of floats in x86/x64 backend. 2011-01-05 21:45:09 +01:00
Mike Pall
3b468ceedb FFI: Force snapshot after store to cdata. 2011-01-05 20:28:57 +01:00
Mike Pall
eaf88dfb3a FFI: Record 64 bit integer arithmetic.
Currently NYI in the x86 backend.
2011-01-03 03:35:35 +01:00
Mike Pall
44a22b9889 Add support for non-constant integer IR_MUL to backend. 2011-01-03 02:58:31 +01:00
Mike Pall
593821f7d9 Add support for integer IR_NEG to backend. 2011-01-03 02:35:30 +01:00
Mike Pall
3291bb62e0 FFI: Record pointer arithmetic. 2011-01-03 01:59:26 +01:00
Mike Pall
b2c74c52cc FFI: Add support for cdata constants to IR. 2011-01-02 22:21:10 +01:00
Mike Pall
331b148737 Use cdata to pass IR_KINT64 to -jdump. 2011-01-02 22:20:08 +01:00
Mike Pall
e66b5b6eee Improve uint64_t <-> FP conversions in x64 backend. 2011-01-02 20:43:58 +01:00
Mike Pall
55a9be7809 FFI: Record tonumber() for boxed cdata. 2011-01-02 18:30:02 +01:00
Mike Pall
0005b2c2b9 Add support for uint64_t <-> FP conversions to x64 backend. 2011-01-02 18:24:31 +01:00
Mike Pall
ddfa7fc246 Add conversions for type mismatches in XSTORE forwarding. 2010-12-31 22:50:06 +01:00
Mike Pall
3b47eba9cc Add 8/16 to 32 bit sign/zero-extension variants to CONV. 2010-12-31 22:49:23 +01:00
Mike Pall
007067bdd8 Fix register allocation for FP <- int conversion. 2010-12-31 22:18:14 +01:00
Mike Pall
783dbd335f Refactoring of conversion ops, part 5: drop TOINT/TOI64/TONUM. 2010-12-31 04:09:32 +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
1f26961092 Refactoring of conversion ops, part 3: add FOLD rules for IR_CONV. 2010-12-31 03:47:30 +01:00
Mike Pall
65b194a2f8 Copy destination type for CONV from ir->t to op2, too. 2010-12-31 01:00:54 +01:00
Mike Pall
dc4b82c33d Add lj_num2u64 for number to uint64_t conversion. 2010-12-31 00:46:29 +01:00
Mike Pall
4668b229de FFI: Add missing GC steps for implicit allocations. 2010-12-30 12:16:25 +01:00
Mike Pall
158de60b8c Refactoring of conversion ops, part 2: cleanup cdata conversions. 2010-12-30 00:42:00 +01:00
Mike Pall
8bcc5ed021 Add support for IRT_FLOAT to XLOAD/XSTORE. 2010-12-30 00:36:33 +01:00
Mike Pall
2ca2de7f0e Refactoring of conversion ops, part 1: add IR_CONV. 2010-12-30 00:35:32 +01:00
Mike Pall
06c61d9cea Use macro-map for IRT_* enum. Add IRT_FLOAT. 2010-12-28 20:58:00 +01:00
Mike Pall
d176433e32 FFI: Catch various NYI cases while recording. 2010-12-28 19:09:01 +01:00
Mike Pall
a70fb9416a Make recording of type() independent of LJ_T*/IRT_* mapping. 2010-12-28 18:23:41 +01:00
Mike Pall
44935dae0d FFI: Add 64 bit integer arithmetic. 2010-12-25 22:54:25 +01:00
Mike Pall
dd65e00831 FFI: Fix C type representation for valarrays. 2010-12-25 22:33:07 +01:00
Mike Pall
461bf77331 FFI: Parse complex and 64 bit integer literals. 2010-12-24 01:31:39 +01:00
Mike Pall
4850865c57 Fix misnamed macro in Lua parser. 2010-12-24 01:23:42 +01:00
Mike Pall
aa705f7e1a FFI: Fix C parser for hex literals. 2010-12-23 23:06:04 +01:00
Mike Pall
79ab1a4baa FFI: Add pointer arithmetic. 2010-12-23 17:54:54 +01:00
Mike Pall
ba20871f0f Fix display of branches to exit stubs in 32 bit disassembly. 2010-12-23 01:01:04 +01:00
Mike Pall
6082f93919 Improve register allocation for loops with variable shifts. 2010-12-23 00:55:31 +01:00
Mike Pall
c0ffe7d394 FFI: Record cdata allocations. 2010-12-22 23:21:38 +01:00
Mike Pall
4f2f44dd97 Avoid compiler warnings. 2010-12-22 23:20:50 +01:00
Mike Pall
dbab6cf511 Reassociate XLOAD across PHIs to handle a[i-1] forwarding case.
Improved SciMark scores: http://luajit.org/download/scimark.lua

x86      SciMark LARGE | FFT     SOR      MC    SPARSE    LU
-----------------------+---------------------------------------
GCC 4.4.3        623.8 |  91.0   883.5   190.4   784.7  1169.6
LuaJIT git +FFI  651.2 |  97.2  1021.9   323.4   673.7  1139.6
LuaJIT git       527.7 |  91.4  1008.5   225.6   400.0   913.2

x64      SciMark LARGE | FFT     SOR      MC    SPARSE    LU
-----------------------+---------------------------------------
GCC 4.4.3        614.7 |  97.7   883.5   228.5   734.0  1129.9
JVM 1.6.0_22     707.5 |  79.2  1118.1   385.5   658.9  1295.7
LuaJIT git +FFI  632.8 |  89.1  1035.8   298.3   648.1  1092.9
LuaJIT git       516.1 |  88.4   995.4   225.6   382.1   888.9
2010-12-20 22:32:01 +01:00
Mike Pall
c8d6f078a5 Fix XSTORE for IRT_NUM constants. 2010-12-20 19:34:15 +01:00
Mike Pall
c9a0b9ea9e Improve alias analysis for cdata allocations. 2010-12-20 15:26:05 +01:00
Mike Pall
255c6e8c87 FFI: Drop IR_CNEWI. Add IR_CNEWP only for pointers/refs. 2010-12-17 17:20:04 +01:00
Mike Pall
c98132e182 FFI: FOLD load of initializers even across PHIs. 2010-12-17 16:47:28 +01:00
Mike Pall
c4a0fb4f60 FFI: Record copy-by-value for pointer and complex C types. 2010-12-17 16:47:14 +01:00
Mike Pall
09ef7ebf56 FFI: Simplify copy-by-value. Strip attributes, keep qualifiers. 2010-12-15 21:47:46 +01:00
Mike Pall
fbcc925a2d FFI: Fix auto-deref of pointers to structs. 2010-12-15 19:48:20 +01:00
Mike Pall
badff4ed0a Fix error location while recording metamethods. 2010-12-15 19:44:30 +01:00
Mike Pall
9666cf52ce Fix type-based alias analysis for XLOAD/XSTORE. 2010-12-12 23:09:26 +01:00
Mike Pall
74317fa0ef Add alias analysis for XLOAD/XSTORE. Add DSE for XSTORE. 2010-12-12 22:32:52 +01:00
Mike Pall
a22ea8898e FOLD (base+k)+(idx*sz)+ofs ==> (base+idx*sz)+(ofs+k). 2010-12-12 21:07:23 +01:00
Mike Pall
a403cb13e4 Add missing PHI barrier to strength reduction of widening. 2010-12-12 21:05:34 +01:00
Mike Pall
42f9b38663 Extend all FOLD rules to work on 64 bit integers. 2010-12-11 21:20:49 +01:00
Mike Pall
476259e87e Add 64 bit bswap and rotates. 2010-12-11 21:20:12 +01:00
Mike Pall
5f7e9173db Regroup FOLD rules for constant folding. 2010-12-11 20:08:07 +01:00
Mike Pall
44101c64e8 FFI: Don't use KNULL for arbitrary NULL pointers. 2010-12-11 20:12:14 +01:00
Mike Pall
cdac0fa2cb FFI: Add IR_CNEW/IR_CNEWI to allocate/init cdata objects. 2010-12-11 19:32:12 +01:00
Mike Pall
6947493687 Turn lj_mem_newgco() into a fastcall. 2010-12-10 01:10:52 +01:00
Mike Pall
09e2bdbb0a FFI: Always specialize to the field name for struct access. 2010-12-09 22:48:01 +01:00
Mike Pall
870bcd7640 Add missing guard for check against "#" when recording select(). 2010-12-09 22:35:49 +01:00
Mike Pall
cc0efd85d6 FFI: Fix alignment of scalars/vectors modified with mode attribute. 2010-12-09 18:48:23 +01:00
Mike Pall
1d86090926 Strength-reduce 32 to 64 bit widening using scalar evolution analysis. 2010-12-09 16:12:59 +01:00
Mike Pall
36fed9f3e1 Allow integer literals in FOLD rules.
Workaround before refactoring conversion ops.
2010-12-09 16:11:15 +01:00
Mike Pall
e9cab5a763 x86/x64 backend: keep invariants on the right rather than fusing loads. 2010-12-09 16:08:55 +01:00
Mike Pall
4f0d3e8262 Apply narrowing optimization to IR_TOI64, too. 2010-12-08 21:03:45 +01:00
Mike Pall
f308e00e03 Add FOLD rule to reassociate 64 bit (x+k1)+k2. 2010-12-08 20:57:21 +01:00
Mike Pall
d0b283e596 Avoid stack resizes while recording calls to vararg functions.
FUNCV might have been recorded twice (with ill effects).
2010-12-08 19:11:58 +01:00
Mike Pall
6a04591b7b FOLD (base+(idx+k)*sz)+ofs ==> (base+idx*sz)+(ofs+k*sz). 2010-12-08 03:33:48 +01:00
Mike Pall
3c78a7f468 Avoid fusing loads if there are multiple references. 2010-12-08 03:26:53 +01:00
Mike Pall
72744dabd9 Fix IRT_NUM support for XLOAD/XSTORE. 2010-12-08 03:24:35 +01:00
Mike Pall
3ef6a53cfa FFI: Turn cdata indexing into x86/x64 [base+idx*sz+ofs] addressing. 2010-12-08 02:36:09 +01:00
Mike Pall
d778680098 FFI: Record cdata index operations (preliminary, lots of NYI cases). 2010-12-08 02:11:18 +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
d4d95ee2da Fix x64 code generation for A16+REX prefixed instructions. 2010-12-08 01:57:50 +01:00
Mike Pall
e6093b129a Fix register allocation for 8 bit stores in x86 backend. 2010-12-07 01:18:10 +01:00
Mike Pall
b3c4c0810a Add IRT_NUM support to XLOAD/XSTORE. 2010-12-06 19:28:51 +01:00
Mike Pall
159f51d811 Add IR_TOI64. 2010-12-06 18:21:51 +01:00
Mike Pall
f6c4e8d3d7 Add FOLD rule to turn i << 1 into i + i. 2010-12-06 13:26:58 +01:00
Mike Pall
a5bdae8f23 Fix 64 bit shifts in backend. Fix shift by 0. 2010-12-06 13:16:35 +01:00
Mike Pall
5270586a80 Fix XLOAD/XSTORE references. 2010-12-06 13:15:53 +01:00
Mike Pall
86fd2289f0 Add support for integer IR_MUL. 2010-12-06 12:54:00 +01:00
Mike Pall
b56b83487f Support all kinds of XLOAD/XSTORE references in backend.
Fuse pointer arithmetic, too.
2010-12-06 03:10:28 +01:00
Mike Pall
a850b27da9 Avoid compiler warnings. 2010-12-06 03:07:10 +01:00
Mike Pall
e137408752 Use native IRT_PTR instead of IRT_LIGHTUD workaround for FILE*. 2010-12-06 02:14:39 +01:00
Mike Pall
73bc83cda1 Simplify lj_ir_kvalue(). Fix IR_KNULL + IRT_P64 case. 2010-12-06 02:12:08 +01:00
Mike Pall
4755765e32 Avoid warning. 2010-12-06 01:59:07 +01:00
Mike Pall
db3d16bfd7 Add IR_XSTORE. 2010-12-06 01:48:19 +01:00
Mike Pall
281f426d60 Add minimal set of fold rules for KINT64. 2010-12-06 00:38:21 +01:00
Mike Pall
588fa0481f Add support for 64 bit integer arithmetic to x64 backend. 2010-12-06 00:07:36 +01:00
Mike Pall
c5f4f607c9 Fix xmm spill/restore broken by b1fb71fb. 2010-12-05 22:39:36 +01:00
Mike Pall
5a13fa69d9 Add IR_KINT64. 2010-12-05 22:12:31 +01:00
Mike Pall
b1fb71fb98 Cleanup 64 bit IR type handling. 2010-12-05 21:01:08 +01:00
Mike Pall
6a7605ec85 Rename IRT_PTR to IRT_P32. 2010-12-05 18:59:34 +01:00
Mike Pall
26830d070d Make sure to use irt_toitype() macro everywhere. 2010-12-05 18:51:37 +01:00
Mike Pall
e7f8cc964e Split off fast function recording to lj_ffrecord.c. 2010-12-05 17:12:34 +01:00
Mike Pall
ffa5a2b045 Don't export internal symbol. 2010-12-05 01:08:19 +01:00
Mike Pall
7cb250c4b4 FFI: Add ffi.* library. 2010-12-05 00:52:17 +01:00
Mike Pall
513b0ba18f FFI: Add support for converting cdata to tonumber(). 2010-12-05 00:40:23 +01:00
Mike Pall
233076d3f9 FFI: Add C declaration parser. 2010-12-05 00:20:59 +01:00
Mike Pall
526e087e63 FFI: Add C data handling and C type conversions. 2010-12-05 00:18:07 +01:00
Mike Pall
05973ee440 FFI: Add C type management. 2010-12-05 00:11:35 +01:00
Mike Pall
8679ca5792 POSIX is an acronym. 2010-12-04 20:47:51 +01:00
Mike Pall
100a00dd40 Undo ef8c2648. 2010-12-03 16:58:19 +01:00
Mike Pall
d98cd19bb0 Allow access to raw error messages from outside lj_err.c. 2010-12-01 12:54:32 +01:00
Mike Pall
0ffd06aba8 FFI: Add define to disable the FFI library. 2010-11-30 21:56:57 +01:00
Mike Pall
4ed8a1931b Add support for deferred library loads to lib_init.c. 2010-11-30 21:56:03 +01:00
Mike Pall
443c542e26 Fix check for enabled JIT compiler in lj_trace.h. 2010-11-30 18:32:22 +01:00
Mike Pall
cd1901370d Rearrange src/Makefile. Split features and debugging support. 2010-11-30 16:19:20 +01:00
Mike Pall
592cf3ffac Don't mark REF_BASE in DCE. 2010-11-29 16:00:44 +01:00
Mike Pall
2033d6310b Add shorter defines for endianess checks. 2010-11-28 17:22:45 +01:00
Mike Pall
24186e05e6 Remove metamethod frame for errors from internal metamethods. 2010-11-27 20:23:39 +01:00
Mike Pall
35890f66c1 FFI: Don't propagate cdata objects. 2010-11-26 17:27:02 +01:00
Mike Pall
ef8c264873 FFI: Add macros for consistent number to integer truncation. 2010-11-26 13:40:40 +01:00
Mike Pall
2fd1292955 FFI: Add cdata object type. 2010-11-26 13:28:46 +01:00
Mike Pall
6290d6f5d0 Display caller location in errors from metamethods. 2010-11-26 13:20:56 +01:00
Mike Pall
7840d0b2b0 Shrink slots for 'break' statement to help data-flow analysis. 2010-11-25 12:13:23 +01:00
Mike Pall
18fbf86c9e Improve unrolling heuristics for non-looping inner loops. 2010-11-25 11:42:17 +01:00
Mike Pall
7338456796 Support os.exit(status|true|false [,close]) (from Lua 5.2). 2010-11-22 22:39:06 +01:00
Mike Pall
367ff0cdaa Parse '\*' escape in strings (from Lua 5.2). 2010-11-22 22:22:12 +01:00
Mike Pall
b776bf91ff Tighter check on table.sort function compliance (from Lua 5.2). 2010-11-19 18:44:59 +01:00
Mike Pall
52fd87bf34 Add support for "%g" character class in patterns (from Lua 5.2). 2010-11-19 18:37:10 +01:00
Mike Pall
7cc981c140 string.format("%q", str) is now fully reversible (from Lua 5.2). 2010-11-19 18:22:08 +01:00
Mike Pall
29b8959df1 Parse hexadecimal escapes in strings (from Lua 5.2). 2010-11-19 18:15:50 +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
3754a8fe7a Allow running C functions with coroutine.create(), too. 2010-11-17 20:07:55 +01:00
Mike Pall
751ff5b392 Add jit.os string. 2010-11-16 15:05:21 +01:00
Mike Pall
24baf77955 Cleanup architecture, ABI and OS definitions. 2010-11-16 15:03:40 +01:00
Mike Pall
1de05d1147 Avoid using negative hex numbers with DynASM. 2010-11-16 13:41:58 +01:00
Mike Pall
ad29c1f39f Rename character type handling from lj_ctype* to lj_char*. 2010-11-09 12:09:54 +01:00
Mike Pall
fe21a42a92 Fix conflict between loop branch inversion and HREF+NE/EQ merging. 2010-11-05 23:12:43 +01:00
Mike Pall
188f0b04e1 Number parser shouldn't accept '0x' without hex digits. 2010-11-02 16:01:43 +01:00
Mike Pall
44372a4453 Fix parsing of hex floats. 2010-11-01 17:53:04 +01:00
Mike Pall
ab1b67f73a Fix collectgarbage("count") result if more than 2GB is in use.
Thanks to Tony Finch.
2010-10-25 14:53:37 +02:00
Mike Pall
08b0ede194 Reduce 32GB RLIMIT_DATA on FreeBSD/x64 to allocate low-2GB memory.
Thanks to Tony Finch.
2010-10-23 16:31:27 +02:00
Mike Pall
02dc9d1082 Avoid compiler warning. 2010-10-23 15:28:28 +02:00
Mike Pall
65dec38e44 PPC: Preserve RD during array resizing in BC_TSETM. 2010-10-18 16:12:27 +02: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
cc62edebfd x64: Fix type check for numbers in compiled code. 2010-10-11 19:24:12 +02:00
Mike Pall
5140b40b44 x64: Optimize internal/external tag conversion in lua_type(). 2010-10-11 17:26:07 +02:00
Mike Pall
a3eeee5b3e PPC: Update DynASM-generated file.
PPC/e500v2 interpreter port is now feature-complete.
2010-10-07 02:24:57 +02:00
Mike Pall
a7caa4894c PPC: Use ZERO register instead of extra load immediate. 2010-10-07 02:21:54 +02:00
Mike Pall
9d201c972a PPC: Add coroutine.resume/wrap_aux/yield() fast functions. 2010-10-07 02:16:44 +02:00
Mike Pall
9f14e03d6e PPC: Add string.sub() fast function. 2010-10-06 16:18:24 +02:00
Mike Pall
b4f3d4525e PPC: Add string.rep/reverse/lower/upper() fast functions. 2010-10-06 16:17:07 +02:00
Mike Pall
82b2f6156a PPC: Add string.len/byte/char() fast functions. 2010-10-06 16:11:02 +02:00
Mike Pall
443d28bc9a PPC: Fix math.deg/rad() fast functions. 2010-10-05 19:39:07 +02:00
Mike Pall
8f5efb2c43 PPC: Use own implementation for math.floor/ceil() fast functions. 2010-10-05 19:37:56 +02:00
Mike Pall
793fb4a9ad PPC: Add math.ldexp/frexp/modf() fast functions. 2010-10-05 19:36:02 +02:00
Mike Pall
52b67fd3ea PPC: Add math.abs/deg/rad/min/max() fast functions. 2010-10-05 19:35:04 +02:00
Mike Pall
3418512862 PPC: Remove pointless optimization in BC_UNM. 2010-10-05 19:27:33 +02:00
Mike Pall
14cd10e322 PPC: Add table.getn() fast function. 2010-10-05 01:47:39 +02:00
Mike Pall
2f5f6290e7 PPC: Add tonumber() and tostring() fast functions. 2010-10-05 01:46:23 +02:00
Mike Pall
08ac8b0c96 PPC: Add getmetatable(), setmetatable() and rawget() fast functions. 2010-10-05 01:41:51 +02:00
Mike Pall
8b096c5d08 PPC: Add assert() and type() fast functions. 2010-10-05 01:39:48 +02:00
Mike Pall
ddae887878 Update docs for PPC port. Clarify and extend install instructions. 2010-10-05 01:36:54 +02:00
Mike Pall
e396bef7d8 PPC: Add pcall() and xpcall() fast functions. 2010-10-01 23:47:29 +02:00
Mike Pall
05099f0764 PPC: Add ipairs() fast function and its iterator. 2010-10-01 23:45:56 +02:00
Mike Pall
61d498be87 PPC: Add next() and pairs() fast functions. 2010-10-01 23:43:39 +02:00
Mike Pall
dcf006bfa2 PPC: Add BC_ITERN and BC_ISNEXT. 2010-10-01 01:44:02 +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
fce05fd6e1 x64: Use 64 bit slot copies in the interpreter. 2010-09-30 17:47:32 +02:00
Mike Pall
c0a8f5fb32 PPC: Add dispatch to fast function fallback handlers. 2010-09-30 02:58:29 +02:00
Mike Pall
4afff973a4 PPC: Add bit.* fast functions. 2010-09-30 02:56:54 +02:00
Mike Pall
408cd055a4 PPC: Add basic infrastructure for fast functions. 2010-09-30 02:54:33 +02:00
Mike Pall
a47136031e PPC: Add frame unwind info for assembler part.
Add define for target-specific exception handler return register.
2010-09-28 17:50:33 +02:00
Mike Pall
dc4fdecfb5 PPC: Don't use callee-save registers when folding '%' operator. 2010-09-28 14:59:33 +02:00
Mike Pall
a500752787 Fix checks for minimum required compiler versions. 2010-09-28 14:20:49 +02:00
Mike Pall
f635e3e5bb PPC: Add dispatch target for call hook. 2010-09-23 02:42:29 +02:00
Mike Pall
493d0aa259 PPC: Add dispatch targets for instruction and return hooks. 2010-09-23 02:41:06 +02:00
Mike Pall
6aedfa7919 PPC: Add lj_vm_resume(). 2010-09-23 02:35:51 +02:00
Mike Pall
5beedd6ef8 Workaround for missing fseeko/ftello prototypes on ancient glibc. 2010-09-23 01:30:53 +02:00
Mike Pall
d351c2ae36 x86/x64: Fix stack overflow handling for coroutine results. 2010-09-22 22:59:41 +02:00
Mike Pall
5baf0f9dc2 Fix stack growth for coroutine.wrap(). 2010-09-22 21:16:16 +02:00
Mike Pall
d270e890f1 PPC: Reschedule continuation dispatch. 2010-09-21 21:43:29 +02:00
Mike Pall
aff6b3080f Whitespace. 2010-09-21 21:41:49 +02:00
Mike Pall
201eec484c PPC: Add fixed register for TOBIT bias. 2010-09-21 21:40:39 +02:00
Mike Pall
0c0047e50c PPC: Add missing register setup after unwind to ff pcall. 2010-09-21 21:36:37 +02:00
Mike Pall
7336305e7c PPC: Fix result copy for return to Lua. 2010-09-21 21:21:21 +02:00
Mike Pall
1c3b8c51c9 PPC: Fix constant folding of modulo operator. 2010-09-21 20:54:12 +02:00
Mike Pall
bc146ddbe7 Consistently round int args of string functions on x64. 2010-09-21 18:04:59 +02:00
Mike Pall
4cd2299acd Improve AA for field accesses: disambiguate new allocations. 2010-09-21 15:21:26 +02:00
Mike Pall
3ae27ffebe Drop redundant (UGE any +0). 2010-09-21 02:44:18 +02:00
Mike Pall
38628d93b8 Improve FOLD/CSE of field loads and array/hash refs across NEWREF. 2010-09-21 02:28:14 +02:00
Mike Pall
23b5c56d41 Improve alias analysis: disambiguate new allocations. 2010-09-21 01:31:04 +02:00
Mike Pall
52b922c1e9 Avoid fusing potentially negative indexes into AREF on x64. 2010-09-18 18:34:38 +02:00
Mike Pall
9203d278d0 PPC: Add metamethod handlers and continuations for comparisons. 2010-09-17 16:07:01 +02:00
Mike Pall
9dc98280d2 PPC: Reschedule bytecode instruction fetch. 2010-09-17 16:01:02 +02:00
Mike Pall
66f0c43780 PPC: Add BC_CAT and lj_cont_cat. 2010-09-17 15:54:50 +02:00
Mike Pall
4f1d43d03e PPC: Fix ordered comparisons for NaN operands. 2010-09-16 02:09:19 +02:00
Mike Pall
028f80c599 PPC: Avoid comparison with NaN in BC_ISEQN/BC_ISNEN. 2010-09-16 02:06:20 +02:00
Mike Pall
3f32f4ac99 PPC: Add BC_TSETM. 2010-09-15 17:28:24 +02:00
Mike Pall
028a65a597 PPC: Add BC_VARG. 2010-09-15 17:27:17 +02:00
Mike Pall
44702720c5 Don't traverse inactive GCtrace objects. 2010-09-15 01:13:07 +02:00
Mike Pall
77267bc538 Show names of IR calls in disassembler output. 2010-09-15 00:51:43 +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
23655bd52e Improve alias analysis for vararg loads. 2010-09-14 16:48:52 +02:00
Mike Pall
b69c02eb68 Avoid unnecessary vararg loads. 2010-09-14 16:48:25 +02:00
Mike Pall
5b740046f8 PPC: Fix line number in stack overflow error. 2010-09-14 03:13:44 +02:00
Mike Pall
f8b7fb7d2b PPC: Fix write barrier in BC_TSETV. 2010-09-14 01:23:34 +02:00
Mike Pall
2bdf3fcd50 PPC: Fix KBASE restore in BC_CALLT. 2010-09-14 01:20:01 +02:00
Mike Pall
fe159ea2fb PPC: Keep MULTRES in a register. 2010-09-14 00:46:06 +02:00
Mike Pall
3d17f71968 x86/x64: Avoid unnecessary resize in BC_TSETM. 2010-09-13 22:30:23 +02:00
Mike Pall
8a87395d8d PPC: Add support for shifted MULTRES. 2010-09-13 21:50:27 +02:00
Mike Pall
0001916f8d PPC: Add metamethod handlers for indexing instructions. 2010-09-13 21:26:27 +02:00
Mike Pall
7a766c771d PPC: Add missing write barrier to BC_TSETV. 2010-09-13 21:21:39 +02:00
Mike Pall
dcfc385bf3 PPC: Fix write barrier and linkage for BC_USETV/BC_USETS.
Some older linkers can't rearrange to accomodate R_PPC_REL14.
2010-09-13 21:19:33 +02:00
Mike Pall
32bfececc5 Release all memory when using the builtin allocator.
Blocks >128K are not kept in the segment list and were not destroyed.
2010-09-13 19:48:31 +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
b72ae54dc0 Fix broken MSVC build. 2010-09-12 01:33:32 +02:00
Mike Pall
90f22760af PPC: Add argument coercion for BC_FORI. 2010-09-11 01:53:59 +02:00
Mike Pall
c330af2452 PPC: Add continuation dispatch and RA/nop continuations. 2010-09-11 01:52:26 +02:00
Mike Pall
cabcce1e1d PPC: Add metamethod handlers for arithmetic instructions. 2010-09-11 01:47:49 +02:00
Mike Pall
e15e4c4d95 PPC: Add metamethod handlers for call instructions. 2010-09-11 01:46:11 +02:00
Mike Pall
daafc0b2a2 Reduce minimum Lua frame size to 1. 2010-09-10 11:43:31 +02:00
Mike Pall
6fd315581c Optimize BC_VARG: use RC for numparams. 2010-09-10 11:34:29 +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
fd63b05253 Use biased integer constant for TSETM array index. 2010-09-09 12:01:29 +02:00
Mike Pall
8a1af8cf89 PPC: Use unsigned compares for pointer comparisons. 2010-09-09 01:14:17 +02:00
Mike Pall
9fd10963b9 PPC: Add upvalue get/set instructions. 2010-09-09 01:08:07 +02:00
Mike Pall
ec8f2918ba PPC: Add closure-related instructions. 2010-09-09 01:06:55 +02:00
Mike Pall
b2aa08c75c PPC: Add helper function for folding arithmetic ops. 2010-09-08 00:14:36 +02:00
Mike Pall
932193baa6 PPC: Add modulo instructions. 2010-09-08 00:12:23 +02:00
Mike Pall
e9e7df5bfe PPC: Add heavily optimized floor/ceil/trunc functions. 2010-09-08 00:09:36 +02:00
Mike Pall
db735e0519 PPC: Add binary arithmetic instructions (except MOD). 2010-09-07 01:24:25 +02:00
Mike Pall
15834c3990 PPC: Add unary instructions. 2010-09-07 01:15:21 +02:00
Mike Pall
341820987b PPC: Add table constructors. 2010-09-06 15:20:58 +02:00
Mike Pall
711e55bdf8 PPC: Add tailcall instructions. 2010-09-04 12:58:36 +02:00
Mike Pall
684acbe930 PPC: Add call and iterator call instructions. 2010-09-03 21:02:55 +02:00
Mike Pall
b4c8b05ad5 PPC: Add table indexing with variable keys or uint8_t. 2010-09-03 19:35:44 +02:00
Mike Pall
5043efae7d PPC: Add table indexing with string keys. Add get/set global. 2010-09-03 19:31:07 +02:00
Mike Pall
f708d31bcc Explicitly indicate tailcall from fast function fallback. 2010-09-02 17:16:56 +02:00
Mike Pall
44fb3ebc64 PPC: Add unary test and copy instructions. 2010-09-01 20:29:29 +02:00
Mike Pall
7457ee869a PPC: Add comparison instructions. 2010-09-01 20:27:39 +02:00
Mike Pall
222e01fa83 PPC: Add loop instructions. 2010-09-01 20:24:08 +02:00
Mike Pall
7ccdc8045b PPC: Unwind the stack after an error is thrown. 2010-09-01 00:27:48 +02:00
Mike Pall
d67eb4de49 PPC: Handle stack growth on return to C. 2010-09-01 00:25:35 +02:00
Mike Pall
d71bd78b8f PPC: Add move and constant instructions. 2010-09-01 00:19:27 +02:00
Mike Pall
8876704e05 Improve coalescing of multiple KPRI instructions to KNIL. 2010-09-01 00:18:00 +02:00
Mike Pall
00d10711ae PPC: Add return instructions. 2010-08-31 23:55:18 +02:00
Mike Pall
fc1866fb6f PPC: Handle stack growth during function calls. 2010-08-31 23:52:45 +02:00
Mike Pall
233dc76078 PPC: Add support to call Lua functions. 2010-08-31 23:47:55 +02:00
Mike Pall
96c1d8a8ad PPC: Clean up JIT/non-JIT symbol declarations in assembler part. 2010-08-31 00:49:29 +02:00
Mike Pall
f4d4af1b6d PPC: Add support to call C functions and to return back to C.
Command line starts now, but it can't run any Lua code yet.
2010-08-31 00:29:38 +02:00
Mike Pall
690b1f3e4b PPC: Add entry and exit points into VM. Add type check macros. 2010-08-31 00:17:22 +02:00
Mike Pall
4ef6564f2e PPC: Add instruction/call decode + dispatch macros. 2010-08-31 00:05:10 +02:00
Mike Pall
c7f91f8cd1 PPC: Add register assignments and type definitions. 2010-08-31 00:04:32 +02:00
Mike Pall
e1efd0d871 Minor tweaks to integration of assembler part.
Remove unneeded PC restore in vm_growstack_*.
Don't declare symbols that are unused in interpreter-only builds.
Don't embed lj_vm_foldfpm in interpreter-only builds.
Add 2nd temporary TValue in lua_State.
2010-08-29 20:04:40 +02:00
Mike Pall
844e40d700 PPC: Clean up masked shift/rotate target settings. 2010-08-29 12:52:20 +02:00
Mike Pall
9cb5046c3f PPC: Add stack frame layout for PPCSPE target.
PPCSPE target compiles now, but will trap for any NYI parts.
Cross-compilation instructions:
  make HOST_CC="gcc -m32" CROSS=powerpc-e500v2-linux-gnuspe- TARGET=ppcspe
2010-08-27 18:32:24 +02:00
Mike Pall
b3bd9b55e0 Improve target architecture detection in src/Makefile. 2010-08-27 18:17:29 +02:00
Mike Pall
a8d23e84e6 PPC: Add build rules and preprocessed skeleton for PPCSPE target. 2010-08-27 17:28:07 +02:00
Mike Pall
96b60d5ef3 PPC: Add skeleton for PowerPC interpreter. 2010-08-27 16:52:45 +02:00
Mike Pall
877ff1e28e Always enable check mode for DynASM (only used at build-time). 2010-08-27 13:19:35 +02:00
Mike Pall
a0e3c9bb5a PPC: Add support for word-wise relocations to buildvm asm targets. 2010-08-27 13:08:58 +02:00
Mike Pall
5526fa2312 PPC: Add PowerPC target architecture selection. 2010-08-25 13:00:42 +02:00
Mike Pall
06ae534328 Fix string.format() for non-finite numbers. 2010-08-24 23:06:10 +02:00
Mike Pall
d668373654 RELEASE LuaJIT-2.0.0-beta5 2010-08-24 15:10:40 +02:00
Mike Pall
55017d4626 Fix formatting of canonicalized number to string conversions. 2010-08-23 20:06:36 +02:00
Mike Pall
65b8c36def Fix encoding of doubles for mixed-endian cross builds. 2010-08-09 18:55:37 +02:00
Mike Pall
0d6f6f3fa0 Clean up some more DynASM target dependencies. 2010-08-08 18:03:20 +02:00
Mike Pall
be19218a6c Fix return from pcall within active hook. 2010-08-07 20:26:00 +02:00
Mike Pall
44de7eb48c Keep framesize in RA of FUNCC/FUNCCW instructions, too 2010-08-06 19:43:55 +02:00
Mike Pall
3d81368331 Fix lua_cpcall(). Duplicate save corrupted C frame chain. 2010-08-06 14:34:54 +02:00
Mike Pall
0a3329c581 Fix some compiler warnings. 2010-08-03 23:11:12 +02:00
Mike Pall
33ef1fa524 Untangle some target dependencies. 2010-08-03 22:09:12 +02:00
Mike Pall
a6b7952f7e Use FuncState typedef in favor of struct. 2010-08-03 22:08:08 +02:00
Mike Pall
c5feda2d53 Speed up string compares in string interning. 2010-07-21 23:55:05 +02:00
Mike Pall
420124372b Switch to fast string hash. 2010-07-21 22:53:27 +02:00
Mike Pall
d05873ee0a Abstract out pointer hash to hashrot(). Tune hash constants. 2010-07-21 22:06:38 +02:00
Mike Pall
6667ab0f26 Use independent hash for VM event dispatch. 2010-07-21 21:23:45 +02:00
Mike Pall
2ca58aa67d Fix arg check for two-arg SSE math functions in interpreter. 2010-07-14 14:11:48 +02:00
Mike Pall
0d3f190d94 Fix passing of constant args in FPRs on x64. 2010-07-14 13:04:29 +02:00
Mike Pall
7d5a3cb5d4 Rechain pseudo-resurrected string keys with colliding hashes. 2010-07-04 23:07:21 +02:00
Mike Pall
bbd1584d5f Do not eliminate PHIs for values only referenced from side exits. 2010-06-30 23:30:08 +02:00
Mike Pall
9f6707ddbb Fix frame setup for error handling in next(). 2010-06-28 18:07:34 +02:00
Mike Pall
cdc37a33b3 Fallback to metamethod resolving for tostring in print(). 2010-06-16 19:43:07 +02:00
Mike Pall
fa673eb179 Fix string.char() range check on x64. 2010-05-30 12:29:55 +02:00
Mike Pall
926f688cd0 Canonicalize string conversion of nan, inf, -inf. 2010-05-20 00:40:51 +02:00
Mike Pall
c7a3103f41 Fix handling of failed fp:read(..., "*n"). 2010-05-15 18:10:41 +02:00
Mike Pall
655401f3e9 Avoid name clash with standard POSIX function. 2010-05-09 22:47:09 +02:00
Mike Pall
41ec9a94b3 Avoid string allocation in GDB JIT API. 2010-05-09 03:27:24 +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
8fa1db826c Create symbol table of JIT-compiled code for use with Linux perf tools.
Enable with: -DLUAJIT_USE_PERFTOOLS
2010-05-01 04:27:14 +02:00
Mike Pall
f28a42c923 Fix PHI elimination: mark right PHI as used, too. 2010-04-28 22:00:40 +02:00
Mike Pall
28cfccf748 Turn TValue setter macros into inline functions. 2010-04-26 00:28:44 +02:00
Mike Pall
41379126a2 Treat the tag of a TValue as unsigned everywhere. 2010-04-25 23:21:15 +02:00
Mike Pall
f396f3d192 Avoid starting a GC cycle immediately after library init. 2010-04-25 19:45:54 +02:00
Mike Pall
2ccb24f894 Fix TNEW in x64 interpreter. Do not force a full GC (ouch). 2010-04-25 19:33:39 +02:00
Mike Pall
ef0904e80b Make metamethod names proper GC roots. 2010-04-25 18:35:47 +02:00
Mike Pall
87e4daf89c Reorganize and fix placement of generated machine code on x64. 2010-04-25 14:52:29 +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
3a32bbc7cb Simplify lexer a bit. 2010-04-24 20:23:02 +02:00
Mike Pall
28a6284642 Add assertions to guard against using lua_*call on dead coroutines. 2010-04-23 17:42:25 +02:00
Mike Pall
a6c52d80a2 Avoid compiler warning. 2010-04-23 15:38:08 +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
d8cb69ed07 Simplify GC step calls from on-trace code. 2010-04-19 23:41:48 +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
ff82df797a Refactor buildvm symbol generation.
Fixes Windows and OSX builds with LUAJIT_DISABLE_JIT.
2010-04-14 17:13:13 +02:00
Mike Pall
fbe092c22d Fix setup of RD when dispatching to function headers after exit. 2010-04-09 14:26:18 +02:00
Mike Pall
db756430ee Don't copy SNAP_NORESTORE mark into loops and suppress restore in exit. 2010-04-08 01:32:26 +02:00
Mike Pall
23189fa40d RELEASE LuaJIT-2.0.0-beta4 2010-03-28 19:26:33 +02:00
Mike Pall
1d1d9221f3 Fold HREF of TNEW/TDUP to niltv. Fold HLOAD of niltv to nil. 2010-03-28 06:53:41 +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
1130ade4de Also merge EQ(HREF, niltv) in backend. 2010-03-28 06:47:04 +02:00
Mike Pall
44756ded7a Only fuse with spill slots for cross-section references. 2010-03-28 06:42:48 +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
6038866f7d Pass MULTRES or negated error code in RD to lj_vm_exit_interp.
Fixes overwrite of saved r12 after trace exit.
2010-03-23 18:31:17 +01:00
Mike Pall
097db7317b Move colocated array part after GCtab (now properly aligned). 2010-03-22 15:59:50 +01:00
Mike Pall
361266518c Move free node pos to t->node[0].freetop. Saves 4 bytes in GCtab. 2010-03-22 15:05:37 +01:00
Mike Pall
51c14bf1c8 Avoid snapshots for returns to known callers. 2010-03-21 16:01:44 +01:00
Mike Pall
5c8f1f2594 Increase max. fusion distance. 2010-03-19 00:28:04 +01:00
Mike Pall
37a3ca330f Reorder various structs to reduce padding (thanks to /usr/bin/pahole). 2010-03-15 23:29:10 +01:00
Mike Pall
1fea5cb822 Fix TSETM on x64/SSE builds when table is resized. 2010-03-15 19:00:16 +01:00
Mike Pall
871941a840 Add static target to msvcbuild.bat. 2010-03-15 18:50:59 +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
a25a717089 Fix folding of (comparison x x). 2010-03-14 17:10:47 +01:00
Mike Pall
16f33422f1 Restore MULTRES for snapshots pointing to CALLM etc. bytecodes. 2010-03-13 17:45:09 +01:00
Mike Pall
4f19a15bd9 Fix potential hang in UCLO redirection handling in hooks. 2010-03-10 22:13:23 +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
2e614adb21 Do not fuse SLOAD across RETF. 2010-03-08 23:43:16 +01:00
Mike Pall
09e875519b RELEASE LuaJIT-2.0.0-beta3 2010-03-07 19:30:21 +01:00
Mike Pall
f354b46d29 Fix tracebacks for failed coroutines. 2010-03-07 18:21:14 +01:00
Mike Pall
6769397d38 Rebase dynamic library on OSX/x64. 2010-03-07 15:04:42 +01:00
Mike Pall
e40b001a79 Improve placement of dynamically generated code on x64. 2010-03-07 14:33:52 +01:00
Mike Pall
e38fbb3d0a Fix assertion in rec_check_slots. 2010-03-07 14:32:50 +01:00
Mike Pall
e807d46931 Generate indirect calls for out-of-range distances on x64. 2010-03-07 14:31:51 +01:00
Mike Pall
b4299256cd Fix unwind info for assembler part for OSX. 2010-03-07 14:29:04 +01:00
Mike Pall
5594a0c653 Fix generated 64 bit Mach-O assembler output. 2010-03-05 03:21:52 +01:00
Mike Pall
f76e5a311b Allocate 32 bit memory on OSX/x64 with mmap() hinting.
Must set -pagezero_size, otherwise the lower 4GB are blocked.
2010-03-04 16:27:42 +01:00
Mike Pall
3d2abf3148 Build as a native 32 or 64 bit binary by default. 2010-03-04 16:23:28 +01:00
Mike Pall
15c3bd7725 Improve performance of HREF/HREFK on x64. 2010-03-03 04:26:31 +01:00
Mike Pall
5fdb6e2e20 Fix 64 bit conversion warning. 2010-03-03 04:25:48 +01:00
Mike Pall
32309583e5 Improve register allocation on x64. 2010-03-02 23:34:13 +01:00
Mike Pall
20fa30b388 Fix comments about 64 bit FreeBSD mmap() behavior. 2010-03-02 21:53:59 +01:00
Mike Pall
1cda54a3ab Add compile errors for 64 bit OS without an equivalent of MAP_32BIT. 2010-03-02 19:41:56 +01:00
Mike Pall
a1bacd8d68 Fix amalgamated build. 2010-03-02 01:48:37 +01:00
Mike Pall
5d0b65519c Enable tracing of recursion.
Now compiles tail-recursion, up-recursion and down-recursion.
Benchmarks vs. Lua: fib 20x, ack 23x, binary-trees 4.7x.
2010-03-01 06:54:35 +01:00
Mike Pall
e7b737aa12 Implement down-recursion. 2010-03-01 06:45:30 +01:00
Mike Pall
69ea553024 Fix pc to line number translation for GDB JIT API. 2010-03-01 06:33:48 +01:00
Mike Pall
7e696124ec Resize stack up to the true limit. 2010-03-01 05:51:04 +01:00
Mike Pall
89c90f0955 Fix error message generation for OOM error. 2010-02-28 22:22:45 +01:00
Mike Pall
8cc50cf6b1 Conditionally compile functions that are unused with JIT disabled. 2010-02-28 21:58:40 +01:00
Mike Pall
2e22d33d9d Enable JIT compiler for x64.
Only works on Linux/x64 and Windows/x64 right now.
Force an x64 build on Linux/x64 with: make CC="gcc -m64"
NYI: handle on-trace OOM errors.
NYI: improve register allocation for x64.
2010-02-28 21:51:01 +01:00
Mike Pall
956065fd04 Add frame info for x64 GDB JIT API. 2010-02-28 17:52:11 +01:00
Mike Pall
2144d55eb8 Save/restore remaining callee-save regs on trace<->interp transitions. 2010-02-27 21:40:40 +01:00
Mike Pall
ec78d3177e Correctly align and free allocated machine code areas.
Bump default mcode area size to 64K for x64.
2010-02-27 20:18:11 +01:00
Mike Pall
52b7651327 Place dynamically generated code near static code on x64. 2010-02-26 18:20:24 +01:00
Mike Pall
a0fbb05bf0 Make penalty PRNG available for general use by compiler. 2010-02-26 17:01:33 +01:00
Mike Pall
3c6cec0846 Add x64 call argument setup. More 32/64 bit cleanups in assembler. 2010-02-25 03:35:07 +01:00
Mike Pall
b95294572c Move SIMD constants to jit_State to keep them in the low 4GB. 2010-02-24 23:17:17 +01:00
Mike Pall
b32f4f4549 Handle negative continuation offsets (WIN64 with debug). 2010-02-24 20:39:41 +01:00
Mike Pall
4e73488985 Fix 64 bit conversion warnings. 2010-02-24 20:02:20 +01:00
Mike Pall
4c9f71be5d Major 32/64 bit cleanups in assembler and exit handling.
Add 64 bit lightuserdata handling. Keep the tagged 64 bit value.
Allocate/save/restore 64 bit spill slots for 64 bit lightuserdata.
Fix code generation for 64 bit loads/stores/moves/compares.
Fix code generation for stack pointer adjustments.
Add fixed spill slot definitions for x64. Reduce reserved spill slots.
Disable STRREF + ADD fusion in 64 bit mode (avoid negative 32 bit ofs).
2010-02-24 07:09:34 +01:00
Mike Pall
e46f4c8a11 Fix 64 bit portability problem in rec_ret(). 2010-02-24 05:29:46 +01:00
Mike Pall
13a9d7e135 Add trace exit helper for x64. Fix trace entry for x64. 2010-02-24 01:32:44 +01:00
Mike Pall
2f3a917f2f Check relative jump distances for x64. 2010-02-24 01:29:11 +01:00
Mike Pall
47da0d8018 Fix type() implementation for x64 lightuserdata. 2010-02-24 01:23:52 +01:00
Mike Pall
857f538eac Fix exit state for 64 bit mode. 2010-02-24 01:18:49 +01:00
Mike Pall
8ae2f9feaa Randomize penalties for aborts and add blacklisting. 2010-02-23 19:41:32 +01:00
Mike Pall
d5c8fe4b90 Mark renamed registers as modified. 2010-02-23 17:22:12 +01:00
Mike Pall
c1362dcac9 Don't eliminate SLOAD restores across RETF.
Move restore-elimination logic into snapshot_slots().
2010-02-23 03:08:49 +01:00
Mike Pall
f751cd1d6f Do not patch parent exit for a stack check. 2010-02-22 21:21:52 +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
e76bcd2914 Refactor Lua stack handling in lj_asm.c. 2010-02-21 17:26:21 +01:00
Mike Pall
c1658ddcf1 Eliminate redundant stack checks. Add checks for growing root traces. 2010-02-21 16:47:43 +01:00
Mike Pall
c52da1f2da Rethrow errors from trace exit handling from the right C frame. 2010-02-19 03:13:48 +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
65586ca4dc Adapt bytecode patching/unpatching for hot calls. 2010-02-18 17:17:50 +01:00
Mike Pall
59f54be9d3 Update trace recorder infrastructure for hot calls. 2010-02-18 06:07:31 +01:00
Mike Pall
2f300fb66a Fix some uses of tref_isint(). 2010-02-18 03:24:18 +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
8060f5b531 Just disable JIT compiler for non-SSE2 CPUs instead of aborting. 2010-02-16 23:39:24 +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
afa07e0c46 Improve error reporting for traces aborted in non-Lua functions. 2010-02-15 22:44:23 +01:00
Mike Pall
e664945e0b Change record vmevent parameters. Dump function id on FUNC*. 2010-02-15 22:26:33 +01:00
Mike Pall
e1905f498a Use a different marker for hot calls. 2010-02-15 18:04:06 +01:00
Mike Pall
3452bfcf8c Add generic function handling for debug modules.
Don't call record vmevent for non-Lua functions.
2010-02-15 17:36:29 +01:00
Mike Pall
b838cd8dca Minor cleanup of trace event handling. 2010-02-15 16:41:52 +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
2a2f8ed6a1 Implement return hooks for Lua functions (zero-cost if disabled). 2010-02-14 20:48:33 +01:00
Mike Pall
8e38231f9e Implement call hooks (zero-cost if disabled). 2010-02-14 17:47:03 +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
4f8d7be8ea Extend scope of local vars in debug info beyond final return. 2010-02-12 16:17:42 +01:00
Mike Pall
b2067236c5 Move dispatch tables out of GG_State struct. 2010-02-11 16:21:18 +01:00
Mike Pall
565eb39574 Drop frame clearing in exit handling and JIT compiled code. 2010-02-11 01:50:32 +01:00
Mike Pall
ab90b8fc2b Switch to pre-initialized stacks. Drop frame clearing in interpreter. 2010-02-11 01:21:40 +01:00
Mike Pall
bb0384c366 Replace GCproto reference with bytecode PC in GCfuncL. 2010-02-10 21:45:57 +01:00
Mike Pall
d5a46621f9 Drop bc field in GCproto since the bytecode is colocated. 2010-02-08 20:17:34 +01:00
Mike Pall
2ddea3838d Fix constructor bytecode generation for conditional values. 2010-02-08 16:08:58 +01:00
Mike Pall
f86f9e8eec Reduce whitespace in lj_bcdef.h. 2010-02-08 05:35:18 +01:00
Mike Pall
6194b1c896 Redesign of prototype generation, part 5: colocation of protoype arrays. 2010-02-08 05:30:57 +01:00
Mike Pall
f275a9d7ef Redesign of prototype generation, part 4: late creation of prototype. 2010-02-08 05:29:47 +01:00
Mike Pall
4424027844 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.
2010-02-08 05:28:57 +01:00
Mike Pall
48d93d8c84 Redesign of prototype generation, part 2: late init of chunkname. 2010-02-08 05:27:43 +01:00
Mike Pall
60b5af4422 Redesign of prototype generation, part 1: varinfo and uvname.
Use a growable, per-chunk variable stack.
Collect varinfo/uvname for prototype at the end.
2010-02-08 05:26:52 +01:00
Mike Pall
1307f49137 Major cleanup of bytecode parser. 2010-02-06 08:18:32 +01:00
Mike Pall
1f39cc5c21 Update .gitignore. 2010-02-06 08:18:20 +01:00
Mike Pall
c4dadf1d67 Move bytecode offsets from lj_vm.* to generated header. 2010-02-05 20:15:01 +01:00
Mike Pall
a0914c409b 32/64 bit memory ref cleanup, part 4: GCproto ->varinfo. 2010-02-05 01:35:38 +01:00
Mike Pall
8dcc4364cf 32/64 bit memory ref cleanup, part 3: GCproto ->lineinfo. 2010-02-05 01:16:22 +01:00
Mike Pall
d778982120 32/64 bit memory ref cleanup, part 2: GCproto ->uvname and ->chunkname. 2010-02-05 00:52:21 +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
370c868c31 RETF modifies BASE. Treat it like a store or it gets CSEd. 2010-02-04 21:36:32 +01:00
Mike Pall
5d2690c608 Reset the hotcount table after a JIT off to on transition. 2010-02-04 20:40:00 +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
c1c9abeab7 Add extra check to suppress hotcall event during recording. 2010-02-03 14:34:30 +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
61c5a60dc3 Improve coalescing of BASE register in side traces. 2010-02-01 23:32:26 +01:00
Mike Pall
9a682f341d Revise hardcoded inlining in lj_asm.c. Saves 1-2K. 2010-01-30 14:33:08 +01:00
Mike Pall
02e58f5e56 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.
2010-01-30 06:50:39 +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
725da9224d Don't modify jit_State and exit counters while in vmevent.
Fixes crash with hot loop in TEXIT callback which cleared J->parent.
2010-01-28 02:30:12 +01:00
Mike Pall
21d6709271 Avoid reuse of PHI registers, even for duplicate right PHIs. 2010-01-27 22:09:43 +01:00
Mike Pall
09b8f67cd8 Expose compressed snapshot map to reflection API.
Update jit.dump module and restore printing of frame separators.
2010-01-27 20:06:03 +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
c8a80fa989 Cleanup types for narrowing stack machine. 2010-01-27 00:39:22 +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
e058714a2e Add missing eviction in asm_obar(). 2010-01-26 02:56:00 +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
055396a69d Force error if lua_newstate() is used in 64 bit mode. 2010-01-24 15:50:59 +01:00
Mike Pall
43f1e13470 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.
2010-01-22 01:56:49 +01:00
Mike Pall
c56811bb7a Fix undefined behavior in table resizing calculation. 2010-01-21 19:42:51 +01:00
Mike Pall
419cbb3aa9 Fix ordered string comparisons. Unsigned arithmetic is evil. 2010-01-21 15:29:23 +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
36769c2f6b Fix broken intarith + testop optimization. 2010-01-19 01:45:39 +01:00
Mike Pall
4e39597ba6 Add some sanity checks for allocator in 64 bit mode. 2010-01-18 01:32:33 +01:00
Mike Pall
32969abe40 Reduce non-numeric tag range by bumping up 64 bit lightud tag. 2010-01-18 00:42:34 +01:00
Mike Pall
4b0725d5fc Fix more 64 bit conversion warnings. 2010-01-17 20:47:10 +01:00
Mike Pall
09548024d1 Silence 64 bit conversion warning. 2010-01-17 20:36:04 +01:00
Mike Pall
09ca54d9bc 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.
2010-01-17 20:33:13 +01:00
Mike Pall
49e3bdf080 Allocate 32 bit memory on WIN64 using NtAllocateVirtualMemory. 2010-01-17 20:20:43 +01:00
Mike Pall
62fafb5a72 Fix off-by-one error in x64 PE object symbol mangling. 2010-01-17 19:58:31 +01:00
Mike Pall
3100026b86 Error for blacklisted loop bytecodes has no info argument. 2010-01-16 02:04:12 +01:00
Mike Pall
82417ee889 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).
2010-01-14 12:28:16 +01:00
Mike Pall
a431d6f35c Shorten %p format for pure 32 bit pointers on x64. 2010-01-14 12:08:32 +01:00
Mike Pall
767035f031 Strip '@' suffix from external symbols for MACH-O, too.
Fixes OSX build.
2010-01-10 09:39:05 +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
2cc554db0c Avoid int16_t widening for pt->uv elements. 2010-01-09 22:41:08 +01:00
Mike Pall
a33204ae5e Fix 32/64 bit portability issue with upval->v. 2010-01-09 21:11:35 +01:00
Mike Pall
ece20f8ca2 Fix x64 PE object emitter. 2010-01-09 21:10:22 +01:00
Mike Pall
4d9be5b8f8 Bump all copyright dates to 2010. 2010-01-09 14:28:11 +01:00
Mike Pall
c31ac26fb9 Add support for WIN64 exception handling to external unwinder.
Modify unwinding to always return _ff or _c unwind type.
Generate PE object .pdata/.xdata sections for x64 interpreter.
Can drop r12-r15 saves in Windows/x64 interpreter now.
2010-01-05 22:39:46 +01:00
Mike Pall
b3e3bad0ff Fix PE object build for fastcall entry points into interpreter. 2010-01-05 22:13:20 +01:00
Mike Pall
93ee10642e Major rewrite of error handling to allow external/internal unwinding.
Make external unwinding the default on x64.
It's mandatory on WIN64 due to the abundance of callee-saved regs.
Allow piecewise internal frame unwinding and optional cleanup.
Store ERRMEM, ERRERR and ERRCPP early and copy down later.
Use FRAME_CP for lj_vm_resume.
Add lj_vm_unwind_*_eh variants as landing pads for external unwinder.
Use fastcall for lj_vm_unwind_*.
Can drop r12/r13 saves in POSIX/x64 interpreter now.
2010-01-02 17:42:11 +01:00
Mike Pall
8fc9430d06 Rename NRESULTS to MULTRES on the assembler side, too. 2009-12-30 02:38:40 +01:00
Mike Pall
9de0f53a8d Implement yield from C hooks.
Get number of multiple results from C frame.
Add lj_cont_hook: restores multres and dispatch to static ins.
Can use fastcall for lj_dispatch_ins() now.
2009-12-30 02:37:57 +01:00
Mike Pall
52eb88773e Fix narrowing casts of pointer differences for x64. 2009-12-29 20:19:54 +01:00
Mike Pall
d64b031269 Minor fixes for x64 interpreter. 2009-12-29 20:16:29 +01:00
Mike Pall
82f7d0907c Fix PE object build on x64 and with disabled interpreter. 2009-12-29 20:13:34 +01:00
Mike Pall
42124227cf Add DWARF2 unwind info for x64 interpreter. 2009-12-29 05:25:24 +01:00
Mike Pall
24429ed1f5 Fix alloc/free sizes of internal GCRef arrays. 2009-12-29 04:36:35 +01:00
Mike Pall
81c9f5de89 Fix various 32/64 bit issues in interpreter. 2009-12-29 03:03:09 +01:00
Mike Pall
241e8db3f1 Fix bad stack setup in collectgarbage(). 2009-12-29 02:34:15 +01:00
Mike Pall
52f310bd3e Fix x64 lj_vm_pow_sse(). 2009-12-29 02:16:52 +01:00
Mike Pall
d18d1573d8 Save all callee-saved x64 integer regs for unwinding.
Temporary measure. Does not cover xmm saves on WIN64.
May have to use unwind info or waste another 160 bytes per CFRAME.
2009-12-29 02:04:20 +01:00
Mike Pall
374f534715 Logical 'not' must be sign-extended for address operands. 2009-12-29 01:38:26 +01:00
Mike Pall
8a9cfa4b45 Define CFRAME structure for x64 interpreter. 2009-12-28 23:45:32 +01:00
Mike Pall
61abf342a3 Linux/x64 mremap() does not obey MAP_32BIT, so make it non-moving. 2009-12-28 23:33:10 +01:00
Mike Pall
9c8f42573f Fix size calculation for closure structs. 2009-12-28 22:15:00 +01:00
Mike Pall
07e1a0d138 Fix POSIX/x64 call argument order. 2009-12-28 21:32:15 +01:00
Mike Pall
7b7c6ed754 Change callee-save regs for x64 interpreter to shorten code. 2009-12-28 21:18:44 +01:00
Mike Pall
8bb38bd93b Final calling convention cleanup for x64 interpreter. 2009-12-28 20:05:31 +01:00
Mike Pall
3a15e46b79 More calling convention cleanups for x64 interpreter. 2009-12-27 18:44:12 +01:00
Mike Pall
bc47063708 Use fastcall for remaining 1-arg/2-arg calls from interpreter.
Simplifies conversion to x64 calling conventions.
2009-12-27 17:42:41 +01:00
Mike Pall
690760aa38 Add SSE variant of pow/powi to interpreter.
Use SSE pow/powi helper functions from compiled code.
Cleanup use of helper functions.
Related cleanups of folding functions in x64 interpreter.
2009-12-25 23:12:30 +01:00
Mike Pall
6ce0c90ed6 Add build infrastructure for the SSE2-enabled interpreter.
Works on x86 now. Will be enabled by default on x64 (not ready, yet).
2009-12-22 20:27:20 +01:00
Mike Pall
a5faa29aa9 Fix last commit. 2009-12-22 06:23:22 +01:00
Mike Pall
c4e9dc0012 Miscellaneous cleanups for x64 interpreter. 2009-12-22 06:16:29 +01:00
Mike Pall
44a9d7b00c Use SSE variants for IRFPM_FLOOR/CEIL/TRUNC unless SSE4.1 available. 2009-12-22 05:40:49 +01:00
Mike Pall
298e3f5d54 Add SSE2 variants for all FP ops (except vm_pow*) in interpreter. 2009-12-22 05:04:21 +01:00
Mike Pall
ab02f069aa Add SSE2 variants of basic arithmetic ops in interpreter. 2009-12-21 20:11:02 +01:00
Mike Pall
34d716947c Properly compile on Debian kFreeBSD. 2009-12-20 18:41:55 +01:00
Mike Pall
a1d4d05f2c Adapt most outbound calls in interpreter to x64 calling conventions. 2009-12-19 17:25:54 +01:00
Mike Pall
ed8d86bf66 Better change the saved regs for the x64 interpreter, too. 2009-12-18 03:10:52 +01:00
Mike Pall
db29a8cb04 Change KBASE/PC regs for x64/POSIX to get shorter encodings. 2009-12-17 22:14:24 +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
1e7951ea7b Cleanup DynASM action list flushes. 2009-12-16 22:31:15 +01:00
Mike Pall
85d32aeb36 Change some misuses of esp in x64 interpreter. 2009-12-16 04:37:30 +01:00
Mike Pall
4cb357d30f Define x64 interpreter frame and cleanup use of stack temps. 2009-12-16 01:29:07 +01:00
Mike Pall
8df9603888 Unify interpreter reg saves/restores for WIN64 prolog/epilog req. 2009-12-15 21:36:42 +01:00
Mike Pall
1eedc6d2f1 First bunch of register definitions for x64 interpreter. 2009-12-15 05:40:44 +01:00
Mike Pall
547508f36f Fix off-by-one error in err_chunkid(). 2009-12-14 02:28:22 +01:00
Mike Pall
ec2442862f Reorg Makefile to allow more overrides on the make command line. 2009-12-08 22:27:14 +01:00
Mike Pall
6163a90d6d Remove asm auto-detection due to cross-compilation issues. 2009-12-08 21:28:49 +01:00
Mike Pall
699232f667 Add DynASM-built files to public repo. 2009-12-08 20:40:15 +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
5287b93264 LuaJIT-2.0.0-beta2 hotfix #2
Fix lua_tocfunction().
Fix cutoff register in JMP bytecode for some conditional expressions.
Fix PHI marking algorithm for references from variant slots.
2009-12-08 19:52:28 +01:00
Mike Pall
2d0ef4522b LuaJIT 2.0.0-beta2 hotfix #1
Fix LUA_XCPATH.
Fix DWARF unwinding info for OSX.
2009-12-08 19:50:21 +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