From: Sergey Andreenko Date: Thu, 6 Apr 2017 01:23:19 +0000 (-0700) Subject: gtLdftnResolvedToken is no longer necessary, because token is saved on the stack... X-Git-Tag: submit/tizen/20210909.063632~11030^2~7401 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f3a3354f78406b9f4e6af271f73055c2f55daee;p=platform%2Fupstream%2Fdotnet%2Fruntime.git gtLdftnResolvedToken is no longer necessary, because token is saved on the stack. (dotnet/coreclr#10738) The was an error in the assert because I checked pointers that were obvious different. The actual values could not be different because they are created from the same token in the same place (importer.cpp DO_LDFTN: impMethodPointer saved resolvedToken as gtLdftnResolvedToken , CORINFO_RESOLVED_TOKEN* heapToken = impAllocateToken(resolvedToken); impPushOnStack(op1, typeInfo(heapToken)); saved the token on the stack. Commit migrated from https://github.com/dotnet/coreclr/commit/4475fd6f34bfbfd1d416d06fdea2dff8ee227150 --- diff --git a/src/coreclr/src/jit/flowgraph.cpp b/src/coreclr/src/jit/flowgraph.cpp index 50d1cfa..fa8e5ed 100644 --- a/src/coreclr/src/jit/flowgraph.cpp +++ b/src/coreclr/src/jit/flowgraph.cpp @@ -7222,7 +7222,6 @@ GenTreePtr Compiler::fgOptimizeDelegateConstructor(GenTreeCall* call, call = gtNewHelperCallNode(CORINFO_HELP_READYTORUN_DELEGATE_CTOR, TYP_VOID, GTF_EXCEPT, helperArgs); - assert(ldftnToken == targetMethod->gtFptrVal.gtLdftnResolvedToken); CORINFO_LOOKUP entryPoint; info.compCompHnd->getReadyToRunDelegateCtorHelper(ldftnToken, clsHnd, &entryPoint); assert(!entryPoint.lookupKind.needsRuntimeLookup); diff --git a/src/coreclr/src/jit/gentree.cpp b/src/coreclr/src/jit/gentree.cpp index 3628ff7..2d8c73c 100644 --- a/src/coreclr/src/jit/gentree.cpp +++ b/src/coreclr/src/jit/gentree.cpp @@ -7900,8 +7900,7 @@ GenTreePtr Compiler::gtCloneExpr( copy = new (this, oper) GenTreeFptrVal(tree->gtType, tree->gtFptrVal.gtFptrMethod); #ifdef FEATURE_READYTORUN_COMPILER - copy->gtFptrVal.gtEntryPoint = tree->gtFptrVal.gtEntryPoint; - copy->gtFptrVal.gtLdftnResolvedToken = tree->gtFptrVal.gtLdftnResolvedToken; + copy->gtFptrVal.gtEntryPoint = tree->gtFptrVal.gtEntryPoint; #endif goto DONE; diff --git a/src/coreclr/src/jit/gentree.h b/src/coreclr/src/jit/gentree.h index 2261140..5badd06 100644 --- a/src/coreclr/src/jit/gentree.h +++ b/src/coreclr/src/jit/gentree.h @@ -3715,8 +3715,7 @@ struct GenTreeFptrVal : public GenTree CORINFO_METHOD_HANDLE gtFptrMethod; #ifdef FEATURE_READYTORUN_COMPILER - CORINFO_CONST_LOOKUP gtEntryPoint; - CORINFO_RESOLVED_TOKEN* gtLdftnResolvedToken; + CORINFO_CONST_LOOKUP gtEntryPoint; #endif GenTreeFptrVal(var_types type, CORINFO_METHOD_HANDLE meth) : GenTree(GT_FTN_ADDR, type), gtFptrMethod(meth) diff --git a/src/coreclr/src/jit/importer.cpp b/src/coreclr/src/jit/importer.cpp index 11e1d47..64c6f45 100644 --- a/src/coreclr/src/jit/importer.cpp +++ b/src/coreclr/src/jit/importer.cpp @@ -1881,9 +1881,7 @@ GenTreePtr Compiler::impMethodPointer(CORINFO_RESOLVED_TOKEN* pResolvedToken, CO #ifdef FEATURE_READYTORUN_COMPILER if (opts.IsReadyToRun()) { - op1->gtFptrVal.gtEntryPoint = pCallInfo->codePointerLookup.constLookup; - op1->gtFptrVal.gtLdftnResolvedToken = new (this, CMK_Unknown) CORINFO_RESOLVED_TOKEN; - *op1->gtFptrVal.gtLdftnResolvedToken = *pResolvedToken; + op1->gtFptrVal.gtEntryPoint = pCallInfo->codePointerLookup.constLookup; } else {