Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow longer strings #650

Closed
Rangi42 opened this issue Dec 16, 2020 · 3 comments · Fixed by #1359
Closed

Allow longer strings #650

Rangi42 opened this issue Dec 16, 2020 · 3 comments · Fixed by #1359
Labels
enhancement Typically new features; lesser priority than bugs refactoring This PR is intended to clean up code more than change functionality rgbasm This affects RGBASM

Comments

@Rangi42
Copy link
Contributor

Rangi42 commented Dec 16, 2020

Right now MAXSTRLEN is 255. I think that a larger limit, like 1024 or even 4096, would be helpful.

@ISSOtm
Copy link
Member

ISSOtm commented Dec 19, 2020

What we really need is to remove that hardcoded limit. Raising the limit would cause lvalues to become stupidly large; note also that strings get strcpyd every time they change parser contexts. This is utterly stupid, and perhaps a source of performance loss.
Compared to malloc? I dunno. I believe there are known solutions to that, though...

@ISSOtm ISSOtm added enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM labels Dec 19, 2020
@ISSOtm ISSOtm mentioned this issue Feb 1, 2021
9 tasks
@Rangi42
Copy link
Contributor Author

Rangi42 commented Feb 24, 2021

With longer strings, test/asm/quine.asm could be reduced further to 373 bytes:

MACRO N
FOR R,1,_NARG+1
PRINT STRSUB("\n\"\\ NRT1,ABCDEFGILMnOPSU_+#()<>",\<R>,1)
ENDR
PRINTLN"\#"
ENDM
 N 19,10,12,6,21,4,5,1,15,21,6,4,6,9,8,9,25,5,10,6,16,26,8,1,22,6,17,5,7,4,23,7,6,23,24,11,28,2,3,20,3,2,3,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,2,9,3,30,6,31,9,8,29,1,14,5,13,6,1,22,6,17,5,7,18,5,2,3,27,2,1,14,5,13,19,1,4,5,4

However, \# would be 265 characters.

@Rangi42 Rangi42 added the refactoring This PR is intended to clean up code more than change functionality label Apr 4, 2021
@ISSOtm ISSOtm added this to the v0.5.1 milestone Apr 16, 2021
@ISSOtm
Copy link
Member

ISSOtm commented Apr 16, 2021

By the way, according to some perf profiling, copying lvalues is currently the largest bottleneck in RGBASM by far. A WIP implementation of heap-stored strings can be found in my fork.

Rangi42 added a commit to Rangi42/rgbds that referenced this issue Apr 29, 2021
Still to port from ISSOtm's strings branch:
- lexer.c
- parser.y
- symbol.c

Fixes gbdev#650
Fixes gbdev#505
Rangi42 added a commit to Rangi42/rgbds that referenced this issue Apr 29, 2021
Still to port from ISSOtm's strings branch:
- lexer.c
- symbol.c

Fixes gbdev#650
Fixes gbdev#505
Rangi42 added a commit to Rangi42/rgbds that referenced this issue Apr 29, 2021
Still to port from ISSOtm's strings branch:
- lexer.c
- symbol.c

Fixes gbdev#650
Fixes gbdev#505
Rangi42 added a commit to Rangi42/rgbds that referenced this issue Apr 29, 2021
Still need to port lexer.c from ISSOtm's strings branch

Fixes gbdev#650
Fixes gbdev#505
Rangi42 added a commit to Rangi42/rgbds that referenced this issue Apr 29, 2021
@Rangi42 Rangi42 modified the milestones: v0.5.1, v0.5.2 May 1, 2021
Rangi42 added a commit to Rangi42/rgbds that referenced this issue Jun 21, 2021
Rangi42 added a commit to Rangi42/rgbds that referenced this issue Jun 21, 2021
Rangi42 added a commit to Rangi42/rgbds that referenced this issue Jun 21, 2021
Rangi42 added a commit to Rangi42/rgbds that referenced this issue Jun 24, 2021
Rangi42 added a commit to Rangi42/rgbds that referenced this issue Jun 27, 2021
Rangi42 added a commit to Rangi42/rgbds that referenced this issue Jul 4, 2021
ISSOtm added a commit to Rangi42/rgbds that referenced this issue Jul 30, 2021
Fixes gbdev#650
Fixes gbdev#505

Co-Authored-By: ISSOtm <eldredhabert0@gmail.com>
@Rangi42 Rangi42 modified the milestones: v0.5.2, v0.5.3 Oct 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Typically new features; lesser priority than bugs refactoring This PR is intended to clean up code more than change functionality rgbasm This affects RGBASM
Projects
None yet
2 participants