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