Replace simple CLR local strings - #12517
Open
simonrozsival wants to merge 13 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR continues the effort to remove straightforward uses of the native local-string hierarchy in the CLR host/runtime by switching to fixed-size buffers (with snprintf) and by using a fixed-buffer system property retrieval API that rejects undersized buffers to avoid truncation.
Changes:
- Added a
monodroid_get_system_property(std::string_view, char*, size_t)overload and updated fixed-array callers to write directly into their buffers. - Reworked primary override directory path formatting to use
snprintfinto fixed buffers. - Replaced debug typemap full-name composition with fixed-buffer
snprintfformatting.
Show a summary per file
| File | Description |
|---|---|
| src/native/clr/runtime-base/android-system-shared.cc | Adds fixed-buffer monodroid_get_system_property overload that rejects undersized buffers and avoids truncation. |
| src/native/clr/include/runtime-base/android-system.hh | Switches property callers to fixed buffers and formats primary override dir using snprintf. |
| src/native/clr/host/typemap.cc | Uses snprintf into a fixed buffer to build managed type debug names for typemap lookup. |
| src/native/clr/host/assembly-store.cc | Uses a fixed property buffer for debug.net.asmcache instead of dynamic_local_property_string. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
from
August 25, 2026 13:57
c111658 to
3a05311
Compare
simonrozsival
changed the base branch from
dev/simonrozsival/remove-timing-dynamic-strings
to
main
August 25, 2026 13:58
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
from
August 25, 2026 15:08
2a03078 to
cda8d20
Compare
simonrozsival
changed the base branch from
main
to
dev/simonrozsival/remove-timing-dynamic-strings
August 25, 2026 15:10
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
from
August 25, 2026 15:22
cda8d20 to
2e9c443
Compare
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
2 times, most recently
from
August 25, 2026 15:42
6d947da to
ddae8f9
Compare
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
from
August 25, 2026 15:51
ddae8f9 to
4478d1c
Compare
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
from
August 25, 2026 15:59
4478d1c to
ce12492
Compare
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
from
August 25, 2026 18:53
ce12492 to
85f0111
Compare
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
from
August 25, 2026 21:27
85f0111 to
8c8f213
Compare
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
2 times, most recently
from
August 25, 2026 21:41
4a079b8 to
fb358cf
Compare
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
from
August 25, 2026 21:51
fb358cf to
ea5dfcb
Compare
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
from
August 25, 2026 22:23
ea5dfcb to
bec9cc5
Compare
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
from
August 26, 2026 07:34
bec9cc5 to
aea8dce
Compare
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
2 times, most recently
from
August 27, 2026 06:25
77b88ac to
64ae7e8
Compare
simonrozsival
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
from
August 27, 2026 10:21
64ae7e8 to
968857f
Compare
Base automatically changed from
dev/simonrozsival/remove-timing-dynamic-strings
to
main
August 27, 2026 14:25
Use fixed buffers for straightforward type-name, override-path, and system-property values, formatting composed strings with snprintf. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the remaining logger, max-gref, and timing property consumers to explicit fixed buffers so the CLR dynamic-local-string property overload can be removed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The logger interface no longer exposes local-string types, so keep the temporary include local to its remaining fallback-path implementation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Allocate managed type and timing strings to their exact sizes instead of treating the former local-string stack threshold as a maximum. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep exact-size type and timing strings independent of libc++ ownership. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the existing NativeAOT fixed-storage limit while preserving unbounded CoreCLR path construction. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use malloc only when typemap or override names exceed their sensible local buffer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve stack storage for typical managed type and override paths while allocating the exact required capacity for larger values. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Route managed type and override path heap-buffer cleanup through Util. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rely on free(nullptr) and name stack-backed CLR string storage explicitly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Eliminate separate heap pointers and free generated CLR strings only when they differ from their stack buffers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Narrowing the `strings.hh` include in `logger.hh` also removed two symbols that headers were picking up transitively through it: * `strings.hh` included `shared/helpers.hh`, which is where `os-bridge.hh` was getting `abort_unless` from. * `strings.hh` included `<unistd.h>`, which is where `bridge-processing.cc` was getting `gettid()` from. Include both explicitly at their point of use. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0a35a0db-502d-48c0-8468-e73b5dd0ab2e
jonathanpeppers
force-pushed
the
dev/simonrozsival/replace-simple-local-strings
branch
from
August 27, 2026 14:25
968857f to
a7e70fe
Compare
Narrowing the strings.hh include in logger.hh removed the transitive path that util.cc relied on for dynamic_local_string, breaking the CoreCLR and NativeAOT builds. Include the header where it is used. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0a35a0db-502d-48c0-8468-e73b5dd0ab2e
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Remove simple CLR local strings while preserving dynamic growth where the old local-string type supported it.
Changes
malloc()storage(buffer, buffer_size)calls using the platform property boundmonodroid_get_system_property(..., dynamic_local_property_string&)overloadValidation