[Plugin] JIT compiler
#1

This is a Just-In-Time (JIT) compiler for AMX.

It translates AMX bytecode (the code produced by Pawn compiler) to native x86 code at run time to speed up script execution. You can read more about JIT compilation here.

Download

Changelog:

Code:
v0.3.2 - 27/03/2012
- Fixed crash of HALT/BOUNDS instructions
- Fixed crash if native function is not found - now a runtime error 19 is shown instead

v0.3.1 - 26/03/2012
- Fixed crash during compilation if script contains an empty switch statement
- Fixed crash if server.cfg contains non-ASCII characters
- Added support for LCTRL 6/SCTRL 6
- Added support for CALL.pri/JUMP.pri

v0.3 - 25/03/2012
- Now the whole script is compiled at once, when AMX is loaded. If an error occurs 
  during JIT compilation, a message is printed and the code is run as usually i.e. 
  without JIT.
- Mad it possible to set the size of stack on which JIT code is executed via the 
  "jit_stack" option in server.cfg. 
- Reduced CALL overhead of recursive functions, thanks to first item. 
- Made it possible for JUMP/JCC to jump outside of function bounds.

v0.2 - 23/03/2012
- Ported to AsmJit - http://code.******.com/p/asmjit/
- which automatically fixed a few issues

v0.1 - 19/03/2012
- Initial release

If JIT suddenly crashes your server consider running samp-server.exe under ProcDump and submitting the .dmp file to me. To do that open command prompt, cd to you server directory and run this command

Code:
path/to/procdump.exe -e -ma -x samp-server.exe samp-server.dmp
Reply
#2

Amazing?
Great job! That's awesome!
Reply
#3

What exactly performe? It saves RAM memory usage?
Reply
#4

Looks cool
Reply
#5

In english -> It will speed up your code/server?
Reply
#6

Ehm, okay. Two words: great work.
This really works, and can boost functions by more than 300%, in my opinion this is a must for every server, if it works bugfree, and could even be integrated in the samp server's amx loader.

Here are some benchmark results (floatrandom is pure pawn calculation, the rest contains more or less native functions)
Without JIT
Code:
Test "floatrandom1" finished: 2684ms (3725782.5/sec)
Test "IsPlayerAimingAt" finished: 3004ms (332889.5/sec)
Test "GetPlayerCameraAimVector" finished: 192ms (5208333.5/sec)
With JIT (windows version)
Code:
Test "floatrandom1" finished: 715ms (13986014.0/sec)
Test "IsPlayerAimingAt" finished: 2301ms (434593.6/sec)
Test "GetPlayerCameraAimVector" finished: 22ms (45454548.0/sec)
Hm, my server crashes on connection when using this, Ill try to spot the problem:
Code:
SA-MP Server: 0.3d

Exception At Address: 0x6C1D826E

Registers:
EAX: 0x00000001	EBX: 0x03FD35E8	ECX: 0xFC2C3F14	EDX: 0x021346B8
ESI: 0x03FA0778	EDI: 0x03ECC7DC	EBP: 0x00000000	ESP: 0x0018EAE4
EFLAGS: 0x00010202

Stack:
+0000: 0x00000008   0x00000000   0x00000004   0x00000002
+0010: 0x032E6E08   0x0327ECE8   0x00000034   0x0327ECE8
+0020: 0x08A50000   0x00000008   0xFFFFFFFF   0x0018EB2C
+0030: 0x6C1D830A   0x00043248   0x03FD35E8   0x0018EFC4
+0040: 0x00000000   0x02185EE0   0x0018EB3C   0x6C1DDC50
+0050: 0x00000034   0x0018EF98   0x0018EFA8   0x004718AE
+0060: 0x02185EE0   0x0018EF98   0x00000034   0x00470069
+0070: 0x65747449   0x6E4F5F72   0x79616C50   0x6F437265
+0080: 0x63656E6E   0x00470074   0x00000001   0x032E6CA8
+0090: 0x03FD35F0   0x00000000   0x00000000   0x00000000
+00A0: 0x00000000   0x00000000   0x00000000   0x00000000
+00B0: 0x00000000   0x00000000   0x00000000   0x00000000
+00C0: 0x00000000   0x00000000   0x00000000   0x00000000
+00D0: 0x00000000   0x04980000   0x84001800   0x5E0018D8
+00E0: 0xC86C1BFB   0x000018D8   0xFF000000   0xD5FFFFFF
+00F0: 0x00CF9452   0x00400219   0xFFFF0000   0x0000FFFF
+0100: 0x00000000   0x00000000   0x00000000   0x8B000000
+0110: 0x00100003   0x00000000   0x00400000   0xFFF00000
+0120: 0x0000FFFF   0x00000000   0x00980000   0x00000074
+0130: 0x00000001   0x03282DCC   0x033D0000   0x033DEFA8
Trying to use the crashdetect plugin right now...
Reply
#7

