Skip to content

Commit 3f4585c

Browse files
Treat System.Runtime.CompilerServices.Unsafe as intrinsic (#68739)
* Treat System.Runtime.CompilerServices.Unsafe as intrinsic * Remove duplicated logic from Get_CORINFO_SIG_INFO * Don't create a multiply node if the size is 1 * Remove unnecessary impBashVarAddrsToI calls over gtNewIconNode * Use `#ifdef TARGET_64BIT` rather than `#if (REGSIZE_BYTES == 8)` * Don't unnecessarily call `genActualType(TYP_U_IMPL)`, just use `TYP_I_IMPL` directly * Only insert casts for `TYP_INT` to `TYP_I_IMPL` or `TYP_U_IMPL` on 64-bit * Have Unsafe.SkipInit create a `GT_NO_OP` node * Have Unsafe.Subtract and Unsafe.SubtractByteOffset be intrinsic * Adding a couple `CLANG_FORMAT_COMMENT_ANCHOR;` to comments that precede an `#ifdef` * Applying formatting patch * Revert "Have Unsafe.Subtract and Unsafe.SubtractByteOffset be intrinsic" This reverts commit 2301adc. * Fixing the operand evaluation order for NI_SRCS_UNSAFE_Add * Fixing the operand evaluation order for NI_SRCS_UNSAFE_ByteOffset * Implement NI_SRCS_UNSAFE_SubtractByteOffset * Fix the build failure * Ensure impImplicitIorI4Cast is called on op2 for NI_SRCS_UNSAFE_Add * Don't declare a `tmp` in NI_SRCS_UNSAFE_Add to make the logic clearer * Have NI_SRCS_UNSAFE_SkipInit return gtNewNothingNode * Handle side effects for NI_SRCS_UNSAFE_SkipInit * Revert "Implement NI_SRCS_UNSAFE_SubtractByteOffset" This reverts commit 7166b2e. * Manually simplify some of the NI_SRCS_* import logic * Ensure NI_SRCS_SkipInit returns the unused node when its side-effecting * Remove unnecessary comment anchors * Applying formatting patch * Try to workaround the JIT issue by spilling op1/op2 for Unsafe.Add * Apply formatting patch * Revert "Try to workaround the JIT issue by spilling op1/op2 for Unsafe.Add" * Have Unsafe.Subtract and Unsafe.SubtractByteOffset be intrinsic This reverts commit 982660e.
1 parent 5975649 commit 3f4585c

File tree

3 files changed

+577
-22
lines changed

3 files changed

+577
-22
lines changed

src/coreclr/jit/compiler.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3685,6 +3685,11 @@ class Compiler
36853685
CORINFO_SIG_INFO* sig,
36863686
bool mustExpand);
36873687

3688+
GenTree* impSRCSUnsafeIntrinsic(NamedIntrinsic intrinsic,
3689+
CORINFO_CLASS_HANDLE clsHnd,
3690+
CORINFO_METHOD_HANDLE method,
3691+
CORINFO_SIG_INFO* sig);
3692+
36883693
#ifdef FEATURE_HW_INTRINSICS
36893694
GenTree* impHWIntrinsic(NamedIntrinsic intrinsic,
36903695
CORINFO_CLASS_HANDLE clsHnd,
@@ -3968,6 +3973,7 @@ class Compiler
39683973
void impSpillStackEnsure(bool spillLeaves = false);
39693974
void impEvalSideEffects();
39703975
void impSpillSpecialSideEff();
3976+
void impSpillSideEffect(bool spillGlobEffects, unsigned chkLevel DEBUGARG(const char* reason));
39713977
void impSpillSideEffects(bool spillGlobEffects, unsigned chkLevel DEBUGARG(const char* reason));
39723978
void impSpillValueClasses();
39733979
void impSpillEvalStack();

0 commit comments

Comments
 (0)