21 Commits

Author SHA1 Message Date
Zeex
11199da210 Fix compile warnings in pawnc 2017-12-30 16:12:33 +06:00
Zeex
2a930cedde
Merge pull request #201 from Daniel-Cortez/op_dumpn_patch
Slightly improve 'dumpn' write performance
2017-12-30 15:01:31 +06:00
Daniel_Cortez
59428b0c39 emit/__emit: Code cleanup, misc. adjustments 2017-12-06 17:42:30 +07:00
Daniel_Cortez
6947f2e3c5 Fix input/output size miscalculation in write_encoded_n() 2017-11-05 21:29:50 +07:00
Daniel_Cortez
557ba46900 Minor fix in encode_cell() 2017-10-24 16:13:34 +07:00
Daniel_Cortez
5b190175bb Decode dumped value in do_dumpn() only once 2017-10-24 05:54:25 +07:00
Daniel_Cortez
b185b32ba1 Use hex2long() instead of getparam() in do_dump() and do_dumpn() 2017-10-23 19:07:10 +07:00
Daniel_Cortez
4b3279c3ff Fix a small mistake in hex2long() 2017-10-23 19:04:50 +07:00
Zeex
a99e649a6b Group sequences of repeating literals into one write
Add a new "dumpn" pseudo-opcode that dumps N copies of the same value
to the stage buffer. It's basically the same as "dump" but much faster
when dumping the same value a lot of times, for example, when writing
initial values for large arrays.

On my Linux system the time it took to dump a 100000000 cell array went
down from 20 to 8 seconds in Release configuration, i.e. 2.5 times faster!

I haven't profiled further yet (Visual Studio 2017 profiler is broken,
gprof won't output anything (I'm probably doing it wrong), I might try
valgrind later).
2017-10-22 12:36:55 +06:00
VVWVV
e19354a52c Add new asm operator instead of #emit
Signed-off-by: VVWVV <d0u61ev@gmail.com>
2017-07-29 22:02:26 +03:00
Zeex
3a4878f54b Fix clang warnings 2017-02-11 19:32:10 +06:00
Zeex
9d8c1c55c5 Minor style fixes 2017-01-17 23:32:18 +06:00
Yashas
fa86f8f6cb fixed indentation 2017-01-14 19:34:22 +05:30
Yashas
111785e767 public variables behaviour
1. 'stock' public (or public const) variables will be written to the file IF AND ONLY IF it has been used (read or write)
2. 'non-stock' public (or public const) variables will always be written to the file (whether or not it has been used)
3. public variables (or public const) NEVER ever trigger unused symbol warnings
2016-12-26 21:27:40 +05:30
Zeex
d8f824357f Don't remove unused public variables
But still warn about them unless they are marked as stock.

Fixes #71
2015-06-20 16:58:11 +06:00
Zeex
898e02b771 Fix MSVC compile warnings 2015-04-06 17:36:10 +06:00
Zeex
a2a8039e69 Fix debug header size miscalculation 2015-04-05 01:39:44 +06:00
Zeex
b54729c03c Fix crash with long function names
This fixes a buffer overrun introduced by commit eba8474294c1c106dd6e4f62a73160798f16458d.

The crash happens in do_call() when a function name was longer than
the max. allowed (sNAMEMAX) because of the leading '.' (dot) inserted
in command().

--------- test code --------

#include <a_samp>

OverlyLongFunctionNameYouCantEvenBotherToRead() {
	print("hey");
}

main() {
	OverlyLongFunctionNameYouCantEvenBotherToRead();
}

----- end of test code -----
2014-04-02 22:37:02 +07:00
Zeex
80eceb586d Fix compile crash on unknown assembly instruction
Make the assembler fail with a fatal error 104 "invalid assembler instruction"
if met an unknown instruction. It won't tell a correct line number though.
2014-01-04 16:00:52 +07:00
Zeex
eba8474294 Fix generation of function addresses in #emit code
This fixes a bug where the compiler generated incorrect addresses for
functions in #emit code if they were defined after the point of use.

For example, you couldn't reliably get the address of a function with
"#emit CONST.pri XXX" unless you make sure that XXX is defined before
the function in which you have you are referencing it.

Now the resolution of the function's address is deferred until assembling
phase (as with CALL), and the assembler is guaranteed to see all symbols
with their final addresses. To distinguish between functions and numeric
operands I added a '.' (period) in front of function names for both #emit
and normal calls.

See also 5) here: http://forum.sa-mp.com/showthread.php?t=355877

--------- test code --------

#include <a_samp> // DO NOT REMOVE THIS

main() {
	#emit const.pri foo
}

stock foo() {
	printf("Hello, World!");
}

----- end of test code -----
2014-01-03 09:14:06 +07:00
Zeex
766b96bcf3 Lower case directory names 2013-09-19 13:06:46 +07:00