mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-22 19:22:05 +00:00
Revamp macro arg system
This should significantly improve performance: on pokecrystal builds, perf reported as much CPU time spent on `yyparse` as on `sym_UseNewMacroArgs` Measurements show ~6 seconds of improvement on that codebase. This also fixes #321, as a bonus, due to saner management!
This commit is contained in:
17
test/asm/rept-shift.asm
Normal file
17
test/asm/rept-shift.asm
Normal file
@@ -0,0 +1,17 @@
|
||||
m: macro
|
||||
PRINTT "\1 "
|
||||
REPT 4
|
||||
SHIFT
|
||||
ENDR
|
||||
PRINTT "\1s!\n"
|
||||
|
||||
; Shifting a little more to check that over-shifting doesn't crash
|
||||
SHIFT
|
||||
SHIFT
|
||||
REPT 256
|
||||
SHIFT
|
||||
ENDR
|
||||
PRINTT "\1\n"
|
||||
endm
|
||||
|
||||
m This, used, not, to, work
|
||||
2
test/asm/rept-shift.err
Normal file
2
test/asm/rept-shift.err
Normal file
@@ -0,0 +1,2 @@
|
||||
ERROR: rept-shift.asm(17) -> rept-shift.asm::m(14):
|
||||
Macro argument '\1' not defined
|
||||
1
test/asm/rept-shift.out
Normal file
1
test/asm/rept-shift.out
Normal file
@@ -0,0 +1 @@
|
||||
This works!
|
||||
15
test/asm/unique-id.asm
Normal file
15
test/asm/unique-id.asm
Normal file
@@ -0,0 +1,15 @@
|
||||
print EQUS "WARN \"\\@\""
|
||||
|
||||
m: macro
|
||||
print
|
||||
REPT 2
|
||||
print
|
||||
ENDR
|
||||
print
|
||||
endm
|
||||
; TODO: Ideally we'd test now as well, but it'd cause a fatal error
|
||||
;print
|
||||
m
|
||||
;print
|
||||
m
|
||||
print
|
||||
19
test/asm/unique-id.err
Normal file
19
test/asm/unique-id.err
Normal file
@@ -0,0 +1,19 @@
|
||||
warning: unique-id.asm(12) -> unique-id.asm::m(4): [-Wuser]
|
||||
_0
|
||||
warning: unique-id.asm(12) -> unique-id.asm::m(5) -> unique-id.asm::m::REPT~1(6): [-Wuser]
|
||||
_1
|
||||
warning: unique-id.asm(12) -> unique-id.asm::m(5) -> unique-id.asm::m::REPT~2(6): [-Wuser]
|
||||
_2
|
||||
warning: unique-id.asm(12) -> unique-id.asm::m(8): [-Wuser]
|
||||
_0
|
||||
warning: unique-id.asm(14) -> unique-id.asm::m(4): [-Wuser]
|
||||
_3
|
||||
warning: unique-id.asm(14) -> unique-id.asm::m(5) -> unique-id.asm::m::REPT~1(6): [-Wuser]
|
||||
_4
|
||||
warning: unique-id.asm(14) -> unique-id.asm::m(5) -> unique-id.asm::m::REPT~2(6): [-Wuser]
|
||||
_5
|
||||
warning: unique-id.asm(14) -> unique-id.asm::m(8): [-Wuser]
|
||||
_3
|
||||
ERROR: unique-id.asm(15):
|
||||
Macro argument '\@' not defined
|
||||
while expanding symbol "print"
|
||||
0
test/asm/unique-id.out
Normal file
0
test/asm/unique-id.out
Normal file
Reference in New Issue
Block a user