Commit graph

1339 commits

Author SHA1 Message Date
Christoph Oelckers
2f2ce8126b - fixed definition of GetUDMFString export. 2018-12-05 08:18:07 +01:00
Christoph Oelckers
33db5792b4 - moved a large part of the VM thunks out of p_mobj.cpp. 2018-12-05 00:21:16 +01:00
Christoph Oelckers
a3265c2963 - more direct native entry points. 2018-12-04 23:12:16 +01:00
Christoph Oelckers
3b5ce4ecca - fixed: SBar_SetClipRect had a superfluous argument resulting in incorrect behavior 2018-12-04 19:14:14 +01:00
Christoph Oelckers
8025f02935 - fix bad return type. 2018-12-04 18:47:03 +01:00
Christoph Oelckers
d7da2d838f - handle JIT errors in a more user-friendly fashion than aborting.
* use I_Error instead of I_FatalError to abort. I_FatalError is only for things that are not recoverable and should not be handled outside of error cleanup and rethrowing.
* only catch CRecoverableError in JitCompile. Everything else should fall through to the outermost catch block.
* Do not I_FatalError out after handling the exception locally. Just print an error and return null, indicating failure.
2018-12-04 18:45:07 +01:00
Christoph Oelckers
45d7e5a038 - scriptified ASpecialSpot.
This only had two simple native methods so the class is not fully scripted.
2018-12-04 18:21:48 +01:00
Christoph Oelckers
de9805d5c7 - treat REGT_STRING | REGT_ADDROF just like REGT_STRING for direct native functions.
Both pass a reference so there's no need to treat them differently.
2018-12-04 18:21:00 +01:00
Christoph Oelckers
062528e0e2 - more direct native function calls. 2018-12-04 18:16:01 +01:00
Christoph Oelckers
5e4b366724 Removed all native components from AInventory. 2018-12-04 18:06:09 +01:00
Christoph Oelckers
9348baeeb1 Removed all remaining references to AInventory
What remains is the class definition and one single reference that will be scriptified.
2018-12-04 17:11:36 +01:00
Christoph Oelckers
cd563cc4db Removed more literal references to AInventory. 2018-12-04 17:00:48 +01:00
Christoph Oelckers
a573c63f60 - removed all direct access to AInventory's members.
We are getting closer to make class Inventory fully scripted.
2018-12-04 00:22:26 +01:00
Magnus Norddahl
14919f49ec - gcc/clang didn't like having this in a class 2018-12-03 23:39:03 +01:00
Magnus Norddahl
ae44b936eb - add bool and unsigned int to the allowed types
- fix one case where floats were used (the JIT always calls with doubles)
2018-12-03 23:09:23 +01:00
Magnus Norddahl
ba0c7652eb - perform compile time validation of direct native function signatures 2018-12-03 22:59:56 +01:00
Magnus Norddahl
5d9784f215 - fix VM native calls containing strings and enable them again 2018-12-03 21:58:01 +01:00
Magnus Norddahl
4f078dfcb3 - fix compile error 2018-12-03 21:57:07 +01:00
Christoph Oelckers
7df8245102 - added missing min/max unsigned instructions for the VM. 2018-12-03 21:12:39 +01:00
Christoph Oelckers
40a67b8c9a - fixed issues with Dehacked's ad-hoc script code generation
* The functions had no prototype and caused crashes.
* even after creating a prototype it didn't work because CreateAnonymousFunction was set up incorrectly for the case where a known return type was given.
2018-12-03 12:24:55 +01:00
Christoph Oelckers
099b278f18 - removed assert that got triggered in an edge case that must pass here. 2018-12-02 23:35:18 +01:00
Magnus Norddahl
d88d173b38 - ptest is a SSE 4.1 instruction 2018-12-02 20:44:36 +01:00
Christoph Oelckers
ddaab4d2ab - scriptified and cleaned up the AltHUD's DrawCoordinates, DrawTime and DrawLatency functions.
Some backing functionality was moved elsewhere because scripting should not have access to low level system information.
2018-12-02 14:34:09 +01:00
Christoph Oelckers
0cd93c14af - allow %*d etc. format specifiers in ZScript, but only for numeric types. 2018-12-02 14:34:08 +01:00
Magnus Norddahl
edc05111cd - don't use SSE for integer min/max 2018-12-02 09:58:08 +01:00
Magnus Norddahl
706a923884 - Use SSE2 for min/max instead 2018-12-02 07:35:02 +01:00
Christoph Oelckers
d812b94d57 - disabled direct native functions for now until the problems with string arguments are fixed. 2018-12-01 16:56:55 +01:00
Christoph Oelckers
691652042c - added direct native variants to nearly all status bar function.
I skipped ValidateInvFirst because that one will have to be scriptified soon.
2018-12-01 16:54:31 +01:00
Magnus Norddahl
5169a5b119 - minor code cleanup now that it is working 2018-12-01 14:35:21 +01:00
Christoph Oelckers
85a3edf583 - removed the no longer needed exception prevention hack.
# Conflicts:
#	src/scripting/vm/vmframe.cpp
2018-12-01 14:27:18 +01:00
Christoph Oelckers
067e9de00a - fixed: V_FindFontColor is not suitable for direct calls from JIT code, thanks to its FName parameter. 2018-12-01 14:26:53 +01:00
Christoph Oelckers
aa32acae25 - a bit of code reordering for adding direct native entry points.
- offloaded key list generation for alternative HUD to non-UI parts.

