Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d37d5e4
Make SString generic on an encoding traits type.
jkoritzinsky May 23, 2022
42fa6ab
Merge branch 'main' of github.com:dotnet/runtime into sstring-explici…
jkoritzinsky May 23, 2022
f913366
Fix linux build
jkoritzinsky May 24, 2022
32ddf53
Rename a few things to reduce the overall number of changes.
jkoritzinsky May 24, 2022
b2588e6
Fix linux build.
jkoritzinsky May 24, 2022
bc07888
A few more changes to reduce diffs.
jkoritzinsky May 24, 2022
8ebc5df
More diff reduction
jkoritzinsky May 24, 2022
0a5056c
Various fixes for SString. Reimplement the move semantics on SBuffer …
jkoritzinsky May 25, 2022
26f4944
Fix base type member usage with templates
jkoritzinsky May 26, 2022
824aa67
Store the result of GetPathToLoad in a local so we don't trash GetLas…
jkoritzinsky May 26, 2022
b146aae
Fix reuse bug in assembly loading.
jkoritzinsky May 27, 2022
e95cbef
Merge branch 'main' of github.com:dotnet/runtime into sstring-explici…
jkoritzinsky Jun 2, 2022
1a4d621
Merge branch 'sstring-explicit-encoding' of github.com:jkoritzinsky/r…
jkoritzinsky Jun 2, 2022
7b87012
Remove outdated comment
jkoritzinsky Jun 2, 2022
a7dcfad
Fix unix build
jkoritzinsky Jun 2, 2022
c445d35
Fix immutable empty shortcut and additional cleanup.
jkoritzinsky Jun 6, 2022
84876d8
Add static_assert message
jkoritzinsky Jun 6, 2022
2f01a7a
Fix cast issue on 32-bit
jkoritzinsky Jun 7, 2022
5aa2896
Fix default constructor to correctly mark UTF8/ASCII default EStrings…
jkoritzinsky Jun 7, 2022
b4d2fbd
Various fixes
jkoritzinsky Jun 7, 2022
bcfd0b7
Fix canary and buffer sharing handling. Fix another constructor that …
jkoritzinsky Jun 8, 2022
5a22849
Merge branch 'main' into sstring-explicit-encoding
jkoritzinsky Jun 8, 2022
7523a1f
Fix build break
jkoritzinsky Jun 9, 2022
a6fc06d
Fix super-large array rank error case handling.
jkoritzinsky Jun 9, 2022
5f53cc7
Fix some typos from bad find-replace in nativeaot code
jkoritzinsky Jun 9, 2022
93e98cf
Merge branch 'main' of github.com:dotnet/runtime into sstring-explici…
jkoritzinsky Jun 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix canary and buffer sharing handling. Fix another constructor that …
…set up invalid state to start.
  • Loading branch information
jkoritzinsky committed Jun 8, 2022
commit bcfd0b79ede79107cd8c9a36deaf53769f5e0782
2 changes: 1 addition & 1 deletion src/coreclr/inc/sbuffer.inl
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ FORCEINLINE BYTE* SBuffer::GetRawBufferForMove() const
FORCEINLINE COUNT_T SBuffer::GetAllocationForMove() const
{
#ifdef SBUFFER_CANARY_CHECKS
return (COUNT_T)(m_allocation + sizeof(SBUFFER_CANARY_VALUE) * 2);
return (COUNT_T)(m_allocation + sizeof(SBUFFER_CANARY_VALUE) * 2 + AlignmentTrim((SIZE_T)m_buffer + m_allocation, sizeof(SBUFFER_CANARY_VALUE)));
#else
return m_allocation;
#endif
Expand Down
16 changes: 12 additions & 4 deletions src/coreclr/inc/sstring.inl
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,25 @@ template<typename TEncoding>
inline EString<TEncoding>::EString(void* buffer, COUNT_T size, bool isAllocated)
: SBuffer(Prealloc, buffer, size)
{
// If this buffer was allocated on the heap, make sure to set the Allocated flag
// so we release it when resizing.
// If this buffer was allocated on the heap, that ownership is passed to this instance.
if (isAllocated)
{
SetAllocated();
if (GetRawBuffer() == nullptr)
{
// If we were unable to use the provided buffer, we need to release it as we now own the memory.
DeleteBuffer((BYTE*)buffer, size);
}
else
{
// Make sure to set the Allocated flag so we release it when resizing.
SetAllocated();
}
}
}

template<typename TEncoding>
inline EString<TEncoding>::EString(const EString &s, const CIterator &i, COUNT_T count)
: SBuffer(Immutable, StaticStringHelpers::s_EmptyBuffer, sizeof(StaticStringHelpers::s_EmptyBuffer))
: EString()
{
SS_CONTRACT_VOID
{
Expand Down