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

Move memset/memcpy helpers to managed impl #98623

Merged
merged 48 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
508eb9c
Remove JIT_MemSet/JIT_MemCpy
EgorBo Feb 18, 2024
32ec60e
Add a test
EgorBo Feb 18, 2024
0d4f4f4
Address feedback
EgorBo Feb 18, 2024
321bb14
Address feedback
EgorBo Feb 18, 2024
4904b4b
Address feedback
EgorBo Feb 18, 2024
1573925
Address feedback
EgorBo Feb 18, 2024
cbcfaf4
Copy Fill's impl
EgorBo Feb 18, 2024
63c893c
Address feedback + clean up
EgorBo Feb 18, 2024
36e9c5f
Fix comments
EgorBo Feb 18, 2024
4bc7578
Fix regressions
EgorBo Feb 18, 2024
4ed5a3e
Merge branch 'main' of github.com:dotnet/runtime into remove-jit-memset
EgorBo Feb 18, 2024
4158403
CI test
EgorBo Feb 19, 2024
45caa7e
Merge branch 'main' of github.com:dotnet/runtime into remove-jit-memset
EgorBo Feb 21, 2024
4d7991b
Update src/libraries/System.Private.CoreLib/src/System/SpanHelpers.cs
EgorBo Feb 21, 2024
0677bc1
Merge branch 'remove-jit-memset' of github.com:EgorBo/runtime-1 into …
EgorBo Feb 21, 2024
a76a590
Address feedback
EgorBo Feb 21, 2024
e896a47
revert jit change
EgorBo Feb 21, 2024
a8d3b98
Update issues.targets
EgorBo Feb 21, 2024
974a361
Clean up
EgorBo Feb 21, 2024
23a3613
Merge branch 'main' into remove-jit-memset
EgorBo Feb 21, 2024
2e00789
Add native memset helper
EgorBo Feb 21, 2024
71954f4
Merge branch 'main' of github.com:dotnet/runtime into remove-jit-memset
EgorBo Feb 21, 2024
c87288d
Update src/coreclr/inc/corinfo.h
EgorBo Feb 21, 2024
f06ed61
Address feedback
EgorBo Feb 21, 2024
1550a0d
Merge branch 'main' into remove-jit-memset
EgorBo Feb 21, 2024
96fa40b
Better impl for ClearWithoutReferences
EgorBo Feb 21, 2024
8dbe6d7
Fix build
EgorBo Feb 21, 2024
4095d92
Merge branch 'remove-jit-memset' of github.com:EgorBo/runtime-1 into …
EgorBo Feb 21, 2024
86c25d7
Remove whitespace
EgorBo Feb 21, 2024
2840964
Merge branch 'main' of github.com:dotnet/runtime into remove-jit-memset
EgorBo Feb 23, 2024
7d4ff29
Clean up
EgorBo Feb 23, 2024
f10915b
Add file
EgorBo Feb 23, 2024
6dfe8c0
Fix unix build
EgorBo Feb 23, 2024
ffce47e
Improve Unsafe.InitBlock
EgorBo Feb 23, 2024
2dd0c11
Tier up helpers
EgorBo Feb 23, 2024
7ce4cb7
Address feedback
EgorBo Feb 24, 2024
54639a1
Clean up
EgorBo Feb 24, 2024
d8da20a
Fix StackOverflow in Mono
EgorBo Feb 24, 2024
ec82a4d
Fix IL test
EgorBo Feb 24, 2024
f3c0141
Address feedback
EgorBo Feb 24, 2024
6e83d82
Add zero check to memmove (in case of invalid pointers with len=0)
EgorBo Feb 24, 2024
1bbaa3d
Clean up symbol name
EgorBo Feb 24, 2024
a621ad2
Add a test
EgorBo Feb 24, 2024
6283cf2
More clean up (in jit)
EgorBo Feb 24, 2024
c497ca1
Fix NAOT
EgorBo Feb 24, 2024
0a72fab
Update src/libraries/System.Private.CoreLib/src/System/SpanHelpers.By…
EgorBo Feb 25, 2024
8aa3377
Address feedback
EgorBo Feb 25, 2024
f5e0662
Update guide-for-porting.md
EgorBo Feb 25, 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
2 changes: 0 additions & 2 deletions docs/design/coreclr/botr/guide-for-porting.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,6 @@ Here is an annotated list of the stubs implemented for Unix on Arm64.
locations for NullReferenceExceptions to be generated out of a SIGSEGV
signal.

