From 808dcc640fdcec9d6d1ac090d8073108cd4870c3 Mon Sep 17 00:00:00 2001 From: Sergey Andreenko Date: Tue, 18 Oct 2016 16:42:42 -0700 Subject: [PATCH] helper address is already known Commit migrated from https://github.com/dotnet/coreclr/commit/f35e83864482792785865d3286686d6a5e3dae60 --- src/coreclr/src/jit/importer.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/coreclr/src/jit/importer.cpp b/src/coreclr/src/jit/importer.cpp index 17d78af..857df2f 100644 --- a/src/coreclr/src/jit/importer.cpp +++ b/src/coreclr/src/jit/importer.cpp @@ -5785,13 +5785,18 @@ GenTreePtr Compiler::impImportStaticFieldAccess(CORINFO_RESOLVED_TOKEN* pResolve assert(embedInfo.lookup.lookupKind.needsRuntimeLookup); GenTreePtr ctxTree = getRuntimeContextTree(&embedInfo.lookup); + GenTreeArgList* args = gtNewArgList(ctxTree); - var_types type = TYP_BYREF; - op1 = impReadyToRunHelperToTree(pResolvedToken, pFieldInfo->helper, type, gtNewArgList(ctxTree), - &embedInfo.lookup.lookupKind); - FieldSeqNode* fs = GetFieldSeqStore()->CreateSingleton(pResolvedToken->hField); - op1 = gtNewOperNode(GT_ADD, type, op1, - new (this, GT_CNS_INT) GenTreeIntCon(TYP_I_IMPL, pFieldInfo->offset, fs)); + unsigned callFlags = 0; + + if (info.compCompHnd->getClassAttribs(pResolvedToken->hClass) & CORINFO_FLG_BEFOREFIELDINIT) + { + callFlags |= GTF_CALL_HOISTABLE; + } + + op1 = gtNewHelperCallNode(CORINFO_HELP_READYTORUN_STATIC_BASE, TYP_BYREF, callFlags, args); + + op1->gtCall.setEntryPoint(pFieldInfo->fieldLookup); break; } default: -- 2.7.4