This change also revealed a problem with handling empty sprites in the key list so this got fixed, too.
2018-12-01 14:18:28 +01:00
Magnus Norddahl
83c011740c - fix augmentation length bug 2018-12-01 14:14:28 +01:00
Magnus Norddahl
b428136866 - unwind data is now working on macOS 2018-12-01 12:46:35 +01:00
Christoph Oelckers
a7e472b4b3 - moved all exports from class Font to vmthunks.cpp and gave them direct native entrypoints.
- changed PARAM_STRING to use the passed string by reference instead of by value. The 3 instances where passing by value was needed now use PARAM_STRING_VAL.
2018-12-01 10:30:50 +01:00
Christoph Oelckers
ea3d26aafd - fixed character to int conversion for UTF8-characters. 2018-12-01 10:30:50 +01:00
Magnus Norddahl
c41603c171 - implemented unwind data on Unix - does it work? no idea, there's no easy way to tell when the debugger doesn't support the interface.. 2018-12-01 01:14:15 +01:00
Christoph Oelckers
42b9a41421 - removed the longjmp based exception catch/rethrow mechanism and instead force-terminate in case a user exception is thrown while the VM is executing JITed code on a non-Windows system
On Windows none of this is needed, because we can generate a proper unwind frame for the JITed functions, but even on Linux, it would require manual additions to each single piece of native code that ever gets called from inside a JIT compiled function.
This is an utterly prohibitive proposition because it makes direct native calls a virtual impossibility
So, in order to get the thrown error properly presented both I_Error and ThrowAbortException will now forward to I_FatalError if it is called from inside a JIT context.
2018-11-30 21:30:14 +01:00
Christoph Oelckers
b26b16e4b7 Merge remote-tracking branch 'remotes/origin/master' into asmjit 2018-11-30 21:29:12 +01:00
Christoph Oelckers
a0c0e8bdfe Merge remote-tracking branch 'remotes/origin/weapon_scriptification' into asmjit
# Conflicts:
#	src/g_inventory/a_pickups.cpp
2018-11-30 21:28:44 +01:00
Christoph Oelckers
32f7e9a9ea -add a dummy definition for vm_jit in 32 bit. 2018-11-30 20:50:31 +01:00
Player701
b79e3f8904 - Added a flag to make bouncing objects disappear when hitting sky surfaces 2018-11-30 18:53:57 +01:00
Magnus Norddahl
cb1153272a - fix native call crash and assertion error 2018-11-30 16:55:22 +01:00
Magnus Norddahl
6e598274f7 - hook up unix unwind info (still not working) 2018-11-30 02:06:40 +01:00
Magnus Norddahl
b1bb82fe01 - fix WriteSLEB128 2018-11-29 19:44:26 +01:00
Magnus Norddahl
5d052fc565 - fix compile errors 2018-11-29 19:32:08 +01:00
Magnus Norddahl
37e33c6609 - implemented unwind info for Linux and macOS - now to fix the bugs that cannot be fixed when the documentation is as useless as it is for those platforms.. 2018-11-29 18:45:55 +01:00
Christoph Oelckers
19df662348 - fixed code generation for dummy results. 2018-11-29 20:15:53 +01:00
Christoph Oelckers
b8394b2f16 - fixed compilation warnings. 2018-11-29 20:11:28 +01:00
Christoph Oelckers
717912c88c - direct native methods for dynamic arrays. 2018-11-29 20:09:41 +01:00
Christoph Oelckers
53d59559cd Added direct native functions to the remaining content of vmthunks.cpp 2018-11-29 17:55:56 +01:00
Christoph Oelckers
62efe11a85 - more direct native functions for sector utilities. 2018-11-29 17:38:58 +01:00
Magnus Norddahl
e3c13fe193 - Emit DW_CFA_advance_loc and DW_CFA_def_cfa_offset codes 2018-11-29 02:37:58 +01:00
Christoph Oelckers
f43f0b9bd4 - added a few more direct native entry points. 2018-11-29 00:27:09 +01:00
Christoph Oelckers
d3ff657231 - added a direct native function for NextHighestCeilingAt to test multiple return values. 2018-11-28 21:40:56 +01:00
Magnus Norddahl
5ae456d059 - fix typo in macro 2018-11-28 19:59:35 +01:00
Magnus Norddahl
232c24e4de - add .eh_frame generation code except for building the actual CIE and FDE instructions 2018-11-28 13:10:31 +01:00
Christoph Oelckers
fc7ca39927 - allocate storage for all of a function's return values 2018-11-28 00:24:50 +01:00
Christoph Oelckers
6a9696e525 - moved the remaining exports from p_sectors.cpp to vmthunks.cpp 2018-11-28 00:24:50 +01:00
Magnus Norddahl
8860517bbd - pass additional return values as the last args to a direct native call 2018-11-27 20:43:35 +01:00
Magnus Norddahl
3202c86ea7 - use the OP_PARAM and OP_RESULT opcodes to build the function signature 2018-11-27 19:56:39 +01:00
Christoph Oelckers
5e4e9e2c2b Merge branch 'master' into asmjit 2018-11-27 19:53:22 +01:00
Christoph Oelckers
59b4e297c0 - fixed the mapping of additive translucency to color-based translucency.
The destination mode sould be 'One', not 'InvSrcColor'.
Now both of these are available as explicit modes, not just through the optional mapping.
2018-11-27 19:43:10 +01:00
Magnus Norddahl
d5b9b8e57a - fixed missing setRet call for REGT_POINTER return types 2018-11-27 17:10:20 +01:00
Magnus Norddahl
9dbb1d77ce - fix compile error 2018-11-27 17:02:51 +01:00
Magnus Norddahl
73819d45b7 - annotate which function we are calling for better dumpjit info 2018-11-27 17:00:29 +01:00
Magnus Norddahl
8b852ce4d8 - move the jit runtime to its own file 2018-11-26 10:46:09 +01:00
Christoph Oelckers
47b1fa774d Merge branch 'asmjit' into weapon_scriptification
# Conflicts:
#	src/gi.cpp
#	wadsrc/static/zscript/base.txt
2018-11-26 00:14:44 +01:00
Christoph Oelckers
182d43ae70 - fixed: Any direct native function may not use struct values as parameters, not even something as simple as an FName. 2018-11-25 23:33:15 +01:00
Christoph Oelckers
bef5b953b2 - free everything. 2018-11-25 23:33:15 +01:00
Christoph Oelckers
34a1c8e545 - delete JIT data when shutting down. 2018-11-25 23:33:14 +01:00
Magnus Norddahl
c164b3c3b0 - fix: float constants got their move instructions inserted after the call instruction 2018-11-25 22:26:38 +01:00
Christoph Oelckers
176da5de68 - added a direct native variant for A_PlaySound because this function is relatively easy to test. 2018-11-25 18:41:27 +01:00
Magnus Norddahl
61b91f9814 - fix macro expansion error on gcc and clang 2018-11-25 18:37:26 +01:00
Christoph Oelckers
2b960aa28f - finished adding direct native functions to vmthunks.cpp. 2018-11-25 16:12:15 +01:00
Christoph Oelckers
03364a8c3e - all sector exports done. 2018-11-25 15:14:48 +01:00
Christoph Oelckers
8e8ee732f4 - another batch of direct native functions. 2018-11-25 14:19:19 +01:00
Christoph Oelckers
6628b34f4a - continued work on adding direct native support. 2018-11-25 13:35:32 +01:00
Christoph Oelckers
dc16c1d44e - moved VM thunks from p_sectors.cpp to a separate file and started adding direct native implementations.
For a few larger functions I took them out of sector_t and made them global functions to avoid creating more unnecessary stubs.
2018-11-25 11:34:50 +01:00
Christoph Oelckers
a501a22b28 - define the built-in functions defined in codegen.cpp through the regular interface instead uf just hacking them into the symbol table with incompletely set up data.
- added direct native variants to these builtins and fixed problems with builtin processing.
2018-11-25 11:41:29 +01:00
Christoph Oelckers
43d434b071 - removed AStateProvider from native code.
The only place still referencing it was CallStateChain, so this has been made a static function now instead of a class method.
2018-11-25 10:09:06 +01:00
Christoph Oelckers
f4789bdefc - fixed handling of dummy flags. 2018-11-25 10:06:00 +01:00
Christoph Oelckers
d6b781312c - removed all remaining native components of the weapon class. 2018-11-25 10:00:55 +01:00
Christoph Oelckers
70d3c31551 - allow defining flags in the script declaration of a class and do that for Weapon. 2018-11-25 09:29:12 +01:00
Christoph Oelckers
b5c4ab8c47 - removed all direct access to AWeapon's members to prepare moving this class fully to the script side.
Disregarding UI-side and setup-related calls there's unfortunately still 6 places in the native game code which require direct access.
2018-11-25 08:17:37 +01:00
Christoph Oelckers
00a48b09e5 - moved the 'Finalize' methods back into a single function in the parser code.
It has been like this initially but was changed when ZDoom gained an overly complicated polymorphic class descriptor object that required a lot of support code. All these complications have long been removed but these methods remained. Since they prevent a class from being moved to the script side entirely they had to be removed.

