Christoph Oelckers
b762c0f49c
Removed more literal references to AInventory.
...
# Conflicts:
# src/hwrenderer/scene/hw_drawinfo.cpp
# src/v_draw.cpp
2019-04-16 23:57:07 +02:00
Christoph Oelckers
fa2e2e78b4
- removed all direct access to AInventory's members.
...
We are getting closer to make class Inventory fully scripted.
2019-04-16 22:01:04 +02:00
Magnus Norddahl
c8b5276981
- gcc/clang didn't like having this in a class
2019-04-16 22:01:01 +02:00
Magnus Norddahl
82a0acbc19
- add bool and unsigned int to the allowed types
...
- fix one case where floats were used (the JIT always calls with doubles)
2019-04-16 22:00:57 +02:00
Magnus Norddahl
89fd819926
- perform compile time validation of direct native function signatures
2019-04-16 22:00:55 +02:00
Magnus Norddahl
9e432c0c9f
- fix VM native calls containing strings and enable them again
2019-04-16 22:00:53 +02:00
Magnus Norddahl
6090e5ec24
- fix compile error
2019-04-16 22:00:50 +02:00
Christoph Oelckers
a42ece4fb4
- added missing min/max unsigned instructions for the VM.
2019-04-16 22:00:46 +02:00
Christoph Oelckers
fc341c901f
- 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.
2019-04-16 21:52:47 +02:00
Christoph Oelckers
0a36ad0182
- removed assert that got triggered in an edge case that must pass here.
2019-04-16 21:34:51 +02:00
Magnus Norddahl
abc4406d18
- ptest is a SSE 4.1 instruction
2019-04-16 21:28:35 +02:00
drfrag
8ef732704c
- Missing include.
2019-04-16 19:55:28 +02:00
Christoph Oelckers
f509fdfdaa
- 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.
2019-04-16 19:01:53 +02:00
Christoph Oelckers
cbb92af1db
- allow %*d etc. format specifiers in ZScript, but only for numeric types.
2019-04-16 19:01:45 +02:00
Magnus Norddahl
08f415bad9
- don't use SSE for integer min/max
2019-04-16 18:46:09 +02:00
Magnus Norddahl
1e533d726c
- Use SSE2 for min/max instead
2019-04-16 18:46:07 +02:00
Christoph Oelckers
de6916756b
- disabled direct native functions for now until the problems with string arguments are fixed.
2019-04-16 18:44:50 +02:00
Christoph Oelckers
057604a7b1
- added direct native variants to nearly all status bar function.
...
I skipped ValidateInvFirst because that one will have to be scriptified soon.
2019-04-16 18:44:49 +02:00
Magnus Norddahl
b6737c0cd3
- minor code cleanup now that it is working
2019-04-16 18:18:30 +02:00
Christoph Oelckers
712b85fc61
- removed the no longer needed exception prevention hack.
...
# Conflicts:
# src/scripting/vm/vmframe.cpp
# Conflicts:
# src/scripting/vm/vmframe.cpp
2019-04-16 18:18:16 +02:00
Christoph Oelckers
fc4b757b17
- fixed: V_FindFontColor is not suitable for direct calls from JIT code, thanks to its FName parameter.
2019-04-16 18:17:32 +02:00
Christoph Oelckers
4049b56d50
- 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.
# Conflicts:
# src/g_shared/shared_hud.cpp
2019-04-16 18:17:05 +02:00
Magnus Norddahl
c84f13829f
- fix augmentation length bug
2019-04-16 18:14:40 +02:00
Magnus Norddahl
4393684831
- unwind data is now working on macOS
2019-04-16 18:14:39 +02:00
Christoph Oelckers
56228a853b
- 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.
# Conflicts:
# src/v_video.h
2019-04-16 18:14:09 +02:00
Christoph Oelckers
798cebf891
- fixed character to int conversion for UTF8-characters.
2019-04-16 17:43:33 +02:00
Magnus Norddahl
0746784965
- 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..
2019-04-16 17:40:48 +02:00
Christoph Oelckers
f2ac0f4c53
- 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.
# Conflicts:
# src/scripting/vm/vmframe.cpp
2019-04-16 17:32:32 +02:00
Christoph Oelckers
bd4e41d6cb
-add a dummy definition for vm_jit in 32 bit.
2019-04-16 17:28:36 +02:00
Player701
e5fa48ae79
- Added a flag to make bouncing objects disappear when hitting sky surfaces
2019-04-16 17:28:33 +02:00
Magnus Norddahl
7c1730f221
- fix native call crash and assertion error
2019-04-16 17:14:31 +02:00
Magnus Norddahl
f65b7fb1be
- hook up unix unwind info (still not working)
2019-04-16 17:14:30 +02:00
Magnus Norddahl
d65298e929
- fix WriteSLEB128
2019-04-16 17:14:28 +02:00
Magnus Norddahl
14bb291901
- fix compile errors
2019-04-16 17:14:26 +02:00
Magnus Norddahl
fd0104bc71
- 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..
2019-04-16 17:14:25 +02:00
Christoph Oelckers
2f68a0681d
- fixed code generation for dummy results.
2019-04-16 17:10:39 +02:00
Christoph Oelckers
ebf368ffc6
- fixed compilation warnings.
2019-04-16 17:10:35 +02:00
Christoph Oelckers
4bffe69912
- direct native methods for dynamic arrays.
2019-04-16 17:10:33 +02:00
Christoph Oelckers
b033fd3d52
Added direct native functions to the remaining content of vmthunks.cpp
2019-04-16 15:12:47 +02:00
Christoph Oelckers
3c11090d09
- more direct native functions for sector utilities.
2019-04-16 15:12:45 +02:00
Magnus Norddahl
e4ce93382b
- Emit DW_CFA_advance_loc and DW_CFA_def_cfa_offset codes
2019-04-16 15:12:43 +02:00
Christoph Oelckers
4ac866aedc
- added a few more direct native entry points.
2019-04-16 15:12:41 +02:00
Christoph Oelckers
03b7d84058
- added a direct native function for NextHighestCeilingAt to test multiple return values.
2019-04-16 15:12:37 +02:00
Magnus Norddahl
29e051a36a
- fix typo in macro
2019-04-16 15:12:34 +02:00
Magnus Norddahl
48d211c79b
- add .eh_frame generation code except for building the actual CIE and FDE instructions
2019-04-16 15:12:31 +02:00
Christoph Oelckers
d5f4f93dd2
- allocate storage for all of a function's return values
2019-04-16 14:58:41 +02:00
Christoph Oelckers
179f5720cd
- moved the remaining exports from p_sectors.cpp to vmthunks.cpp
2019-04-16 14:58:39 +02:00
Magnus Norddahl
c8c671bbe0
- pass additional return values as the last args to a direct native call
2019-04-16 14:58:37 +02:00
Magnus Norddahl
0f27d0cd66
- use the OP_PARAM and OP_RESULT opcodes to build the function signature
2019-04-16 14:58:35 +02:00
Magnus Norddahl
4e5415d371
- fixed missing setRet call for REGT_POINTER return types
2019-04-16 14:58:34 +02:00
Magnus Norddahl
a557042bcc
- fix compile error
2019-04-16 14:58:32 +02:00
Magnus Norddahl
7c75776273
- annotate which function we are calling for better dumpjit info
2019-04-16 14:58:30 +02:00
Magnus Norddahl
ee7d6abdd3
- move the jit runtime to its own file
2019-04-16 14:58:27 +02:00
Christoph Oelckers
f3171c95cc
- fixed: Any direct native function may not use struct values as parameters, not even something as simple as an FName.
2019-04-16 14:58:25 +02:00
Christoph Oelckers
c0a26afab9
- free everything.
2019-04-16 14:58:24 +02:00
Christoph Oelckers
7c649a9f0c
- delete JIT data when shutting down.
2019-04-16 14:58:21 +02:00
Magnus Norddahl
8fc8dee090
- fix: float constants got their move instructions inserted after the call instruction
2019-04-16 14:58:19 +02:00
Christoph Oelckers
3f1c7bdbe8
- added a direct native variant for A_PlaySound because this function is relatively easy to test.
2019-04-16 14:58:15 +02:00
Magnus Norddahl
6289e0ad3d
- fix macro expansion error on gcc and clang
2019-04-16 12:41:21 +02:00
Christoph Oelckers
5efa21ad31
- finished adding direct native functions to vmthunks.cpp.
2019-04-16 12:40:48 +02:00
Christoph Oelckers
63575d22c0
- all sector exports done.
2019-04-16 12:40:46 +02:00
Christoph Oelckers
7f4ed65123
- another batch of direct native functions.
2019-04-16 12:40:43 +02:00
Christoph Oelckers
10588add9c
- continued work on adding direct native support.
2019-04-16 12:40:40 +02:00
Christoph Oelckers
178c1a41a6
- 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.
# Conflicts:
# src/p_sectors.cpp
2019-04-16 12:37:04 +02:00
Christoph Oelckers
c01981d08a
- 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.
2019-04-15 22:30:01 +02:00
Christoph Oelckers
20ec6ddce4
- 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.
2019-04-15 22:29:58 +02:00
Christoph Oelckers
376c47bef6
- fixed handling of dummy flags.
2019-04-15 22:29:55 +02:00
Christoph Oelckers
96e9dbd967
- removed all remaining native components of the weapon class.
2019-04-15 22:29:52 +02:00
Christoph Oelckers
d871072f28
- allow defining flags in the script declaration of a class and do that for Weapon.
2019-04-15 22:29:47 +02:00
Christoph Oelckers
309cc57504
- 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.
2019-04-15 22:29:43 +02:00
Christoph Oelckers
ce5792242c
- 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.
2019-04-15 22:29:39 +02:00
Christoph Oelckers
ac754b5e96
- some cleanup on the weapon slot interface.
...
This really shouldn't make any decisions from directly reading weapon class defaults.
2019-04-15 22:29:32 +02:00
Christoph Oelckers
951ed466b3
- scriptified P_BobWeapon as a virtual function on PlayerPawn.
2019-04-15 22:29:19 +02:00
Christoph Oelckers
0515af2bd3
- 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.
2019-04-15 22:29:15 +02:00
Christoph Oelckers
c1442fae0d
- scriptified P_BringUpWeapon because this was the only native function still referencing AWeapon::GetReadyState.
2019-04-15 21:58:41 +02:00
Christoph Oelckers
05e8a6c62d
- scriptified A_RailAttack.
2019-04-15 21:58:35 +02:00
Christoph Oelckers
4c7096ffac
- 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.
# Conflicts:
# src/p_acs.cpp
2019-04-15 21:58:26 +02:00
Christoph Oelckers
5f5410e35f
- 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.
2019-04-15 21:56:26 +02:00
Christoph Oelckers
9b1e96262c
- P_UndoPlayerMorph scriptified.
...
Not tested yet and still missing a new native interface.
2019-04-15 21:56:18 +02:00
Christoph Oelckers
395413fc9a
- scriptified P_MorphPlayer and dependencies.
...
It still needs its counterpart scriptified as well before it can work.
# Conflicts:
# src/gi.cpp
# wadsrc/static/zscript/base.txt
2019-04-15 21:56:16 +02:00
drfrag
60e667f732
- Fixed compilation.
2019-04-15 21:48:55 +02:00
Magnus Norddahl
5f7aeb3186
- fix missing include statement
2019-04-15 16:09:14 +02:00
Christoph Oelckers
1fd23f5228
- fixed initialization of default parameters in dynamically created function calls like in the MENUDEF parser
2019-04-15 16:09:13 +02:00
Magnus Norddahl
31f524fd6b
- inline VBTL opcode
...
- remove old META and CLSS implementations
2019-04-15 16:09:11 +02:00
Magnus Norddahl
d4e3bee7c6
- add return type to CreateFuncSignature
2019-04-15 16:09:10 +02:00
Magnus Norddahl
1aebbfb3b5
- fix typo
2019-04-15 16:09:08 +02:00
Magnus Norddahl
815b7d8b7e
- add support in the jit compiler to do direct native calls using the x64 calling convention
2019-04-15 16:09:07 +02:00
Christoph Oelckers
edfe8b36c6
- 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
2019-04-15 16:06:22 +02:00
Christoph Oelckers
5e63252fdc
- 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.
# Conflicts:
# src/v_draw.cpp
2019-04-15 16:02:17 +02:00
Christoph Oelckers
cb9c1f021c
- 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.
2019-04-15 15:52:22 +02:00
Magnus Norddahl
a277137d85
- add missing CheckVMFrame call
2019-04-15 15:52:21 +02:00
Magnus Norddahl
0fe213765b
- only allocate stack space for vmframe and call returns when we need them
2019-04-15 15:52:20 +02:00
Magnus Norddahl
03258d1334
- improve dumpjit output slightly
2019-04-15 15:52:19 +02:00
Magnus Norddahl
ec3b491f19
- don't emit VMValue.Type information when we know the receiver isn't going to read it anyway
2019-04-15 15:52:18 +02:00
Magnus Norddahl
fe64de28d4
- delay emitting PARAM and VTBL instructions until CALL/CALL_K
2019-04-15 15:52:16 +02:00
alexey.lysiuk
5d0bf48e22
- 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]
2019-04-15 15:52:15 +02:00
alexey.lysiuk
4edcb06a9d
- fixed compilation of POSIX targets
...
src/scripting/backend/vmbuilder.h:169:19: error: no member named 'function' in namespace 'std'
2019-04-15 15:52:14 +02:00
Christoph Oelckers
b33fd19fa2
- missed one OP_RESULT.
2019-04-15 15:52:13 +02:00
Christoph Oelckers
6727301330
- 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.
2019-04-15 15:52:12 +02:00
Christoph Oelckers
a900390683
- 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.
2019-04-15 15:52:11 +02:00