Commit graph

15252 commits

Author SHA1 Message Date
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
Christoph Oelckers
a7913e9ba9 - fixed: the direct native GetTextureSize used the wrong calling convention. 2019-04-16 17:28:35 +02:00
Player701
e5fa48ae79 - Added a flag to make bouncing objects disappear when hitting sky surfaces 2019-04-16 17:28:33 +02:00
Christoph Oelckers
5c91df5c73 - let FOBJModel::ParseVector actually use its templated size parameter
In this setup the array can be statically updated because the size is always constant per instantiation
2019-04-16 17:28:31 +02:00
Christoph Oelckers
94424aeed8 - Changed a few allocations into usin TArrays
S_SoundCurve in particular looked like a candidate for leaking memory.
2019-04-16 17:28:30 +02:00
drfrag
999f6f6920 - Fixed warning. 2019-04-16 17:25:08 +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
1a8b18d539 - fixed declaration of ChangeStatNum. 2019-04-16 17:10:37 +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
3758e3e1fa Add direct native calls to TexMan's native methods.
# Conflicts:
#	src/textures/texturemanager.cpp
2019-04-16 16:37:37 +02:00
Christoph Oelckers
886df37d1a ChangeStatNum must not be virtual
Overriding this would make the engine vulnerable to  badly behaving mods. Intercepting this and altering the behavior can render the entire game inoperable, especially if more internal code gets scriptified later. So even at the risk of breaking some carelsss mods this must be blocked.
2019-04-16 15:26:16 +02:00
Christoph Oelckers
09f4c7e4a9 Made all virtual base functions for the event handler scripted
This was by far the largest block of native virtuals, and they were only native to be able to allow checking if the event was implemented for the current handler. This can easily be done by looking at the byte code, just like VMCall also does but in turn it removes more than half of the existing native virtuals from the interface.
2019-04-16 15:26:14 +02:00
Christoph Oelckers
76ac8bf27c Direct native functions for SBarInfo
Mostly pointless because they all get used only once and aren't even virtual overrides, but I only realized this after everything was complete…
2019-04-16 15:26:13 +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
Christoph Oelckers
00fed23e5f - explicitly declare the constructor and destructor methods of FCheckPosition so that they get a working prototype. 2019-04-16 15:12:33 +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
29eee14549 - declare builtins as static. 2019-04-16 14:58:18 +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