Commit graph

927 commits

Author SHA1 Message Date
Magnus Norddahl
534606f4ce - add vm_jit cvar to control JIT compilation 2018-11-01 21:39:30 +01:00
Magnus Norddahl
369dcfd57f Merge remote-tracking branch 'origin/master' into asmjit 2018-11-01 21:23:26 +01:00
alexey.lysiuk
8597c9e326 - added warning for constant conditional expression
ZScript code like `if (x = 0) // ...` no longer causes assertion failure in Debug but produces a warning regadless of configuration

https://forum.zdoom.org/viewtopic.php?t=62422
2018-11-01 16:05:27 +02:00
Christoph Oelckers
b9f2cce8de - versioned the return mismatch check to demote it to a warning for older versions than 3.7. 2018-11-01 11:30:53 +01:00
alexey.lysiuk
d3461be40c - made 'return void' case a compilation error 2018-11-01 11:18:22 +01:00
Magnus Norddahl
295fc7d7f7 Revert "- the build tests are using some ancient dino 7.1 Windows SDK where UnwindInfoAddress isn't part of the struct yet."
This reverts commit 20516e1c0b.
2018-10-17 08:54:41 +02:00
Magnus Norddahl
20516e1c0b - the build tests are using some ancient dino 7.1 Windows SDK where UnwindInfoAddress isn't part of the struct yet. 2018-10-15 03:06:40 +02:00
Magnus Norddahl
1f0add9067 - update JIT PARAM handling to match the VM instruction change 2018-10-14 23:13:30 +02:00
Magnus Norddahl
70f18f87b9 Merge remote-tracking branch 'origin/master' into asmjit 2018-10-14 22:55:57 +02:00
Magnus Norddahl
1a2e5b12d0 - RUNTIME_FUNCTION only exists in 64-bit Windows 2018-10-14 22:54:30 +02:00
Christoph Oelckers
dd719f0f14 - extended the register limit for 'param'.
The instruction one free instruction byte so it's now using that to extend its argument's register range to 65535.
For param this is needed because it passes strings by reference and creating an implicit temporary copy for string constants does not work here.
2018-10-14 09:13:26 +02:00
Magnus Norddahl
cd211da2d8 - fix wrong shift direction 2018-10-14 08:53:18 +02:00
Magnus Norddahl
a3f6950a4f - build enough of the unwind opcodes for visual studio's debugger to produce the correct call stack 2018-10-14 08:27:27 +02:00
Magnus Norddahl
cf9bae67a8 - construct our own runtime as the one provided by asmjit is too primitive 2018-10-14 00:46:54 +02:00
Magnus Norddahl
300553a21f - add more names to asmjit objects 2018-10-12 08:02:35 +02:00
Magnus Norddahl
7ca598de2d - remove the frameX registers as they were just constant offsets to vmframe that could be merged into other constant offsets 2018-10-12 07:41:16 +02:00
Magnus Norddahl
b15ca09486 - give the remaining virtual registers names 2018-10-12 07:05:42 +02:00
Magnus Norddahl
c86e4480b6 - give temp registers names and reuse the FString object for formatting names 2018-10-12 06:59:03 +02:00
Magnus Norddahl
0bb4a159e5 - skip RESULT opcodes when outputting assembly 2018-10-12 06:25:51 +02:00
Magnus Norddahl
44294a051a - clean up assembly output slightly by only generating labels for the opcodes jumped to 2018-10-12 06:14:27 +02:00
Magnus Norddahl
ade6ae24e9 - fix CASTB opcode implementation 2018-10-11 04:32:49 +02:00
Magnus Norddahl
fc870fce87 - fix missing convert from float to double in LSP and LSP_R opcodes
- fix missing convert from double to float in SSP and SSP_R opcodes
2018-10-11 03:53:11 +02:00
Magnus Norddahl
aa6e09f7e8 - fix debug build compile error 2018-10-11 03:14:42 +02:00
Magnus Norddahl
0120ea190c - remove the need to do any VARF_Native runtime checks by making native functions use the same calling convention as the script version 2018-10-10 23:47:56 +02:00
Magnus Norddahl
b6bc06e568 - do script calls directly from asmjit without using a lambda wrapper
- do VARF_Native check at compile time when possible
2018-10-10 22:08:26 +02:00
Magnus Norddahl
01825231ec - add -dumpjit command line parameter that dumps the JIT log for all functions to dumpjit.txt 2018-10-10 06:17:35 +02:00
Magnus Norddahl
452c6fd158 - fix return warning 2018-10-10 04:57:35 +02:00
Magnus Norddahl
884e185db0 - switch to using setjmp/longjmp for exception handling 2018-10-09 16:30:55 +02:00
Magnus Norddahl
2b05e75656 Merge branch 'asmjit' of https://github.com/coelckers/gzdoom into asmjit 2018-10-09 14:46:40 +02:00
Magnus Norddahl
3f4638ca31 - add disabled code that attempts to load registers directly from function arguments 2018-10-09 14:46:27 +02:00
Magnus Norddahl
9c3b8507af - add missing include statement 2018-10-09 07:15:46 +02:00
Magnus Norddahl
f0d9b49099 - allocate VMFrame on the stack for simple functions with no strings 2018-10-09 05:19:29 +02:00
Magnus Norddahl
bee3a964ae - remove argument not used anymore 2018-10-09 05:18:44 +02:00
Magnus Norddahl
b7c0cd5d05 - move VM creation into the jitted function. this will allow the jit compiler to skip vm frame creation when possible 2018-10-09 03:37:11 +02:00
Magnus Norddahl
e930dfaae7 - create ScriptCall function pointer on VMScriptFunction 2018-10-09 02:52:07 +02:00
Magnus Norddahl
137ef034d1 - modify the VM calling convention so that the callee sets up its own VM frame 2018-10-09 02:08:15 +02:00
Magnus Norddahl
367b60d88c - fix wrong registers getting saved when passing parameters by reference 2018-10-08 23:44:54 +02:00
Magnus Norddahl
d643fbd077 - removed CanJit as all opcodes are now implemented
- fix some store bugs
2018-10-07 22:21:48 +02:00
Magnus Norddahl
47bcf318a5 - fix 32 bit compile errors 2018-10-07 20:55:06 +02:00
Magnus Norddahl
f321f64a05 - catch and rethrow c++ exceptions 2018-10-07 20:38:08 +02:00
Magnus Norddahl
47485194f4 - reuse temp virtual registers 2018-10-07 09:02:28 +02:00
Magnus Norddahl
c5a5265e40 Merge remote-tracking branch 'origin/master' into asmjit 2018-10-07 06:32:13 +02:00
Magnus Norddahl
d47988202a - workaround bug in asmjit's register allocator for calls where the return register is already allocated in a physical register needed by one of the call arguments 2018-10-07 06:29:54 +02:00
Magnus Norddahl
5bf76523d6 - switch ToMemAddress to imm_ptr where allowed 2018-09-18 18:13:53 +02:00
Magnus Norddahl
05ac219ba6 - switch from ASMJIT_ARCH_X64 to ASMJIT_ARCH_64BIT when checking if we need to use 64-bit pointers 2018-09-18 18:05:53 +02:00
Magnus Norddahl
ad260aa971 - create a very basic OP_IJMP implementation 2018-09-17 21:52:21 +02:00
Magnus Norddahl
61735ddd8b - create CreateCall helper to get rid of a lot of the cc.call boilerplate 2018-09-17 12:00:25 +02:00
Magnus Norddahl
f61df60240 - implement OP_TAIL and OP_TAIL_K 2018-09-17 09:02:23 +02:00
Magnus Norddahl
d032914c3d - use the ParamOpcodes array for finding the OP_PARAM's used by a call 2018-09-17 00:31:25 +02:00
Magnus Norddahl
da040e818c - implement string version of OP_CAST 2018-09-17 00:17:32 +02:00
Magnus Norddahl
102c00ce13 - implement string part of OP_CASTB 2018-09-16 22:39:48 +02:00
Magnus Norddahl
c8e4bf089c - implement OP_LFP 2018-09-16 03:39:54 +02:00
Magnus Norddahl
ba4606c1d5 - read the parameters and registers directly off the stack 2018-09-16 03:20:56 +02:00
Jonathan Russell
69bc39914b - changed a bunch of manual address additions in string opcodes to leas 2018-09-15 21:09:43 +01:00
Magnus Norddahl
3477b22714 - more load fixes 2018-09-15 18:08:01 +02:00
Magnus Norddahl
4364feea9a - fix truncated load addresses due to a bug in asmjit
- change ToMemAddress to use uint64_t
2018-09-15 15:38:16 +02:00
Magnus Norddahl
06b54d3aaa - avoid certain x86::ptr overloads as the last argument is not always an offset 2018-09-15 15:05:52 +02:00
alexey.lysiuk
7d1af25b46 Fixed code generation of infinite for loop
https://forum.zdoom.org/viewtopic.php?t=62023
2018-09-15 13:19:28 +02:00
Jonathan Russell
407418a92e - fixed typo in last commit 2018-09-15 00:26:14 +01:00
Jonathan Russell
b83f4f48d6 - implemented SS_R, LCS_R, and LKS_R 2018-09-15 00:25:13 +01:00
Magnus Norddahl
ce9925d257 - fix bug in LKF_R 2018-09-15 01:06:48 +02:00
Magnus Norddahl
7e7bce4965 - fixed OP_VTBL bug 2018-09-15 00:28:34 +02:00
Magnus Norddahl
266f838de7 - fix crash in OP_RET handling 2018-09-15 00:12:12 +02:00
Magnus Norddahl
663e61a4fb - simplify some code 2018-09-14 23:38:57 +02:00
Magnus Norddahl
90d8d4af24
Merge pull request #573 from Gutawer/asmjit
Added string PARAM and RET
2018-09-14 20:07:47 +02:00
Jonathan Russell
11fbd9a0a4 - added string PARAM and RET 2018-09-14 18:20:31 +01:00
Magnus Norddahl
4e85134d8e Merge remote-tracking branch 'gzdoom/master' into asmjit 2018-09-14 02:09:17 +02:00
Magnus Norddahl
d09a377f12 - fix clang errors and warnings 2018-09-14 01:07:05 +02:00
Jonathan Russell
0b6c514067 - added OP_MOVES, OP_CONCAT, OP_LENS, OP_CMPS 2018-09-13 20:31:06 +01:00
Magnus Norddahl
c359601737 - fix opcodes not being listed in jit debug assembly 2018-09-13 19:03:30 +02:00
Magnus Norddahl
b92e5fbf2a - move EmitRESULT to jit_call 2018-09-13 02:56:02 +02:00
Magnus Norddahl
fad8c9c7b4 - minor cleanups in header file 2018-09-13 02:38:51 +02:00
Magnus Norddahl
ef170883ef - split JitCompiler into multiple files 2018-09-13 02:29:04 +02:00
Jonathan Russell
b8bdc3b4c8 - added strings and a few string opcodes 2018-09-12 23:56:04 +01:00
Magnus Norddahl
afc3c6b562 - fix CALL_K and disable CALL 2018-09-12 21:58:31 +02:00
Magnus Norddahl
ced793b791 - implement OP_CALL and OP_CALL_K 2018-09-12 01:37:30 +02:00
Magnus Norddahl
981950fef0 - fix misc integer opcodes and remove mov statements when they have no effect 2018-09-11 23:31:32 +02:00
Jonathan Russell
4d3c496121 - changed the way EmitComparisonOpcode works to get rid of the temporary register that was used previously 2018-09-11 21:48:02 +01:00
Magnus Norddahl
4d1cb258d6 - implement PARAM and PARAMI 2018-09-11 17:08:51 +02:00
Magnus Norddahl
6f55c76f05 - fix missing zero extend 2018-09-09 23:21:47 +02:00
Magnus Norddahl
4076ce791b - fix that the code for META and CLSS was swapped 2018-09-09 22:42:59 +02:00
Magnus Norddahl
19442732d4 - some jump fixes 2018-09-09 22:03:57 +02:00
Magnus Norddahl
b40cbfb22e - fix jump direction in EmitComparisonOpcode 2018-09-09 20:35:37 +02:00
Jonathan Russell
eeb4419bc4 - more spelling mistakes... 2018-09-02 23:47:22 +01:00
Jonathan Russell
fdf17a5d8e - fix minor spelling error 2018-09-02 23:45:32 +01:00
Jonathan Russell
28f2311108 - add vector comparison opcodes 2018-09-02 23:44:25 +01:00
Christoph Oelckers
4571aa52f0 - fixed bad code for OP_SRL_KR. 2018-09-02 18:20:38 +02:00
Magnus Norddahl
168c274601 - remove some macros and add functions checking if a register needs to be copied 2018-09-02 15:36:39 +02:00
Magnus Norddahl
55955b9c22 Merge remote-tracking branch 'gzdoom/master' into asmjit 2018-09-02 03:46:06 +02:00
Magnus Norddahl
323d290c99 - implemented LBIT, SBIT, VTBL, SCOPE, NEW, NEW_K, THROW, EQA_R and EQA_K 2018-09-02 03:39:02 +02:00
Magnus Norddahl
ccd2f58fb4 - implement emitter functions for LKP_R, META, CLSS, LO, LO_R, LP, LP_R, SO, SO_R, SP, SP_R
- add emit code for throwing exceptions on null pointers
2018-08-31 06:57:30 +02:00
Magnus Norddahl
999b3833ff - improve jit debug output slightly 2018-08-30 19:55:00 +02:00
Magnus Norddahl
bba422ffcc - fix offsetting bug when loading address registers 2018-08-30 19:47:38 +02:00
Magnus Norddahl
c7e14e63bc - fix swapped operands in EmitSUBF_KR 2018-08-30 18:47:25 +02:00
Magnus Norddahl
4b22fa7bc8 - implement MODF_RR, MODF_RK and MODF_KR 2018-08-29 01:27:37 +02:00
Magnus Norddahl
a5719e73eb - fix mul using wrong instruction 2018-08-29 01:07:36 +02:00
Magnus Norddahl
25e7042bc5 - implement BOUND opcodes and add logging the resulting assembly code if asmjit throws an exception 2018-08-26 14:27:46 +02:00
Christoph Oelckers
d263f7bcc8 - removed most of the old LastIndexOf methods in FString, only leaving one for ZScript and clearly giving it a name that says it all. RIndexOf has been made the proper version of LastIndexOf internally now. 2018-08-25 20:54:16 +02:00
Christoph Oelckers
c04c48d157 - renamed RIndexOf to RightIndexOf 2018-08-25 20:39:58 +02:00
Kevin Caccamo
884de51b70 Add the "RIndexOf" method to FString, which works like String.lastIndexOf from JavaScript
RIndexOf returns the index where the substring starts, instead of the index where the substring ends - 1.

Deprecate the LastIndexOf method of StringStruct
2018-08-25 20:37:40 +02:00