Skip to content

Commit

Permalink
Add support for previously missing helper Check_FieldOffset (#33729)
Browse files Browse the repository at this point in the history
This failure crashes Crossgen2 build of several framework assemblies
without the large version bubble. I discovered this during my work
on composite build against shared framework where we newly introduce
the notion of two separate large bubbles (app vs. framework).

Thanks

Tomas
  • Loading branch information
trylek committed Mar 18, 2020
1 parent 055e26f commit 3af8f77
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
EcmaModule targetModule = factory.SignatureContext.GetTargetModule(_fieldDesc);
SignatureContext innerContext = dataBuilder.EmitFixup(factory, _fixupKind, targetModule, factory.SignatureContext);

if (_fixupKind == ReadyToRunFixupKind.Check_FieldOffset)
{
dataBuilder.EmitInt(_fieldDesc.Offset.AsInt);
}

dataBuilder.EmitFieldSignature(_fieldDesc, innerContext);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ private void CreateNodeCaches()
);
});

_checkFieldOffsetCache = new NodeCache<FieldDesc, ISymbolNode>(key =>
{
return new PrecodeHelperImport(
_codegenNodeFactory,
new FieldFixupSignature(ReadyToRunFixupKind.Check_FieldOffset, key)
);
});

_interfaceDispatchCells = new NodeCache<MethodAndCallSite, ISymbolNode>(cellKey =>
{
return new DelayLoadHelperMethodImport(
Expand Down Expand Up @@ -376,6 +384,13 @@ public ISymbolNode FieldOffset(FieldDesc fieldDesc)
return _fieldOffsetCache.GetOrAdd(fieldDesc);
}

private NodeCache<FieldDesc, ISymbolNode> _checkFieldOffsetCache;

public ISymbolNode CheckFieldOffset(FieldDesc fieldDesc)
{
return _checkFieldOffsetCache.GetOrAdd(fieldDesc);
}

private NodeCache<TypeDesc, ISymbolNode> _fieldBaseOffsetCache;

public ISymbolNode FieldBaseOffset(TypeDesc typeDesc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2126,7 +2126,10 @@ private void EncodeFieldBaseOffset(FieldDesc field, CORINFO_FIELD_INFO* pResult,
{
if (pMT.IsValueType)
{
throw new NotImplementedException("https://github.com/dotnet/runtime/issues/32630: ENCODE_CHECK_FIELD_OFFSET: root field check import");
// ENCODE_CHECK_FIELD_OFFSET
pResult->offset = 0;
pResult->fieldAccessor = CORINFO_FIELD_ACCESSOR.CORINFO_FIELD_INSTANCE_WITH_BASE;
pResult->fieldLookup = CreateConstLookupToSymbol(_compilation.SymbolNodeFactory.CheckFieldOffset(field));
}
else
{
Expand Down

0 comments on commit 3af8f77

Please sign in to comment.