diff --git a/src/coreclr/System.Private.CoreLib/src/System/String.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/String.CoreCLR.cs index e66db58ba95f52..248b9a91305d80 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/String.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/String.CoreCLR.cs @@ -25,10 +25,10 @@ internal static unsafe string StrCns(uint rid, IntPtr scopeHandle) } [MethodImpl(MethodImplOptions.InternalCall)] - internal static extern unsafe string FastAllocateString(MethodTable *pMT, int length); + internal static extern unsafe string FastAllocateString(MethodTable *pMT, nint length); [DebuggerHidden] - internal static unsafe string FastAllocateString(int length) + internal static unsafe string FastAllocateString(nint length) { return FastAllocateString(TypeHandle.TypeHandleOf().AsMethodTable(), length); } diff --git a/src/coreclr/interpreter/compiler.cpp b/src/coreclr/interpreter/compiler.cpp index 2363738a3f725f..c184a263bf1bf5 100644 --- a/src/coreclr/interpreter/compiler.cpp +++ b/src/coreclr/interpreter/compiler.cpp @@ -2834,7 +2834,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re if (newObjThisArgLocation != INT_MAX) { ctorType = GetInterpType(m_compHnd->asCorInfoType(resolvedCallToken.hClass)); - if (ctorType == InterpTypeVT) + if (ctorType != InterpTypeO) { vtsize = m_compHnd->getClassSize(resolvedCallToken.hClass); PushTypeVT(resolvedCallToken.hClass, vtsize); @@ -2966,7 +2966,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re case CORINFO_CALL: if (newObj && !doCallInsteadOfNew) { - if (ctorType == InterpTypeVT) + if (ctorType != InterpTypeO) { // If this is a newobj for a value type, we need to call the constructor // and then copy the value type to the stack. @@ -5412,6 +5412,18 @@ void InterpCompiler::GenerateCode(CORINFO_METHOD_INFO* methodInfo) m_ip += 5; break; } + case CEE_CPBLK: + CHECK_STACK(3); + if (volatile_) + { + AddIns(INTOP_MEMBAR); + volatile_ = false; + } + AddIns(INTOP_CPBLK); + m_pStackPointer -= 3; + m_pLastNewIns->SetSVars3(m_pStackPointer[0].var, m_pStackPointer[1].var, m_pStackPointer[2].var); + m_ip++; + break; default: { const uint8_t *ip = m_ip - 1; diff --git a/src/coreclr/interpreter/intops.def b/src/coreclr/interpreter/intops.def index 0e1d73769a44fa..0861d0f21fbfa7 100644 --- a/src/coreclr/interpreter/intops.def +++ b/src/coreclr/interpreter/intops.def @@ -390,6 +390,7 @@ OPDEF(INTOP_GENERICLOOKUP, "generic", 4, 1, 1, InterpOpGenericLookup) OPDEF(INTOP_CALL_FINALLY, "call.finally", 2, 0, 0, InterpOpBranch) OPDEF(INTOP_ZEROBLK_IMM, "zeroblk.imm", 3, 0, 1, InterpOpInt) +OPDEF(INTOP_CPBLK, "cpblk", 4, 0, 3, InterpOpNoArgs) OPDEF(INTOP_LOCALLOC, "localloc", 3, 1, 1, InterpOpNoArgs) OPDEF(INTOP_BREAKPOINT, "breakpoint", 1, 0, 0, InterpOpNoArgs) diff --git a/src/coreclr/vm/interpexec.cpp b/src/coreclr/vm/interpexec.cpp index 2fb4f73e4f2a69..3419a19710d3b3 100644 --- a/src/coreclr/vm/interpexec.cpp +++ b/src/coreclr/vm/interpexec.cpp @@ -2012,6 +2012,18 @@ void InterpExecMethod(InterpreterFrame *pInterpreterFrame, InterpMethodContextFr memset(LOCAL_VAR(ip[1], void*), 0, ip[2]); ip += 3; break; + case INTOP_CPBLK: + { + void* dst = LOCAL_VAR(ip[1], void*); + void* src = LOCAL_VAR(ip[2], void*); + size_t size = LOCAL_VAR(ip[3], size_t); + if (size && (!dst || !src)) + COMPlusThrow(kNullReferenceException); + else + memcpyNoGCRefs(dst, src, size); + ip += 4; + break; + } case INTOP_LOCALLOC: { size_t len = LOCAL_VAR(ip[2], size_t);