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
292cf93fa7
- fixed TArray's Append methods.
...
I mistakenly assumed that Grow would incease the array's reserved space.
2018-11-18 01:23:14 +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
Christoph Oelckers
b2c07e731f
- completed the Dehacked fix.
...
I missed some arguments that were specified but set to 'not given'.
2018-11-17 21:33:21 +01:00
Christoph Oelckers
16c85b532b
- restored the old A_Jump prototype because DECORATE needs this to parse the arguments.
2018-11-17 21:22:18 +01:00
Christoph Oelckers
5180265ab1
- fixed: The Dehacked function wrappers now need full parameter lists.
2018-11-17 21:21:23 +01:00
Christoph Oelckers
533f66396d
Merge branch 'master' into asmjit
2018-11-17 20:16:03 +01:00
Christoph Oelckers
45ef7bca4f
- fixed: FTexture::SmoothEdges must forward its result to the base texture in case a redirection is in effect.
...
Both need the bMasked flag, or some code will think that the texture is not fully opaque if no holes were found.
2018-11-17 18:55:44 +01:00
Christoph Oelckers
08fe9c375b
- use the same formula for calculating 3DMidTex offsets as the renderer when per-sidedef scaling is used.
...
This reuses the FTexCoordInfo class the hardware renderer had been using to calculate wall texture offsetting.
The software renderers still need this sorted out to bring them in line with the rest of the code, though, but they do not have this code sufficiently well organized to make this a straightforward task.
2018-11-17 18:24:14 +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
701b793f24
- fixed parameter mixup with P_CanResurrect.
2018-11-17 16:21:08 +01:00
Christoph Oelckers
160f17a907
- fixed stencil cap generation for old hardware and changed it so that it only gets done once for each stencil setup, not for each stencil pass.
2018-11-17 15:34:23 +01:00
Christoph Oelckers
bb4007f16a
- fixed: CVar.ResetToDefault was missing a check for use outside of menus.
2018-11-17 15:23:57 +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
cfa11046ab
- changed PhosphorousFire.DoSpecialDamage to match SVE's handling:
...
* Everything with a damage factor for fire only uses that.
* Everything that bleeds takes half damage
* Robots take quarter damage.
2018-11-16 21:36:57 +01:00
Christoph Oelckers
16053c7cdb
- build full argument lists for action function calls.
...
This uses one static global array to avoid frequent reallocations.
2018-11-16 20:38:52 +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
33fb76698b
Avoid using argument count for any kind of decision making in native VM functions.
...
This allows retaining the functionality, even if for the JIT compiler's benefit all default arguments are pushed onto the stack instead of reading them from the defaults array.
2018-11-16 15:25:37 +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
Christoph Oelckers
1250eb5323
- fixed: AActor' friction field was not saved
2018-11-16 08:06:01 +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