Basically, I can add this to my public server with no worry's and my server will speed up?
Reply
#8

Quote:

Basically, I can add this to my public server with no worry's and my server will speed up?

In theory yes, but I think there is bugs.

my server start and OnGameModeInit can't called
memory of server going from 80 Mb to 150 and more with step 500kb every second.

Will test it.

Size of amx file - 30 MB

If i delete OnGameModeInit my server will crash with plugin
Reply
#9

Code:
[17:25:12] [debug] Server crashed due to an unknown error
I cant really find a specific line that causes the crash. OnGameModeInit is working fine for me btw, just a connecting player crashes the server.
Reply
#10

When i open "sa-mp server.exe" i get this:
Код:
--------------------------

SA-MP Server: 0.3d-R2



Exception At Address: 0x01C60011



Registers:

EAX: 0x0012F7CC	EBX: 0x0134F770	ECX: 0x0012F7BC	EDX: 0x01C60000

ESI: 0x00B1B838	EDI: 0x00000000	EBP: 0x0012F7A4	ESP: 0x0012F7A4

EFLAGS: 0x00010206



Stack:

+0000: 0x0012F7BC   0x01C70095   0x0000000C   0x00003E10

+0010: 0x00000001   0x00000010   0x0012F7D0   0x01D00013

+0020: 0x00000008   0x00000000   0x0000B878   0x0012F7FC

+0030: 0x00C1826E   0x00000000   0x00000000   0x00B1B838

+0040: 0x00B15528   0x0000000C   0x00B15528   0x01D00000

+0050: 0x00000000   0xFFFFFFFF   0x0012F818   0x00C1830A

+0060: 0x0000AAD0   0x0134F770   0x00000000   0x00000000

+0070: 0x01330FB8   0x0012F828   0x00C1DC50   0x0000000C

+0080: 0x0012FC84   0x0012FC94   0x004718DE   0x01330FB8

+0090: 0x0012FC84   0x0000000C   0x41435353   0x4F5F464E

+00A0: 0x6C69466E   0x53726574   0x70697263   0x696E4974

+00B0: 0x00470074   0x00000000   0x00B155C0   0x0134F774

+00C0: 0x00000000   0x00000000   0x00000000   0x00000000

+00D0: 0x00000000   0x00000000   0x00000000   0x00000000

+00E0: 0x00000000   0x00000000   0x00000000   0x00000000

+00F0: 0x00000000   0x00000000   0x00000000   0x00000000

+0100: 0x5E0012E5   0xAC00BFFB   0x000012E5   0xFF000000

+0110: 0xFCFFFFFF   0xB1E25620   0x00400219   0xFFFF0000

+0120: 0x0000FFFF   0x00000000   0x00000000   0x00000000

+0130: 0x00000000   0x000C0003   0x00000000   0x00400000
Any ideea why?

If i delete "jit" from server.cfg/plugins it works perfectly!
Reply
#11

Код:
[17:33:54] [debug] Server crashed due to an unknown error
Reply
#12

I love how you make incredible things then just explain them with one paragraph like it's nothing! GREAT job!
Reply
#13

Thanks for your dedication.

I'm waiting for the update, actually it just crash my server when it's hold a large gamemode.
Reply
#14

This is an incredibly amazing work. I am waiting for the fixed version.
Reply
#15

What exactly does this do? From what I understood you can compile and not have to restart your server? I may be wrong.
Reply
#16

Quote:

Just-in-time compilation (JIT), also known as dynamic translation, is a method to improve the runtime performance of computer programs.
4char.
Reply
#17

Nice release, i'll try it
Reply
#18

Quote:
Originally Posted by Slice
Посмотреть сообщение
I love how you make incredible things then just explain them with one paragraph like it's nothing! GREAT job!
That's what amazes me to.

Incredible work - or I should say, 'as-always' keep it up!
Reply
#19

Amazing work, can you please show how much memory takes this plugin?
Reply
#20

BUG: If i use "jid" with BUD[ Blazing User Database ] by Slice my server crash when i open console.
I tested, i delete the filescripts that used BUD from server.cfg/filterscripts and works perfectly, if i put them back server crashes.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)