This explicitly calls FixupArgument() only for the 2 instructions where a fixup may be expected to be applied to a literal arg. These are:
* SCMD_WRITELIT
* SCMD_LITTOREG
Based on the idea by @ericoporto
This is more code lines, and looks kind of ugly, but proved to be significantly faster enough to justify this change.
Maybe there are more ways to refactor and tidy this in the future.
From upstream 9f255eab2343896928039dbca71576718f5f7380
Although this means more code lines, it reduces redundant variable
initialization and assertions, which may lead to slightly optimized execution.
In addition, this change makes argument read explicit, under each individual opcode.
From upstream 777cd4a4effd1c1785582e847f9fcdadef5fe7e0
Stack stores either "values" or arrays. Values are always stored as int32:
these are ints, floats, managed handles, also "pointers".
Although we don't store things like pointers in the stack buffer for real,
we store them as stack "entries" as RuntimeScriptValues.
But we keep stack pointer consistent by moving along the buffer,
to avoid unnecessary data type tests. Basically, the stack buffer will be
holding 32-bit placeholders.
From upstream 338afc27ece7ff4030101887c9f00ab4f24ca3ca
This was an early attempt to pick out few operations into separate functions,
but IIRC this caused additional slowdown. Maybe was not done in an optimal way.
In any case, it's better to remove the old commented code, as there may be slight
differences between that and current inlined code now.
They may be recreated if necessary for another refactor. Just need to be aware of
potential performance issues, and do tests.
From upstream 961569db426af1c09c7d9da38f5f4e4a0e09b499
The latest change (c694126) was meant to fix a timeout test logic,
but it broke the primary loop count check.
The incorrect behavior may be observed when a function with
many loops and `noloopcheck` modifier is called *repeatedly*
from another function. Normally in such case the iterations
passed withing a `noloopcheck` function should not be counted,
but they were.
Apparently the situation cannot be resolved without having 2 counters:
1. One is working all the time, and is used to detect timeouts, as these
may occur both in normal circumstances and in functions with
`noloopcheck` modifier.
2. Second is working only in functions without `noloopcheck` modifier
and is used to do the "stuck in a loop" test.
+ backported small optimization from 3.6.1 branch.
From upstream 70afd47f4879b4eaed5dab664af9e4485055875f
* Fixed _lastAliveTs was not reset right after calling sys_evt_process_pending();
this caused events polling called continuously after timeout happened once.
* Set timeout to 60 fps (16.777 ms) instead of random 10ms.
* Do the timeout test only each 1000th loop iteration.
* Few other tiny adjustments in code.
Partially from upstream 60aaef003021fec2f75d4dc6db1b24f0b5d2be65
Was broken by dec92f05ea
(e38df03c5d1658a2c44a26ba4ee6f22663c1e701 in upstream).
Some games do not have function arg count appended to the function names in
the export table; in that case `export_args` remained uninitialized.
From upstream cdbb7a7367db57e14983015232ecc97f6a3dd212
The timeout method introduced by 6f665dfe is not working very well and
gives "false positives", so I'll disable it for the time being.
From upstream e0edb28b6606c360a1ea3fdcc487c2b05929ed02
This helps kill "hanging" scripts if user closed the window while
there's no real engine update.
From upstream a758fd6de2dccd0c948fc7f9e5b65200df902a65