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

Remove PAL_Random and move palrt APIs into the minipal #108999

Merged
merged 30 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8a13147
Remove PAL_Random
jkoritzinsky Oct 16, 2024
f96014a
Move the "COM minipal" APIs into the regular repo minipal and update …
jkoritzinsky Oct 16, 2024
5ccbb53
Remove direct CoCreateGuid usage from CoreCLR and instead use the min…
jkoritzinsky Oct 16, 2024
cbb3c4a
Remove CoTaskMemAlloc/Free usage from xplat code (and instead use the…
jkoritzinsky Oct 16, 2024
995c858
palrt is empty, so remove it.
jkoritzinsky Oct 17, 2024
75c421d
Use minipal_u16_strlen in more places.
jkoritzinsky Oct 17, 2024
4ab9fdf
Use minipal's random APIs instead of Mono having their own
jkoritzinsky Oct 17, 2024
d44224d
fixup! Use minipal_u16_strlen in more places.
jkoritzinsky Oct 17, 2024
2b4779b
Remove 'random' usage in eventpipe and unify all usages of the minipa…
jkoritzinsky Oct 17, 2024
40077d5
PR feedback
jkoritzinsky Oct 17, 2024
9408aa6
Link minipal to bcrypt and flow it so superpmi picks it up
jkoritzinsky Oct 17, 2024
aae4c86
Make the co-task-mem-alloc PAL just call malloc
jkoritzinsky Oct 17, 2024
9ccdb60
We're in C
jkoritzinsky Oct 17, 2024
676c988
Add casts for Windows
jkoritzinsky Oct 17, 2024
1be8d8a
Fix assert
jkoritzinsky Oct 18, 2024
4f39154
Remove u16_strlen from the CoreCLR minipal
jkoritzinsky Oct 21, 2024
040549d
PR feedback and fix dbgutil.cpp
jkoritzinsky Oct 21, 2024
7ab733a
Fix CoreCLR eventpipe runtime.
jkoritzinsky Oct 21, 2024
367612d
Fix windows build
jkoritzinsky Oct 22, 2024
f31bcfd
Move guid definitions out of the minipal and back to the CoreCLR PAL …
jkoritzinsky Oct 23, 2024
329434f
Fix include path now that we're in the PAL and not palrt
jkoritzinsky Oct 24, 2024
337fcef
Add rt include directory for guid.cpp
jkoritzinsky Oct 25, 2024
2d94d0a
Export GUID_NULL from the dac's copy of the PAL for the dbi.
jkoritzinsky Oct 25, 2024
460b8e5
Revert "Remove u16_strlen from the CoreCLR minipal"
jkoritzinsky Oct 29, 2024
a907e73
Merge branch 'more-minipal' of github.com:jkoritzinsky/runtime into m…
jkoritzinsky Oct 29, 2024
1f5573e
Merge branch 'main' into more-minipal
jkoritzinsky Oct 29, 2024
2ef0a5a
Go back to a CoTaskMemAlloc PAL
jkoritzinsky Oct 29, 2024
5f4df82
Use a prefixed name everywhere instead of shiming the Win32 API name …
jkoritzinsky Oct 29, 2024
c84060e
Fix target name change after merge
jkoritzinsky Oct 29, 2024
05d141b
Don't prefix the method but instead put the header in a subfolder.
jkoritzinsky Oct 30, 2024
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
Don't prefix the method but instead put the header in a subfolder.
  • Loading branch information
jkoritzinsky committed Oct 30, 2024
commit 05d141ba290f2cd23588b8ae24a7167dfb0c2782
2 changes: 1 addition & 1 deletion src/coreclr/debug/di/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ void CordbModule::CopyRemoteMetaData(

// Allocate space for the local copy of the metadata
// No need to zero out the memory since we'll fill it all here.
LPVOID pRawBuffer = minicom_CoTaskMemAlloc(buffer.cbSize);
LPVOID pRawBuffer = CoTaskMemAlloc(buffer.cbSize);
if (pRawBuffer == NULL)
{
ThrowOutOfMemory();
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/dlls/mscorpe/pewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1589,7 +1589,7 @@ HRESULT PEWriter::write(void ** ppImage)
size_t lSize = filePos;

// allocate the block we are handing back to the caller
void * pImage = (void *) minicom_CoTaskMemAlloc(lSize);
void * pImage = (void *) CoTaskMemAlloc(lSize);
if (NULL == pImage)
{
return E_OUTOFMEMORY;
Expand Down Expand Up @@ -1622,7 +1622,7 @@ HRESULT PEWriter::write(void ** ppImage)
// make sure we wrote the exact numbmer of bytes expected
_ASSERTE(lSize == (size_t) (pCur - (char *)pImage));

// give pointer to memory image back to caller (who must free with minicom_CoTaskMemFree())
// give pointer to memory image back to caller (who must free with CoTaskMemFree())
*ppImage = pImage;

// all done
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/inc/holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "staticcontract.h"
#include "volatile.h"
#include "palclr.h"
#include <minipal/memory.h>
#include <minipal/com/memory.h>

#include <utility>
#include <type_traits>
Expand Down Expand Up @@ -970,7 +970,7 @@ template <typename TYPE>
FORCEINLINE void DeleteCoTaskMem(TYPE *value)
{
if (value)
minicom_CoTaskMemFree(value);
CoTaskMemFree(value);
}

template<typename _TYPE>
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/md/enc/stgio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void StgIO::Close()
case STGIO_SHAREDMEM:
if (m_pBaseData != NULL)
{
minicom_CoTaskMemFree(m_pBaseData);
CoTaskMemFree(m_pBaseData);
m_pBaseData = NULL;
break;
}
Expand Down
14 changes: 7 additions & 7 deletions src/coreclr/vm/gdbjit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ HRESULT FunctionMember::GetLocalsDebugInfo(NotifyGdb::PTK_TypeInfoMap pTypeMap,

MethodDebugInfo::MethodDebugInfo(int numPoints, int numLocals)
{
points = (SequencePointInfo*) minicom_CoTaskMemAlloc(sizeof(SequencePointInfo) * numPoints);
points = (SequencePointInfo*) CoTaskMemAlloc(sizeof(SequencePointInfo) * numPoints);
if (points == nullptr)
{
COMPlusThrowOM();
Expand All @@ -467,10 +467,10 @@ MethodDebugInfo::MethodDebugInfo(int numPoints, int numLocals)
return;
}

locals = (LocalVarInfo*) minicom_CoTaskMemAlloc(sizeof(LocalVarInfo) * numLocals);
locals = (LocalVarInfo*) CoTaskMemAlloc(sizeof(LocalVarInfo) * numLocals);
if (locals == nullptr)
{
minicom_CoTaskMemFree(points);
CoTaskMemFree(points);
COMPlusThrowOM();
}
memset(locals, 0, sizeof(LocalVarInfo) * numLocals);
Expand All @@ -482,13 +482,13 @@ MethodDebugInfo::~MethodDebugInfo()
if (locals)
{
for (int i = 0; i < localsSize; i++)
minicom_CoTaskMemFree(locals[i].name);
minicom_CoTaskMemFree(locals);
CoTaskMemFree(locals[i].name);
CoTaskMemFree(locals);
}

for (int i = 0; i < size; i++)
minicom_CoTaskMemFree(points[i].fileName);
minicom_CoTaskMemFree(points);
CoTaskMemFree(points[i].fileName);
CoTaskMemFree(points);
}

/* Get mapping of IL offsets to source line numbers */
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/vm/ilmarshalers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4302,7 +4302,7 @@ extern "C" void QCALLTYPE MngdNativeArrayMarshaler_ConvertSpaceToNative(MngdNati
if ( (!ClrSafeInt<SIZE_T>::multiply(cElements, cbElement, cbArray)) || cbArray > MAX_SIZE_FOR_INTEROP)
COMPlusThrow(kArgumentException, IDS_EE_STRUCTARRAYTOOLARGE);

*pNativeHome = minicom_CoTaskMemAlloc(cbArray);
*pNativeHome = CoTaskMemAlloc(cbArray);

if (*pNativeHome == NULL)
ThrowOutOfMemory();
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/vm/olevariant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1657,7 +1657,7 @@ void OleVariant::MarshalLPWSTRRArrayComToOle(BASEARRAYREF *pComArray, void *oleA
// Allocate the string using CoTaskMemAlloc.
{
GCX_PREEMP();
lpwstr = (LPWSTR)minicom_CoTaskMemAlloc(allocLength);
lpwstr = (LPWSTR)CoTaskMemAlloc(allocLength);
}
if (lpwstr == NULL)
ThrowOutOfMemory();
Expand Down Expand Up @@ -1694,7 +1694,7 @@ void OleVariant::ClearLPWSTRArray(void *oleArray, SIZE_T cElements, MethodTable
LPWSTR lpwstr = *pOle++;

if (lpwstr != NULL)
minicom_CoTaskMemFree(lpwstr);
CoTaskMemFree(lpwstr);
}
}

Expand Down Expand Up @@ -1801,7 +1801,7 @@ void OleVariant::MarshalLPSTRRArrayComToOle(BASEARRAYREF *pComArray, void *oleAr
// Allocate the string using CoTaskMemAlloc.
{
GCX_PREEMP();
lpstr = (LPSTR)minicom_CoTaskMemAlloc(allocLength);
lpstr = (LPSTR)CoTaskMemAlloc(allocLength);
}
if (lpstr == NULL)
ThrowOutOfMemory();
Expand Down Expand Up @@ -1840,7 +1840,7 @@ void OleVariant::ClearLPSTRArray(void *oleArray, SIZE_T cElements, MethodTable *
LPSTR lpstr = *pOle++;

if (lpstr != NULL)
minicom_CoTaskMemFree(lpstr);
CoTaskMemFree(lpstr);
}
}

Expand Down
1 change: 0 additions & 1 deletion src/native/minipal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include(configure.cmake)
set(SOURCES
cpufeatures.c
guid.c
memory.c
random.c
debugger.c
strings.c
Expand Down
30 changes: 30 additions & 0 deletions src/native/minipal/com/memory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#ifndef MINIPAL_COM_MEMORY_H
#define MINIPAL_COM_MEMORY_H

#include <stdlib.h>

#ifdef __cplusplus
extern "C"
{
#endif // __cplusplus

#ifndef HOST_WINDOWS
inline void* CoTaskMemAlloc(size_t cb)
{
return malloc(cb);
}

inline void CoTaskMemFree(void* pv)
{
free(pv);
}
#endif

#ifdef __cplusplus
}
#endif // __cplusplus

#endif // MINIPAL_COM_MEMORY_H
28 changes: 0 additions & 28 deletions src/native/minipal/memory.c

This file was deleted.

24 changes: 0 additions & 24 deletions src/native/minipal/memory.h

This file was deleted.

Loading