Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>().AsMethodTable(), length);
}
Expand Down
16 changes: 14 additions & 2 deletions src/coreclr/interpreter/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/interpreter/intops.def
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 12 additions & 0 deletions src/coreclr/vm/interpexec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading