Skip to content

Commit 508eb9c

Browse files
committed
Remove JIT_MemSet/JIT_MemCpy
1 parent 6d4fc1a commit 508eb9c

File tree

21 files changed

+48
-424
lines changed

21 files changed

+48
-424
lines changed

docs/design/coreclr/botr/guide-for-porting.md

-2
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,6 @@ Here is an annotated list of the stubs implemented for Unix on Arm64.
417417
locations for NullReferenceExceptions to be generated out of a SIGSEGV
418418
signal.
419419

420-
1. `JIT_MemSet`, and `JIT_MemCpy` have this requirement
421-
422420
#### cgencpu.h
423421

424422
This header is included by various code in the VM directory. It provides a large

src/coreclr/inc/jithelpers.h

+2-7
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,8 @@
235235
DYNAMICJITHELPER(CORINFO_HELP_INIT_PINVOKE_FRAME, NULL, CORINFO_HELP_SIG_REG_ONLY)
236236
#endif
237237

238-
#ifdef TARGET_X86
239-
JITHELPER(CORINFO_HELP_MEMSET, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
240-
JITHELPER(CORINFO_HELP_MEMCPY, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
241-
#else
242-
JITHELPER(CORINFO_HELP_MEMSET, JIT_MemSet, CORINFO_HELP_SIG_REG_ONLY)
243-
JITHELPER(CORINFO_HELP_MEMCPY, JIT_MemCpy, CORINFO_HELP_SIG_REG_ONLY)
244-
#endif
238+
DYNAMICJITHELPER(CORINFO_HELP_MEMSET, NULL, CORINFO_HELP_SIG_REG_ONLY)
239+
DYNAMICJITHELPER(CORINFO_HELP_MEMCPY, NULL, CORINFO_HELP_SIG_REG_ONLY)
245240

246241
// Generics
247242
JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_METHOD, JIT_GenericHandleMethod, CORINFO_HELP_SIG_REG_ONLY)

src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/MemoryHelpers.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Runtime;
6+
using System.Runtime.CompilerServices;
67

78
namespace Internal.Runtime.CompilerHelpers
89
{
@@ -15,7 +16,8 @@ private static unsafe void MemSet(ref byte dest, byte value, nuint size)
1516
{
1617
if (size > 0)
1718
{
18-
_ = dest;
19+
// Implicit nullcheck
20+
_ = Unsafe.ReadUnaligned<byte>(ref dest);
1921
SpanHelpers.Fill(ref dest, size, value);
2022
}
2123
}
@@ -24,8 +26,9 @@ private static unsafe void MemCopy(ref byte dest, ref byte src, nuint size)
2426
{
2527
if (size > 0)
2628
{
27-
_ = dest;
28-
_ = src;
29+
// Implicit nullchecks
30+
_ = Unsafe.ReadUnaligned<byte>(ref dest);
31+
_ = Unsafe.ReadUnaligned<byte>(ref src);
2932
Buffer.Memmove(ref dest, ref src, size);
3033
}
3134
}

src/coreclr/vm/CMakeLists.txt

-7
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,6 @@ if(CLR_CMAKE_TARGET_ARCH_AMD64)
636636
${ARCH_SOURCES_DIR}/AsmHelpers.asm
637637
${ARCH_SOURCES_DIR}/CallDescrWorkerAMD64.asm
638638
${ARCH_SOURCES_DIR}/ComCallPreStub.asm
639-
${ARCH_SOURCES_DIR}/CrtHelpers.asm
640639
${ARCH_SOURCES_DIR}/GenericComCallStubs.asm
641640
${ARCH_SOURCES_DIR}/GenericComPlusCallStubs.asm
642641
${ARCH_SOURCES_DIR}/getstate.asm
@@ -676,7 +675,6 @@ elseif(CLR_CMAKE_TARGET_ARCH_ARM64)
676675
set(VM_SOURCES_WKS_ARCH_ASM
677676
${ARCH_SOURCES_DIR}/AsmHelpers.asm
678677
${ARCH_SOURCES_DIR}/CallDescrWorkerARM64.asm
679-
${ARCH_SOURCES_DIR}/CrtHelpers.asm
680678
${ARCH_SOURCES_DIR}/patchedcode.asm
681679
${ARCH_SOURCES_DIR}/PInvokeStubs.asm
682680
${ARCH_SOURCES_DIR}/thunktemplates.asm
@@ -693,7 +691,6 @@ else(CLR_CMAKE_TARGET_WIN32)
693691
set(VM_SOURCES_WKS_ARCH_ASM
694692
${ARCH_SOURCES_DIR}/asmhelpers.S
695693
${ARCH_SOURCES_DIR}/calldescrworkeramd64.S
696-
${ARCH_SOURCES_DIR}/crthelpers.S
697694
${ARCH_SOURCES_DIR}/externalmethodfixupthunk.S
698695
${ARCH_SOURCES_DIR}/getstate.S
699696
${ARCH_SOURCES_DIR}/jithelpers_fast.S
@@ -723,7 +720,6 @@ else(CLR_CMAKE_TARGET_WIN32)
723720
elseif(CLR_CMAKE_TARGET_ARCH_ARM)
724721
set(VM_SOURCES_WKS_ARCH_ASM
725722
${ARCH_SOURCES_DIR}/asmhelpers.S
726-
${ARCH_SOURCES_DIR}/crthelpers.S
727723
${ARCH_SOURCES_DIR}/ehhelpers.S
728724
${ARCH_SOURCES_DIR}/patchedcode.S
729725
${ARCH_SOURCES_DIR}/pinvokestubs.S
@@ -733,7 +729,6 @@ else(CLR_CMAKE_TARGET_WIN32)
733729
set(VM_SOURCES_WKS_ARCH_ASM
734730
${ARCH_SOURCES_DIR}/asmhelpers.S
735731
${ARCH_SOURCES_DIR}/calldescrworkerarm64.S
736-
${ARCH_SOURCES_DIR}/crthelpers.S
737732
${ARCH_SOURCES_DIR}/patchedcode.S
738733
${ARCH_SOURCES_DIR}/pinvokestubs.S
739734
${ARCH_SOURCES_DIR}/thunktemplates.S
@@ -742,15 +737,13 @@ else(CLR_CMAKE_TARGET_WIN32)
742737
set(VM_SOURCES_WKS_ARCH_ASM
743738
${ARCH_SOURCES_DIR}/asmhelpers.S
744739
${ARCH_SOURCES_DIR}/calldescrworkerloongarch64.S
745-
${ARCH_SOURCES_DIR}/crthelpers.S
746740
${ARCH_SOURCES_DIR}/pinvokestubs.S
747741
${ARCH_SOURCES_DIR}/thunktemplates.S
748742
)
749743
elseif(CLR_CMAKE_TARGET_ARCH_RISCV64)
750744
set(VM_SOURCES_WKS_ARCH_ASM
751745
${ARCH_SOURCES_DIR}/asmhelpers.S
752746
${ARCH_SOURCES_DIR}/calldescrworkerriscv64.S
753-
${ARCH_SOURCES_DIR}/crthelpers.S
754747
${ARCH_SOURCES_DIR}/pinvokestubs.S
755748
${ARCH_SOURCES_DIR}/thunktemplates.S
756749
)

src/coreclr/vm/amd64/CrtHelpers.asm

-79
This file was deleted.

src/coreclr/vm/amd64/crthelpers.S

-74
This file was deleted.

src/coreclr/vm/appdomain.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1352,7 +1352,7 @@ void SystemDomain::LoadBaseSystemClasses()
13521352
// further loading of nonprimitive types may need casting support.
13531353
// initialize cast cache here.
13541354
CastCache::Initialize();
1355-
ECall::PopulateManagedCastHelpers();
1355+
ECall::PopulateManagedHelpers();
13561356

13571357
// used by IsImplicitInterfaceOfSZArray
13581358
CoreLibBinder::GetClass(CLASS__IENUMERABLEGENERIC);

src/coreclr/vm/arm/crthelpers.S

-51
This file was deleted.

src/coreclr/vm/arm64/crthelpers.S

-33
This file was deleted.

0 commit comments

Comments
 (0)