[Arm64/Unix] Use portable MP optimized new/alloc (dotnet/coreclr#12333)
authorSteve MacLean <sdmaclea.qdt@qualcommdatacenter.com>
Tue, 22 Aug 2017 18:58:30 +0000 (14:58 -0400)
committerJan Kotas <jkotas@microsoft.com>
Tue, 22 Aug 2017 18:58:30 +0000 (11:58 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/f0e86604cbc2e30889ec354423bb4478924ece29

src/coreclr/src/vm/arm64/stubs.cpp

index da53568..8196ae0 100644 (file)
@@ -14,6 +14,7 @@
 #include "asmconstants.h"
 #include "virtualcallstub.h"
 #include "jitinterface.h"
+#include "ecall.h"
 
 EXTERN_C void JIT_GetSharedNonGCStaticBase_SingleAppDomain();
 EXTERN_C void JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain();
@@ -1086,6 +1087,31 @@ void JIT_TailCall()
 #if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
 void InitJITHelpers1()
 {
+#ifdef FEATURE_PAL // TODO
+    STANDARD_VM_CONTRACT;
+
+    _ASSERTE(g_SystemInfo.dwNumberOfProcessors != 0);
+
+    // Allocation helpers, faster but non-logging
+    if (!((TrackAllocationsEnabled()) ||
+        (LoggingOn(LF_GCALLOC, LL_INFO10))
+#ifdef _DEBUG
+        || (g_pConfig->ShouldInjectFault(INJECTFAULT_GCHEAP) != 0)
+#endif // _DEBUG
+        ))
+    {
+        if (GCHeapUtilities::UseThreadAllocationContexts())
+        {
+            SetJitHelperFunction(CORINFO_HELP_NEWSFAST, JIT_NewS_MP_FastPortable);
+            SetJitHelperFunction(CORINFO_HELP_NEWSFAST_ALIGN8, JIT_NewS_MP_FastPortable);
+            SetJitHelperFunction(CORINFO_HELP_NEWARR_1_VC, JIT_NewArr1VC_MP_FastPortable);
+            SetJitHelperFunction(CORINFO_HELP_NEWARR_1_OBJ, JIT_NewArr1OBJ_MP_FastPortable);
+
+            ECall::DynamicallyAssignFCallImpl(GetEEFuncEntryPoint(AllocateString_MP_FastPortable), ECall::FastAllocateString);
+        }
+    }
+#endif
+
     if(IsSingleAppDomain())
     {
         SetJitHelperFunction(CORINFO_HELP_GETSHARED_GCSTATIC_BASE,          JIT_GetSharedGCStaticBase_SingleAppDomain);