Comments (3)
Handy function:
stock bool:IsJITASMJumpCapable() {
#emit lctrl 6
#emit MOVE.alt
#emit lctrl 8
#emit neq
#emit retn
return false; // make compiler happy
}
Of course, that will fail if by some remote chance the assembly address of the lctrl 6
instruction is identical to the amx address - but presumably code would then fall back on the generic implementation anyway, so not too much harm done in that unlikely scenario. Relies on the fact that lctrl 8
would be a NO-OP without the JIT (or an older version of the JIT).
from samp-plugin-jit.
This will also help solve #26 since I beleve the problem there is this: When calling a function using SCTRL 6
to jump straight to it, I manually push the return address on to the stack (as CALL
would do). However, the return address pushed is one based on the return value of LCTRL 6
, so is an AMX address not an x86 address. When the function ends it executes the JIT compiled RETN
, which pops an x86 address off the stack and jumps to it. This is why when debugging it was at strange addresses - they are valid AMX addresses being returned to by compiled code.
With this modification, the dynamic call code in YSI and amx_assembly would become:
#emit lctrl 6
#emit add.c 0x24
#emit lctrl 8
#emit push.pri
#emit load.s.pri address
#emit sctrl 6
Again, because LCTRL 8
is a no-op wthout the JIT plugin, this will work in both cases. The add.c
must come between then lctrl
s so that the address is modified in countable cell numbers before being translated to an x86 address.
from samp-plugin-jit.
Another handy function I've put in amx_assembly\amx_base.inc:
stock GetAmxJITBaseAddress() {
// Only works when the jit is installed, otherwise returns 0. The code is
// so short, checking if it had been done before would have been longer than
// just repeating the calculation.
#emit zero.pri
#emit lctrl 8
#emit retn
return 0;
}
from samp-plugin-jit.
Related Issues (20)
- Inconsistency HOT 2
- Crashes HOT 2
- floatlog is slower with jit. HOT 2
- IsJITPresent returns false in OnJITCompile HOT 4
- `alt` not preserved across SYSREQ.C calls. HOT 3
- sampctl support HOT 3
- crashdetect must be loaded before jit, jit must be loaded before crashdetect HOT 3
- [error]ubuntu 14.04 HOT 7
- AMX_EXEC_CONT (and context switching) support HOT 38
- Centos 7 JIT Crash HOT 1
- JIT bug Debian 9
- JIT crashes with Extended Vehicle Info HOT 1
- JIT Sleep: ExecContHelper tries to jump to null address. HOT 2
- crashed palyers
- package ensure failure for sampctl
- [jit] Compilation was disabled with streamer.dll enabled with jit 2.4.1 and 2.4
- [jit] Compilation was disabled , Problem & .AMX Size problem. HOT 1
- JIT and Crashdetect togetherCrashdetect HOT 1
- Invalid or unsupported instruction HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from samp-plugin-jit.