-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Replace the fixed-size struct String
with reference-counted std::string
s
#1359
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rangi42
added
rgbasm
This affects RGBASM
refactoring
This PR is intended to clean up code more than change functionality
optimization
This increases performance or decreases size
labels
Mar 18, 2024
Rangi42
force-pushed
the
string
branch
4 times, most recently
from
March 19, 2024 05:06
679ba3f
to
1a14e2b
Compare
ISSOtm
force-pushed
the
string
branch
2 times, most recently
from
March 19, 2024 08:10
a4ce918
to
69356c7
Compare
Rangi42
force-pushed
the
string
branch
2 times, most recently
from
March 19, 2024 20:12
1c97c47
to
31bd8a3
Compare
ISSOtm
force-pushed
the
string
branch
2 times, most recently
from
March 21, 2024 00:10
2f3e0fc
to
cef6e6f
Compare
ISSOtm
changed the title
[WIP] Replace the fixed-size
Replace the fixed-size Mar 21, 2024
struct String
with reference-counted std::string
sstruct String
with reference-counted std::string
s
Rangi42
force-pushed
the
string
branch
4 times, most recently
from
March 21, 2024 16:20
1bcf6e1
to
71cd418
Compare
Rangi42
commented
Mar 21, 2024
Rangi42
force-pushed
the
string
branch
3 times, most recently
from
March 21, 2024 23:49
0a6df9b
to
1198bb6
Compare
Rangi42
force-pushed
the
string
branch
5 times, most recently
from
March 22, 2024 01:35
612fe95
to
c1a3750
Compare
This does not yet fix #709; we can't re-enable ASan for RGBASM because there are still memory leaks. At least some of them stem from these
(Possibly some of the |
Rangi42
force-pushed
the
string
branch
5 times, most recently
from
March 22, 2024 08:45
f787365
to
2f005c6
Compare
This has been relocated from macro.cpp to fstack.cpp, since both MACRO and REPT/FOR nodes have their own unique `\@` values.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
optimization
This increases performance or decreases size
refactoring
This PR is intended to clean up code more than change functionality
rgbasm
This affects RGBASM
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We tried this before in #885, now it's finally getting done!
Fixes #650. (No more string length limit!)
Be sure to rebase this, don't squash merge it, so the commits are preserved!
Still to do (but in their own individual PRs):
new
ly allocated strings which are neverdelete
d.)c_str()
, (the main remaining use case should be just passing to printf-like functions), and see if Don't terminate RGBDS strings with a NUL #505 can be completed.If we see a performance hit from any of this, there are possible optimizations to try:
std::move
on large parser values whenever possible; avoid copying strings in general.reserve
space in strings (or other STL collections) before building them up.std::string_view
, notconst std::string &
(and create these from C string literals orchar const *
pointers-to-buffers)?std::shared_ptr<std::string>
s themselves, instead of self-ownedstd::string
s?std::shared_ptr
, which would be reference-counted but not atomic. (Edit: apparently some implementations ofstd::shared_ptr
, including gcc, are not always atomic!)