14 Commits

Author SHA1 Message Date
Zeex
4a5e02ef29 Clean up global declarations 2017-10-28 05:05:37 +06:00
Zeex
237d89e7e4 Merge branch 'performance' of https://github.com/maddinat0r/pawn into performance 2017-10-24 08:38:47 +06: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
Daniel_Cortez
aa9f589bf5 Memoize the address of the '__line' symbol instead of searching for it in loctab/glbtab every new line 2017-10-20 23:02:34 +07: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
687d1ff017 Remove extra newlines from assembly listings
Those new lines were added in commit 6b2119f9. This is basically
an improved version of that fix.

Fixes #149.
2017-02-12 20:49:08 +06:00
Zeex
3a4878f54b Fix clang warnings 2017-02-11 19:32:10 +06:00
Zeex
8d6f051db4 Add __file, __date, __time constants
Closes #105, fixes #144.
2017-02-04 13:05:02 +06:00
Zeex
0cd10a73d6 Revert "Add built-in __file constant"
This reverts commit d15fc2224be20eac391062d1c1898b027a168713.
2017-02-03 00:45:21 +06:00
Zeex
d15fc2224b Add built-in __file constant
__file will be always set to the name of the currently processed input file.
It's similar to the __FILE__ macro in C.

See #105, #140.
2017-01-29 22:09:07 +06:00
Zeex
5cf3b0977b Add missing quotes around #file names in preprocessor output 2014-08-05 00:03:13 +07:00
Zeex
1d1244c2f0 Fix runtime error in variadic functions that return strings
This fixes a bug where returning a string from a variadic function caused
an invalid memory access error during runtime. It seems like they forgot
to update existing string return code for variadic functions.

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

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

native print(const s[]);

stock f(...)
{
	new a, b, c;
    new str[] = "hello";
    return str;
}

main() {
	print(f(1, 2, 3));
}

----- end of test code -----
2014-01-03 16:14:09 +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