This was the last major blocker to make Weapon a purely scripted class, the only remaining native method is Serialize which is of no concern for the coming work.
2018-11-25 08:16:18 +01:00
Christoph Oelckers
8fa16b6c30 - some cleanup on the weapon slot interface.
This really shouldn't make any decisions from directly reading weapon class defaults.
2018-11-25 07:21:02 +01:00
Christoph Oelckers
34b7e5f435 - scriptified P_BobWeapon as a virtual function on PlayerPawn. 2018-11-25 00:23:03 +01:00
Christoph Oelckers
8eb4697fbd - removed the bot related properties from AWeapon.
This stuff is now kept locally in the bot code so that it doesn't infest the rest of the engine.
And please don't read the new botsupp.txt file as some new means to configure bots! This was merely done to get this data out of the way.
The bots are still broken beyond repair and virtually unusable, even if proper data is provided for all weapons.
2018-11-24 23:48:23 +01:00
Christoph Oelckers
9584e3bc53 - scriptified P_BringUpWeapon because this was the only native function still referencing AWeapon::GetReadyState. 2018-11-24 17:22:59 +01:00
Christoph Oelckers
4c1b3f81ab - scriptified A_RailAttack. 2018-11-24 15:12:30 +01:00
Christoph Oelckers
6fc63b9b78 - started with a ScriptUtil class which will allow moving function implementations for ACS and FraggleScript to zscript.txt
So far 3 functions for testing implemented.
2018-11-24 13:06:01 +01:00
Christoph Oelckers
b267252a09 - fixed: Since out types cannot be marked as such in a function prototype (as it'd cause parameter mismatches in the resolving pass) it is necessary to check the argflags as well when determining the register type. 2018-11-24 09:34:53 +01:00
Christoph Oelckers
78d6832d14 - P_UndoPlayerMorph scriptified.
Not tested yet and still missing a new native interface.
2018-11-24 08:17:30 +01:00
Christoph Oelckers
192104aea2 - scriptified P_MorphPlayer and dependencies.
It still needs its counterpart scriptified as well before it can work.
2018-11-24 07:45:49 +01:00
Magnus Norddahl
4e2cc1f144 - fix missing include statement 2018-11-23 12:13:53 +01:00
Christoph Oelckers
80c6505eee - fixed initialization of default parameters in dynamically created function calls like in the MENUDEF parser 2018-11-23 09:34:38 +01:00
Magnus Norddahl
6f397854d0 - inline VBTL opcode
- remove old META and CLSS implementations
2018-11-23 05:37:26 +01:00
Magnus Norddahl
9ef7212f54 - add return type to CreateFuncSignature 2018-11-23 05:20:12 +01:00
Magnus Norddahl
be4b217608 - fix typo 2018-11-23 04:50:01 +01:00
Magnus Norddahl
3ba6290419 - add support in the jit compiler to do direct native calls using the x64 calling convention 2018-11-23 04:47:18 +01:00
Christoph Oelckers
02de10f657 - cleaned up the PointerSubstitution code
Since the only thing it gets used for is swapping out PlayerPawns it can safely skip all global variables that never point to a live player, which allowed to remove quite a bit of code here that stood in the way of scriptifying more content
2018-11-19 17:05:00 +01:00
Christoph Oelckers
8bc2d50ad2 Merge branch 'master' into asmjit
# Conflicts:
#	src/p_actionfunctions.cpp
2018-11-18 21:08:16 +01:00
Christoph Oelckers
3aef8418d9 - fixed the type checks for object arrays.
Null pointers must be allowed and non-object pointers which are not null must be explicitly checked for because the code could crash on them when performing a static_cast on an incorrect type.
2018-11-18 19:48:09 +01:00
Christoph Oelckers
a9ec819557 - moved the type infomation entirely out of VMValue.
For the varargs functions that used the Type field to validate their parameters, now a hidden additional argument is passed which contains a byte array with the type info for the current call's arguments. Since this is static per call location it can be better prepared once when the code is being compiled instead of being put in a runtime created array for each invocation. Everything else uses the per-function instance of the same data.

The only thing that still needed the type field with a VMValue is the defaults array, so this uses a different struct type now to store its data.
2018-11-18 19:31:13 +01:00
Christoph Oelckers
a981737855 - generate register type info for the parameter lists of all functions.
Currently used for loading parameters into registers.
For checking parameters of native functions some more work is needed to get the info to the function. Currently it doesn't receive the function descriptor.
2018-11-18 17:10:55 +01:00
Magnus Norddahl
1ef772d017 - add missing CheckVMFrame call 2018-11-18 14:02:39 +01:00
Magnus Norddahl
a8a9ec98f3 - only allocate stack space for vmframe and call returns when we need them 2018-11-18 13:49:19 +01:00
Magnus Norddahl
748dbec77a - improve dumpjit output slightly 2018-11-18 13:14:41 +01:00
Magnus Norddahl
e778f05b12 - don't emit VMValue.Type information when we know the receiver isn't going to read it anyway 2018-11-18 12:59:53 +01:00
Magnus Norddahl
486b7e0f3c - delay emitting PARAM and VTBL instructions until CALL/CALL_K 2018-11-18 12:38:55 +01:00
alexey.lysiuk
4624c6e6a3 - use custom offsetof() macro
src/scripting/vm/jit_call.cpp:164:38: warning: offset of on non-standard-layout type 'VMScriptFunction' [-Winvalid-offsetof]
src/scripting/vm/jit_load.cpp:87:50: warning: offset of on non-standard-layout type 'DObject' [-Winvalid-offsetof]
src/scripting/vm/jit_load.cpp:96:50: warning: offset of on non-standard-layout type 'DObject' [-Winvalid-offsetof]
src/scripting/vm/jit_load.cpp:257:53: warning: offset of on non-standard-layout type 'DObject' [-Winvalid-offsetof]
2018-11-18 12:48:50 +02:00
alexey.lysiuk
e4c238b6c7 - fixed compilation of POSIX targets
src/scripting/backend/vmbuilder.h:169:19: error: no member named 'function' in namespace 'std'
2018-11-18 12:37:07 +02:00
Christoph Oelckers
28db04b501 - missed one OP_RESULT. 2018-11-18 10:09:29 +01:00
Christoph Oelckers
fe0a341e0c - moved all code related to function calls into the helper class so that all future work on the calling convention is in one place only. 2018-11-18 10:02:31 +01:00
Christoph Oelckers
cbedcff559 - moved all handling for the simple calls into EmitterArray to have it in one place only.
The main case of FxVmFunctionCall is not done yet, though.
2018-11-18 08:29:41 +01:00
Christoph Oelckers
629d329f22 - removed OP_TAIL.
The amount of support code for this minor optimization was quite large and this stood in the way of streamlining the VM's calling convention, so it was preferable to remove it before moving on.
2018-11-18 07:43:03 +01:00
Magnus Norddahl
4e0c5cf16c - fix compile errors 2018-11-18 03:28:57 +01:00
Christoph Oelckers
983c0c56b1 - changed OP_PARAM handling so that all registers remain allocated until the call instruction and reordered instruction emission so that the param instructions all directly precede the call instruction. 2018-11-18 01:06:04 +01:00
Magnus Norddahl
7e0dacdb1d - disabled code that shows how a thunk function and native setup would look like 2018-11-17 16:26:54 +01:00
Christoph Oelckers
89cec539fa - fixed IJMP code generation for the JIT compiler.
With a proper count value available this can be done properly. The only relevant targets are the jumps immediately succeeding the IJMP instructions, nothing else.
2018-11-17 13:39:14 +01:00
Christoph Oelckers
fcb5684607 - do not use instructions from too recent instruction set extensions.
andn is part of BMI1 which was introduced in 2012, which is far too recent to be used unchecked.
2018-11-17 13:10:18 +01:00
Christoph Oelckers
adde0510fe - deconstruct A_Jump with multiple labels into A_Jump(chance, RandomPick(label1, label2, label3,...)) to remove this ugly special case from the VM calling convention.
This also adds the number of available choices to OP_IJMP.
2018-11-17 12:35:03 +01:00
Magnus Norddahl
68afc419af - inline ReadBarrier, GetClass and GetClassMeta 2018-11-17 10:54:16 +01:00
Christoph Oelckers
6398c27646 - fixed RNG setup in FxRandom. 2018-11-17 10:06:01 +01:00
Christoph Oelckers
94ed30e782 - removed the default parameter handling from all native script functions because it is no longer needed. 2018-11-17 10:03:40 +01:00
Christoph Oelckers
e643582957 - fixed FxFRandom setup which used a path in FxRandom that is no longer supported. 2018-11-17 08:06:23 +01:00
Magnus Norddahl
f99bba48dc - stop using lambda functions for CreateCall because MSVC lambas use a different calling convention and "converts" them to the right one by generating a thunk function 2018-11-17 05:12:47 +01:00
Magnus Norddahl
f082a8af98 - removed the SetupSimpleFrameMissingArgs logic as the number of args are now guaranteed 2018-11-17 00:49:22 +01:00
Magnus Norddahl
8ec85cb0ee - add warning text when falling back to the VM 2018-11-17 00:36:40 +01:00
Christoph Oelckers
6423902c63 - removed the unused 'no arguments' cases from the BuiltinRandom functions and split off BuiltinRandom2 into its own function.
This removes the last non-vararg cases where a native VM function checks 'numparam'. As of this commit all function calls will pass the complete list of arguments.
2018-11-17 00:14:39 +01:00
Magnus Norddahl
ea26bf6b2f - make functions using too many registers (more than 200) fall back to the VM 2018-11-17 00:04:15 +01:00
Christoph Oelckers
95ab1da6a0 - always pass complete argument lists in the VM. 2018-11-16 22:43:12 +01:00
Christoph Oelckers
97573a0452 - implemented VMCallWithDefaults and used it for all calls with variable arguments.
This isn't used for the 3 action function calls because it requires an array allocation which would be a bit too costly for something as frequently called as action functions.
They will need a different approach.
2018-11-16 19:18:33 +01:00
Christoph Oelckers
6d7710165c - fixed last commit. 2018-11-16 18:50:34 +01:00
Christoph Oelckers
c24da62cdd - marked all places where an incomplete parameter list may be passed to the VM by a native call by redirecting VMCall to an intermediate VMCallWithDefaults. This function must later fill in the missing arguments from the default. 2018-11-16 18:41:27 +01:00
Christoph Oelckers
acbdfddb26 Merge remote-tracking branch 'remotes/origin/master' into asmjit 2018-11-16 17:20:12 +01:00
Christoph Oelckers
8c57447108 - Restricted argument count check to the void return case.
There were some issues here:

* a check for mismatching count is too strict because it is legal to omit return values
* it failed to detect returning multiple values in a single expression.
2018-11-16 12:28:24 +01:00
Christoph Oelckers
358001c306 fixed right shift operator for unsigned values
This is version protected to avoid breaking old code.
2018-11-16 11:32:24 +01:00
Christoph Oelckers
7cd89fe07b - fixed: FxUnaryNotBitwise modified the source operand instead of allocating a new one. 2018-11-16 11:21:51 +01:00
Magnus Norddahl
ac28f0d34f - remove unused argument 2018-11-16 01:33:41 +01:00
Magnus Norddahl
34b037c9db - avoid calling VMFillParams for simple stack frames
- split Setup into more functions
2018-11-16 01:13:25 +01:00
Player701
c569029b1d - Readonly pointer casting now works in ZScript. 2018-11-15 23:28:37 +01:00
Magnus Norddahl
6c31d2e965 - add dword store to memset code 2018-11-15 23:04:11 +01:00
Magnus Norddahl
00d41432d8 - disable jit in 32-bit builds 2018-11-15 22:47:44 +01:00
Magnus Norddahl
5ef2175c38 - fix wrong offsets 2018-11-15 22:40:12 +01:00
Magnus Norddahl
0394dc56b7 - generate a memset for the allocated stack memory because that's what the VM does
(this really shouldn't be done by the VM either - the compiler backend should clear its registers if it wants them to be zero!)
2018-11-15 22:33:13 +01:00
Magnus Norddahl
f3e0db913c - fix operand size mismatch error 2018-11-15 22:07:27 +01:00
Magnus Norddahl
3b2faf5397 Merge remote-tracking branch 'origin/master' into asmjit 2018-11-15 22:02:11 +01:00
Cacodemon345
07838f4c2a BOUNCEONUNRIPPABLES flag; makes actors bounce on actors with DONTRIP flag 2018-11-15 12:47:57 +01:00
alexey.lysiuk
39a3527396 - fixed compilation of targets with optimization 2018-11-15 10:59:37 +02:00
Christoph Oelckers
aa4de71e6d Merge branch 'master' into asmjit 2018-11-15 09:25:27 +01:00
Chronos Ouroboros
96b8f12a30 Fix the code for MODF_RK in the JIT compiler. 2018-11-14 21:05:24 -02:00
Chronos Ouroboros
566eb58000 Fixed the Vector2/3 != operator. 2018-11-14 20:01:13 +01:00
Chronos Ouroboros
5375a99cf6 Added support for CMP_APPROX to EQV_R and moved the code to a template. 2018-11-14 10:29:48 -02:00
Magnus Norddahl
8429fc8124 - fix missing type check when using Push or Insert for typed arrays 2018-11-14 10:08:04 +01:00
Magnus Norddahl
99849bc0c5 Merge remote-tracking branch 'origin/master' into asmjit 2018-11-14 01:23:17 +01:00
Christoph Oelckers
33f2f9f34e - fixed: ZScript's finalization code used the last parsed lump for of one translation unit as reference, not the base lump.
This resulted in incorrect messages but also could produce some more subtle errors.
2018-11-12 00:22:50 +01:00
Magnus Norddahl
e6023c55a8 - modify exception checks to jump ahead if the exception is to be thrown as it limits static misprediction 2018-11-10 22:48:20 +01:00
Magnus Norddahl
a7ef178284 - fix a typo 2018-11-10 19:56:54 +01:00
Magnus Norddahl
173fe94736 - fix the throw messages 2018-11-10 19:52:41 +01:00
Christoph Oelckers
3c5609537a - fixed vector math instructions to use the same order of operations as the VM. 2018-11-09 22:36:08 +01:00
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
Magnus Norddahl
7b886cc434 - implement a few more opcodes and fix some bugs 2018-08-25 13:38:45 +02:00
Magnus Norddahl
f84028eeae - implemented pow, min, max 2018-08-24 23:17:35 +02:00
Magnus Norddahl
eb9d2b54f3 Merge remote-tracking branch 'gzdoom/master' into asmjit 2018-08-23 18:20:23 +02:00
Magnus Norddahl
17813e4b3e - implement ATAN2 and FLOP 2018-08-20 01:40:37 +02:00
Magnus Norddahl
38fa25d0c5 - implement DYNCAST*, TEST, TESTN and JMP opcodes 2018-08-20 00:44:48 +02:00
Christoph Oelckers
fad406c4c9 - got rid of FNameNoInit and made the default constructor of FName non-initializing.
This setup has been a constant source of problems so now I reviewed all uses of FName to make sure that everything that needs to be initialized is done manually.
This also merges the player_t constructor into the class definition as default values.
2018-08-19 08:19:19 +02:00
Magnus Norddahl
302d753d17 - convert JitCompile's switch into a class to enable easier code reuse 2018-08-19 01:46:56 +02:00
Magnus Norddahl
c17be9eb21 - fix clang compile error 2018-08-18 22:46:18 +02:00
Magnus Norddahl
3453f05f06 - implement throwing by storing exception information in a struct, then return from the jitted function and throw from c++ 2018-08-18 22:41:18 +02:00
Jonathan Russell
d983ae66c7 - removed the ability to use printf-like formatting in emitAbortExceptionCall, it barely worked 2018-08-18 20:37:55 +01:00
Jonathan Russell
6424190cbf - add first draft of abort exceptions 2018-08-18 18:03:18 +01:00
Magnus Norddahl
c89d8bb9bb - call play sqrt when calculating lengths 2018-08-18 18:41:35 +02:00
Magnus Norddahl
b159b5667a - fix 8 and 16 bit store 2018-08-18 18:21:52 +02:00
Magnus Norddahl
e557e8fac0 - destroy the jit runtime when all script functions are destroyed 2018-08-18 17:50:47 +02:00
alexey.lysiuk
34f2d8f310
- fixed typo in error message 2018-08-18 17:45:26 +03:00
alexey.lysiuk
31bd7cfc04
- prohibit assignment of dynamic arrays
https://forum.zdoom.org/viewtopic.php?t=61682
2018-08-18 15:20:38 +03:00
Magnus Norddahl
9d68d43ce7 - disable all unimplemented opcodes in the switch to ensure 'Unknown VM opcode' fatal error is generated if CanJit has a bug 2018-08-18 13:18:52 +02:00
Magnus Norddahl
68b2cd58d8 Fix compile errors on macOS 2018-08-18 12:37:33 +02:00
alexey.lysiuk
d965c9aa76
- support static const arrays inside structs
https://forum.zdoom.org/viewtopic.php?t=61677
2018-08-18 13:00:33 +03:00
Jonathan Russell
6a40e092fe - added remaining int arithmetic opcodes (and fixed float loading offset issue) 2018-08-17 22:06:12 +01:00
Jonathan Russell
758ee5cbfb - forgot to turn off debug switch in last commit 2018-08-17 19:15:27 +01:00
Jonathan Russell
08c0ac541f - made absMaskInt const 2018-08-17 19:14:31 +01:00
Jonathan Russell
d137b3c94e - implemented CMP_APPROX for OP_EQF_*, making ~== work for doubles 2018-08-17 19:08:19 +01:00
Marisa Kirisame
155afebb65 Add HITOWNER flag, when set, allows a projectile to collide with its shooter. 2018-08-17 19:47:12 +02:00
Chronos Ouroboros
079391e5ac Updated CanJit's supported opcodes list. 2018-08-16 21:45:04 +02:00
Chronos Ouroboros
a8ce626708 Pointer addition opcodes must leave NULL pointers as they are. 2018-08-16 21:45:04 +02:00
Chronos Ouroboros
591783087d Changed binary int ops to use a temporary register, fixed some opcodes.
For some reason, binary ops might reuse one of the input registers as the output register.
This is a problem for very obvious reasons.
2018-08-14 20:08:04 -03:00
Jonathan Russell
dc03cb7a80 - made CMP_CHECK checking compile time 2018-08-14 20:50:32 +01:00
Jonathan Russell
740415246e - added exact floating point comparison opcodes 2018-08-14 18:32:17 +01:00
Jonathan Russell
167693f102 - implemented all integer comparison operators 2018-08-14 15:07:09 +01:00
Jonathan Russell
b30df47499 - adds OP_EQ_R, the first instruction using jumps 2018-08-14 13:02:56 +01:00
Magnus Norddahl
0ced612d2c - add misc float opcodes 2018-08-14 01:07:30 +02:00
Jonathan Russell
cdb5a9d91e - added most vector maths opcodes 2018-08-13 21:36:55 +01:00
Chronos Ouroboros
cb28bbc72e Fix floats and implement some more opcodes. 2018-08-13 13:07:36 -03:00
Magnus Norddahl
83d769f55c - copy initial register values from the VM frame 2018-08-13 00:15:42 +02:00
Magnus Norddahl
7108fd6228 - implement most of the integer math opcodes 2018-08-12 04:34:57 +02:00
Magnus Norddahl
cbb945d8a7 - embed and use asmjit to JIT ZScript VM functions 2018-08-12 02:11:13 +02:00
Christoph Oelckers
6634416b89 - allow skipping optional arguments of the parent function in a virtual override definition.
This is mainly to allow retroactive addition to existing virtual functions without breaking existing content.
The MeansOfDeath fix for Actor.Die would not be possible without such handling.
2018-07-29 17:00:05 +02:00
alexey.lysiuk
e9041c0697 - fixed potential garbage collection of still referenced objects
Objects from dynamic array stored in items of array of structures were incorrectly treated as unreachable

https://forum.zdoom.org/viewtopic.php?t=61354
2018-07-28 19:34:20 +02:00
Christoph Oelckers
6d0b172762 - added MF8_DONTFACETALKER flag which prevents NPCs from facing the player in conversations. 2018-07-22 11:32:45 +02:00
Christoph Oelckers
2a0c3e63a3 - allow temporary strings to be used as self pointer for String's member functions.
Due to how function calls get resolved by the code generator there were some incorrect flags on the self pointer which triggered an assert and caused incorrect code generation.
Fortunately this was a mostly contained special case for which a workaround was possible.
2018-07-20 10:38:55 +02:00
alexey.lysiuk
b2697a99f8 - added missing null pointer checks to VM ops 2018-07-16 17:10:47 +03:00
alexey.lysiuk
5d27c16f30 - disabled default values for out parameters
https://forum.zdoom.org/viewtopic.php?t=61128
2018-06-30 11:44:22 +03:00
Christoph Oelckers
ae1fe041ee - ZScript used the wrong variable for compatflags2.
ii_* is merely the storage for info from the compatibility.txt lump.
2018-06-09 17:59:21 +02:00
alexey.lysiuk
4a1f36623b - fixed: flag CVars in ZScript referenced wrong addresses 2018-06-09 17:21:55 +03:00
Christoph Oelckers
1fdcacc337 - redirect script access to the compatflags CVARs to their internal shadow variables.
This is needed so that MAPINFO settings for these flags don't get ignored.
2018-06-08 22:55:44 +02:00
Marisa Kirisame
fae514f30d BLOCKASPLAYER flag: treat non-player actors as blockable by "block players" lines 2018-06-04 22:18:51 +02:00
Christoph Oelckers
7d515e72c2 - fixed: FxFloatCast must transfer the outer expression's value type to the inner expression if it performs a float->float cast.
This violated an important rule that a cast may not alter the expression's type and led to failed asserts elsewhere.
2018-06-02 07:50:23 +02:00
alexey.lysiuk
ef536e7b00 - fixed crash in DECORATE parsing
The case with forward declared class used as a parent must be handled explicitly

actor MyWeapon : Weapon { Weapon.AmmoType "MyBaseAmmo" }
actor MyAmmo : MyBaseAmmo { }
actor MyBaseAmmo : Ammo { }
2018-05-10 11:47:16 +03:00
alexey.lysiuk
2ae8d39441 Removed all superfluous #include's
Automatically optimized by CLion IDE with manual corrections
2018-04-24 14:30:35 +03:00
Christoph Oelckers
cf8447d19c -protected critical portal data from getting written to by user code.
This data is game critical and may only be altered by code that knows what is allowed and what not. It must never be altered by any user code ever.
However, since the SkyViewpoint actors need to set up some relations between themselves and the default sky portals the previously purely internal 'internal' flag has been exported as a new keyword.
2018-04-15 12:13:02 +02:00
alexey.lysiuk
7bd281ddc9 Added zero initialization of implicit dynamic array items
https://forum.zdoom.org/viewtopic.php?t=60111
2018-04-05 12:22:41 +03:00
alexey.lysiuk
ac7e5def32 Forbade dynamic array as the return type of a function
Compiler ignored this case silently but it crashed during code generation
2018-04-02 15:18:30 +03:00
alexey.lysiuk
ff96980dda Fixed handling of default values in String.Mid()
https://forum.zdoom.org/viewtopic.php?t=60047
2018-03-31 21:45:20 +03:00
Christoph Oelckers
e89a598b31 - renamed FTexture's UseType flags and gave them a dedicated type.
This was done mainly to reduce the amount of occurences of the word FTexture but it immediately helped detect two small and mostly harmless bugs that were found due to the stricter type checks.
2018-03-25 20:26:16 +02:00
Jason Francis
bd7791ad9c Allow setting string user variables in ACS 2018-03-24 10:20:39 +01:00
Jason Francis
4494b18e8a Enable string & float user_ properties in UDMF things 2018-03-24 10:20:39 +01:00
Christoph Oelckers
f1bfc3514d - fixed: For proper recognition of optional function arguments, the argflags must also be copied from the parent function to ensure they are itdentical on the override. 2018-03-14 19:52:30 +01:00
Christoph Oelckers
5d436cd3ed - forward the error state of the translation parser to the calling code so that it can print a message pointing to the problem content. 2018-03-12 19:14:56 +01:00
Christoph Oelckers
13ef97c4ac - removed debug message. 2018-03-12 18:47:49 +01:00
Major Cooke
4851c5bfde Insert an extra line after printing the warnings. 2018-03-12 18:17:08 +01:00
Christoph Oelckers
def5e1d61b Added proper handling for default parameter values of virtual overrides
Due to how the VM handles default parameters, these must always be identical to the parent to prevent undefined behavior.
So now, if such parameters are encountered, the compiler will either abort (for script version >= 3.3) or print a warning (for older versions.)
Any defaults being specified for older versions will be ignored, though, and the defaults of the parent function be copied to the override.
2018-03-12 10:19:16 +01:00
alexey.lysiuk
81bc05b7c5 Added support for default values of arguments with uint type 2018-03-07 15:58:06 +02:00
Christoph Oelckers
bcc8972356 - fixed: A preincrement of a local variable generated wrong code if passed as a function parameter.
Due to the special nature of this expression the code generator got stuck in 'address' mode and passed the address of the variable instead of its value.
2018-03-01 15:00:18 +01:00
Christoph Oelckers
425f1408f7 - fixed skip_super application fro ZScript.
The order of processing is different here so when the property gets parsed there are no states to delete.
To fix this the property just flags the class and lets the ZScript state compiler deal with this as needed.
2018-02-28 18:10:04 +01:00
Christoph Oelckers
af14609de7 - don't skip empty arrays which are themselves array elements in the ZScript serializer. 2018-02-27 15:42:22 +01:00
Christoph Oelckers
aaaf9aa108 Added 'TeleportSpecial' as an alias for 'Teleport' in ZScript to deconflict from the Actor.Teleport function. 2018-02-27 12:44:00 +01:00
alexey.lysiuk
74357ced0c Fixed read of potentially junk values in ZScript parser
The following ill-formed ZScript code might crash targets with sizeof(int) != sizeof(void*) like 64-bit Intel
class test { void func() { if (true) ( return; ) } }
2018-02-21 16:26:04 +02:00
alexey.lysiuk
1e41c042d4 Fixed codegen crash with non-numeric random seed
The following code crashed ZScript code generator if my_seed is not convertible to numeric type
SetRandomSeed[my_random_id](my_seed);
2018-02-19 11:46:36 +02:00
Christoph Oelckers
09f1859c83 - allow retrieving the length of a string constant. 2018-01-21 18:49:46 +01:00
Christoph Oelckers
dbf0a68b02 Merge commit '67e3106254e987f5acb9534e725d4f5c3eaa82b2'
# Conflicts:
#	src/doomdata.h
#	src/namedef.h
#	src/p_udmf.cpp
2018-01-20 19:07:54 +01:00
Christoph Oelckers
19cf887ad1 - fixed: Dynamic arrays for object pointers need different treatment than arrays for regular pointers, because they require GC::WriteBarrier to be called. 2018-01-19 19:49:42 +01:00
alexey.lysiuk
6d20da8ab5 Fixed nust -> must typos 2018-01-18 11:43:32 +02:00
Magnus Norddahl
5f36b86013 - Add dynamic spot lights 2018-01-04 17:58:11 +01:00
alexey.lysiuk
d50ba4954a Fixed potential crash when calling undefined function in ZScript
The following code which uses explicit class specifier led to a crash:
class C
{
	void F()
	{
		Object.Undefined();
	}
}
2017-12-23 15:27:32 +02:00
Christoph Oelckers
ab58e4acb0 - use FileWriter for the AST dump. 2017-12-02 12:01:55 +01:00
alexey.lysiuk
5d83ee5e89 Exposed String.Remove() function to ZScript
https://forum.zdoom.org/viewtopic.php?t=58402
2017-11-12 14:44:21 +02:00
alexey.lysiuk
4beefb7007 Removed warning for uninitialized variables in ZScript
This reverts commit 8104ef5189
2017-11-06 15:38:28 +02:00
alexey.lysiuk
274951839a Removed unused parameter from several functions in FStateDefinitions class
src/p_states.cpp:724:54: warning: parameter ‘actor’ set but not used [-Wunused-but-set-parameter]
https://forum.zdoom.org/viewtopic.php?t=58364
2017-11-05 15:20:25 +02:00
alexey.lysiuk
8104ef5189 Added warning for uninitialized variables in ZScript
https://forum.zdoom.org/viewtopic.php?t=57868
2017-11-03 16:23:41 +02:00
alexey.lysiuk
dac5777a70 Removed obsolete declarations from codegen.h 2017-11-03 12:44:28 +02:00
alexey.lysiuk
81ea9fb372 Added runtime check for negative array indices in VM
https://forum.zdoom.org/viewtopic.php?t=57886
2017-11-02 18:01:13 +02:00
alexey.lysiuk
57de598e48 Added implicit scope for if/else, while and do/while statements in ZScript
Scope is added only for variable or constant definition so it will no longer leak to outer scope
https://forum.zdoom.org/viewtopic.php?t=57848
2017-11-02 17:10:54 +02:00
alexey.lysiuk
de7d8995d5 Added string representation of 'static const' token
No more 'Unknown(-141)' in 'Expecting ...' error message
2017-11-02 14:45:35 +02:00
alexey.lysiuk
62e91b23bd Extended String.LastIndexOf() with endIndex parameter
https://forum.zdoom.org/viewtopic.php?t=57326
2017-11-01 15:24:05 +02:00
alexey.lysiuk
c4865d2bb6 Exposed string split functionality to ZScript
https://forum.zdoom.org/viewtopic.php?t=58114
2017-10-28 11:44:12 +03:00
alexey.lysiuk
40a348b1f1 Fixed potential crash in resolving of multiple assignment
https://forum.zdoom.org/viewtopic.php?t=58055
https://forum.zdoom.org/viewtopic.php?t=58237
2017-10-27 18:15:24 +03:00
alexey.lysiuk
cb982ec313 Use FString::Back() when possible
Changed usages of str[str.Len() - 1] to str.Back()
2017-10-23 11:55:20 +03:00