EgorBo marked this conversation as resolved.
Show resolved Hide resolved
1. `JIT_MemSet`, and `JIT_MemCpy` have this requirement

#### cgencpu.h

This header is included by various code in the VM directory. It provides a large
Expand Down
9 changes: 2 additions & 7 deletions src/coreclr/inc/jithelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,8 @@
DYNAMICJITHELPER(CORINFO_HELP_INIT_PINVOKE_FRAME, NULL, CORINFO_HELP_SIG_REG_ONLY)
#endif

#ifdef TARGET_X86
JITHELPER(CORINFO_HELP_MEMSET, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
JITHELPER(CORINFO_HELP_MEMCPY, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
#else
JITHELPER(CORINFO_HELP_MEMSET, JIT_MemSet, CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_MEMCPY, JIT_MemCpy, CORINFO_HELP_SIG_REG_ONLY)
#endif
DYNAMICJITHELPER(CORINFO_HELP_MEMSET, NULL, CORINFO_HELP_SIG_REG_ONLY)
DYNAMICJITHELPER(CORINFO_HELP_MEMCPY, NULL, CORINFO_HELP_SIG_REG_ONLY)

// Generics
JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_METHOD, JIT_GenericHandleMethod, CORINFO_HELP_SIG_REG_ONLY)
Expand Down
5 changes: 1 addition & 4 deletions src/coreclr/jit/codegenarm64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5108,10 +5108,7 @@ void CodeGen::genEmitHelperCall(unsigned helper, int argSize, emitAttr retSize,

callTarget = callTargetReg;

// adrp + add with relocations will be emitted
GetEmitter()->emitIns_R_AI(INS_adrp, EA_PTR_DSP_RELOC, callTarget,
(ssize_t)pAddr DEBUGARG((size_t)compiler->eeFindHelper(helper))
DEBUGARG(GTF_ICON_METHOD_HDL));
instGen_Set_Reg_To_Imm(EA_PTRSIZE, callTarget, (ssize_t)pAddr);
GetEmitter()->emitIns_R_R(INS_ldr, EA_PTRSIZE, callTarget, callTarget);
callType = emitter::EC_INDIR_R;
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
<Compile Include="Internal\Runtime\CompilerHelpers\ArrayHelpers.cs" />
<Compile Include="Internal\Runtime\CompilerHelpers\InteropHelpers.cs" />
<Compile Include="Internal\Runtime\CompilerHelpers\LdTokenHelpers.cs" />
<Compile Include="Internal\Runtime\CompilerHelpers\MemoryHelpers.cs" />
<Compile Include="Internal\Runtime\CompilerHelpers\RuntimeInteropData.cs" />
<Compile Include="Internal\Runtime\CompilerHelpers\SynchronizedMethodHelpers.cs" />
<Compile Include="Internal\Runtime\CompilerHelpers\TypedReferenceHelpers.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ public static void GetEntryPoint(TypeSystemContext context, ReadyToRunHelper id,
break;

case ReadyToRunHelper.MemCpy:
methodDesc = context.GetHelperEntryPoint("MemoryHelpers", "MemCopy");
methodDesc = context.SystemModule.GetKnownType("System.Runtime.CompilerServices", "RuntimeHelpers").GetKnownMethod("MemCopy", null);
break;
case ReadyToRunHelper.MemSet:
methodDesc = context.GetHelperEntryPoint("MemoryHelpers", "MemSet");
methodDesc = context.SystemModule.GetKnownType("System.Runtime.CompilerServices", "RuntimeHelpers").GetKnownMethod("MemSet", null);
break;

case ReadyToRunHelper.GetRuntimeTypeHandle:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ public DependencyList Import()

}

_dependencies.Add(GetHelperEntrypoint(ReadyToRunHelper.MemCpy), "Can be used by multiple IL opcodes implicitly");
_dependencies.Add(GetHelperEntrypoint(ReadyToRunHelper.MemSet), "Can be used by multiple IL opcodes implicitly");
EgorBo marked this conversation as resolved.
Show resolved Hide resolved

FindBasicBlocks();
ImportBasicBlocks();

Expand Down
7 changes: 0 additions & 7 deletions src/coreclr/vm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,6 @@ if(CLR_CMAKE_TARGET_ARCH_AMD64)
${ARCH_SOURCES_DIR}/AsmHelpers.asm
${ARCH_SOURCES_DIR}/CallDescrWorkerAMD64.asm
${ARCH_SOURCES_DIR}/ComCallPreStub.asm
${ARCH_SOURCES_DIR}/CrtHelpers.asm
${ARCH_SOURCES_DIR}/GenericComCallStubs.asm
${ARCH_SOURCES_DIR}/GenericComPlusCallStubs.asm
${ARCH_SOURCES_DIR}/getstate.asm
Expand Down Expand Up @@ -676,7 +675,6 @@ elseif(CLR_CMAKE_TARGET_ARCH_ARM64)
set(VM_SOURCES_WKS_ARCH_ASM
${ARCH_SOURCES_DIR}/AsmHelpers.asm
${ARCH_SOURCES_DIR}/CallDescrWorkerARM64.asm
${ARCH_SOURCES_DIR}/CrtHelpers.asm
${ARCH_SOURCES_DIR}/patchedcode.asm
${ARCH_SOURCES_DIR}/PInvokeStubs.asm
${ARCH_SOURCES_DIR}/thunktemplates.asm
Expand All @@ -693,7 +691,6 @@ else(CLR_CMAKE_TARGET_WIN32)
set(VM_SOURCES_WKS_ARCH_ASM
${ARCH_SOURCES_DIR}/asmhelpers.S
${ARCH_SOURCES_DIR}/calldescrworkeramd64.S
${ARCH_SOURCES_DIR}/crthelpers.S
${ARCH_SOURCES_DIR}/externalmethodfixupthunk.S
${ARCH_SOURCES_DIR}/getstate.S
${ARCH_SOURCES_DIR}/jithelpers_fast.S
Expand Down Expand Up @@ -723,7 +720,6 @@ else(CLR_CMAKE_TARGET_WIN32)
elseif(CLR_CMAKE_TARGET_ARCH_ARM)
set(VM_SOURCES_WKS_ARCH_ASM
${ARCH_SOURCES_DIR}/asmhelpers.S
${ARCH_SOURCES_DIR}/crthelpers.S
${ARCH_SOURCES_DIR}/ehhelpers.S
${ARCH_SOURCES_DIR}/patchedcode.S
${ARCH_SOURCES_DIR}/pinvokestubs.S
Expand All @@ -733,7 +729,6 @@ else(CLR_CMAKE_TARGET_WIN32)
set(VM_SOURCES_WKS_ARCH_ASM
${ARCH_SOURCES_DIR}/asmhelpers.S
${ARCH_SOURCES_DIR}/calldescrworkerarm64.S
${ARCH_SOURCES_DIR}/crthelpers.S
${ARCH_SOURCES_DIR}/patchedcode.S
${ARCH_SOURCES_DIR}/pinvokestubs.S
${ARCH_SOURCES_DIR}/thunktemplates.S
Expand All @@ -742,15 +737,13 @@ else(CLR_CMAKE_TARGET_WIN32)
set(VM_SOURCES_WKS_ARCH_ASM
${ARCH_SOURCES_DIR}/asmhelpers.S
${ARCH_SOURCES_DIR}/calldescrworkerloongarch64.S
${ARCH_SOURCES_DIR}/crthelpers.S
${ARCH_SOURCES_DIR}/pinvokestubs.S
${ARCH_SOURCES_DIR}/thunktemplates.S
)
elseif(CLR_CMAKE_TARGET_ARCH_RISCV64)
set(VM_SOURCES_WKS_ARCH_ASM
${ARCH_SOURCES_DIR}/asmhelpers.S
${ARCH_SOURCES_DIR}/calldescrworkerriscv64.S
${ARCH_SOURCES_DIR}/crthelpers.S
${ARCH_SOURCES_DIR}/pinvokestubs.S
${ARCH_SOURCES_DIR}/thunktemplates.S
)
Expand Down
79 changes: 0 additions & 79 deletions src/coreclr/vm/amd64/CrtHelpers.asm

This file was deleted.

74 changes: 0 additions & 74 deletions src/coreclr/vm/amd64/crthelpers.S

This file was deleted.

2 changes: 1 addition & 1 deletion src/coreclr/vm/appdomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@ void SystemDomain::LoadBaseSystemClasses()
// further loading of nonprimitive types may need casting support.
// initialize cast cache here.
CastCache::Initialize();
ECall::PopulateManagedCastHelpers();
ECall::PopulateManagedHelpers();

// used by IsImplicitInterfaceOfSZArray
CoreLibBinder::GetClass(CLASS__IENUMERABLEGENERIC);
Expand Down
51 changes: 0 additions & 51 deletions src/coreclr/vm/arm/crthelpers.S

This file was deleted.

Loading
Loading